| 12345678910111213141516171819202122232425262728 | 
							- #include "metrics_collector.h"
 
- #include "prometheus/collectable.h"
 
- namespace prometheus {
 
- namespace detail {
 
- std::vector<MetricFamily> CollectMetrics(
 
-     const std::vector<std::weak_ptr<prometheus::Collectable>>& collectables) {
 
-   auto collected_metrics = std::vector<MetricFamily>{};
 
-   for (auto&& wcollectable : collectables) {
 
-     auto collectable = wcollectable.lock();
 
-     if (!collectable) {
 
-       continue;
 
-     }
 
-     auto&& metrics = collectable->Collect();
 
-     collected_metrics.insert(collected_metrics.end(),
 
-                              std::make_move_iterator(metrics.begin()),
 
-                              std::make_move_iterator(metrics.end()));
 
-   }
 
-   return collected_metrics;
 
- }
 
- }  // namespace detail
 
- }  // namespace prometheus
 
 
  |