NVIDIA DeepStream SDK API Reference

8.0 Release
sources/includes/prometheus/histogram.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <mutex>
4 #include <vector>
5 
6 #include "prometheus/client_metric.h"
7 #include "prometheus/counter.h"
8 #include "prometheus/detail/builder.h" // IWYU pragma: export
9 #include "prometheus/detail/core_export.h"
10 #include "prometheus/gauge.h"
11 #include "prometheus/metric_type.h"
12 
13 namespace prometheus {
14 
32  public:
33  using BucketBoundaries = std::vector<double>;
34 
35  static const MetricType metric_type{MetricType::Histogram};
36 
47  explicit Histogram(const BucketBoundaries& buckets);
48 
50  explicit Histogram(BucketBoundaries&& buckets);
51 
58  void Observe(double value);
59 
65  void ObserveMultiple(const std::vector<double>& bucket_increments,
66  double sum_of_values);
67 
72  void Reset();
73 
77  ClientMetric Collect() const;
78 
79  private:
80  BucketBoundaries bucket_boundaries_;
81  mutable std::mutex mutex_;
82  std::vector<Counter> bucket_counts_;
83  Gauge sum_;
84 };
85 
113 PROMETHEUS_CPP_CORE_EXPORT detail::Builder<Histogram> BuildHistogram();
114 
115 } // namespace prometheus
prometheus::Histogram
A histogram metric to represent aggregatable distributions of events.
Definition: sources/includes/prometheus/histogram.h:31
prometheus::ClientMetric
Definition: sources/includes/prometheus/client_metric.h:12
prometheus::MetricType::Histogram
@ Histogram
prometheus::BuildHistogram
PROMETHEUS_CPP_CORE_EXPORT detail::Builder< Histogram > BuildHistogram()
Return a builder to configure and register a Histogram metric.
prometheus::MetricType
MetricType
Definition: sources/includes/prometheus/metric_type.h:5
prometheus::Histogram::BucketBoundaries
std::vector< double > BucketBoundaries
Definition: sources/includes/prometheus/histogram.h:33
prometheus::Gauge
A gauge metric to represent a value that can arbitrarily go up and down.
Definition: sources/includes/prometheus/gauge.h:24
prometheus
Definition: sources/includes/prometheus/check_names.h:8
PROMETHEUS_CPP_CORE_EXPORT
#define PROMETHEUS_CPP_CORE_EXPORT
Definition: sources/includes/prometheus/detail/core_export.h:15