Kagome
Polkadot Runtime Engine in C++17
registry.hpp
Go to the documentation of this file.
1 #ifndef KAGOME_CORE_METRICS_REGISTRY_HPP
2 #define KAGOME_CORE_METRICS_REGISTRY_HPP
3 
4 #include <chrono>
5 #include <map>
6 #include <string>
7 #include <vector>
8 
9 namespace kagome::metrics {
10 
11  class Counter;
12  class Gauge;
13  class Handler;
14  class Histogram;
15  class Summary;
16 
30  class Registry {
31  public:
32  virtual ~Registry() = default;
33  virtual void setHandler(Handler &handler) = 0;
34 
35  virtual void registerCounterFamily(
36  const std::string &name,
37  const std::string &help = "",
38  const std::map<std::string, std::string> &labels = {}) = 0;
39 
40  virtual void registerGaugeFamily(
41  const std::string &name,
42  const std::string &help = "",
43  const std::map<std::string, std::string> &labels = {}) = 0;
44 
45  virtual void registerHistogramFamily(
46  const std::string &name,
47  const std::string &help = "",
48  const std::map<std::string, std::string> &labels = {}) = 0;
49 
50  virtual void registerSummaryFamily(
51  const std::string &name,
52  const std::string &help = "",
53  const std::map<std::string, std::string> &labels = {}) = 0;
54 
62  const std::string &name,
63  const std::map<std::string, std::string> &labels = {}) = 0;
64 
71  virtual Gauge *registerGaugeMetric(
72  const std::string &name,
73  const std::map<std::string, std::string> &labels = {}) = 0;
74 
85  const std::string &name,
86  const std::vector<double> &bucket_boundaries,
87  const std::map<std::string, std::string> &labels = {}) = 0;
88 
102  const std::string &name,
103  const std::vector<std::pair<double, double>> &quantiles,
104  std::chrono::milliseconds max_age = std::chrono::seconds{60},
105  int age_buckets = 5,
106  const std::map<std::string, std::string> &labels = {}) = 0;
107  };
108 
109 } // namespace kagome::metrics
110 
111 #endif // KAGOME_CORE_METRICS_REGISTRY_HPP
an interface to add request handler for metrics::Exposer implementation generally will contain metric...
Definition: handler.hpp:22
virtual void registerGaugeFamily(const std::string &name, const std::string &help="", const std::map< std::string, std::string > &labels={})=0
virtual void registerHistogramFamily(const std::string &name, const std::string &help="", const std::map< std::string, std::string > &labels={})=0
virtual Summary * registerSummaryMetric(const std::string &name, const std::vector< std::pair< double, double >> &quantiles, std::chrono::milliseconds max_age=std::chrono::seconds{60}, int age_buckets=5, const std::map< std::string, std::string > &labels={})=0
create summary metrics object
virtual void setHandler(Handler &handler)=0
virtual ~Registry()=default
A histogram metric to represent aggregatable distributions of events.
Definition: metrics.hpp:108
virtual Counter * registerCounterMetric(const std::string &name, const std::map< std::string, std::string > &labels={})=0
create counter metrics object
kagome::api::Method< Request, AuthorApi > Handler
A summary metric samples observations over a sliding window of time.
Definition: metrics.hpp:91
virtual Histogram * registerHistogramMetric(const std::string &name, const std::vector< double > &bucket_boundaries, const std::map< std::string, std::string > &labels={})=0
create histogram metrics object
virtual Gauge * registerGaugeMetric(const std::string &name, const std::map< std::string, std::string > &labels={})=0
create gauge metrics object
virtual void registerCounterFamily(const std::string &name, const std::string &help="", const std::map< std::string, std::string > &labels={})=0
virtual void registerSummaryFamily(const std::string &name, const std::string &help="", const std::map< std::string, std::string > &labels={})=0
A gauge metric to represent a value that can arbitrarily go up and down.
Definition: metrics.hpp:49
A counter metric to represent a monotonically increasing value.
Definition: metrics.hpp:27
the class stores metrics, provides interface to create metrics and families of metrics TODO(sanblch) ...
Definition: registry.hpp:30