collectable.h 590 B

123456789101112131415161718192021222324252627
  1. #pragma once
  2. #include <vector>
  3. #include "prometheus/metric_family.h"
  4. namespace prometheus {
  5. /// @brief Interface implemented by anything that can be used by Prometheus to
  6. /// collect metrics.
  7. ///
  8. /// A Collectable has to be registered for collection. See Registry.
  9. class Collectable {
  10. public:
  11. //Collectable() = default;
  12. virtual ~Collectable() = default;
  13. using MetricFamilies = std::vector<MetricFamily>;
  14. /// \brief Returns a list of metrics and their samples.
  15. virtual MetricFamilies Collect() const = 0;
  16. };
  17. } // namespace prometheus