NVIDIA DeepStream SDK API Reference

8.0 Release
9.0/sources/includes/prometheus/client_metric.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <cstdint>
4 #include <string>
5 #include <tuple>
6 #include <vector>
7 
8 #include "prometheus/detail/core_export.h"
9 
10 namespace prometheus {
11 
12 struct PROMETHEUS_CPP_CORE_EXPORT ClientMetric {
13  // Label
14 
15  struct Label {
16  std::string name;
17  std::string value;
18 
19  friend bool operator<(const Label& lhs, const Label& rhs) {
20  return std::tie(lhs.name, lhs.value) < std::tie(rhs.name, rhs.value);
21  }
22 
23  friend bool operator==(const Label& lhs, const Label& rhs) {
24  return std::tie(lhs.name, lhs.value) == std::tie(rhs.name, rhs.value);
25  }
26  };
27  std::vector<Label> label;
28 
29  // Counter
30 
31  struct Counter {
32  double value = 0.0;
33  };
34  Counter counter;
35 
36  // Gauge
37 
38  struct Gauge {
39  double value = 0.0;
40  };
41  Gauge gauge;
42 
43  // Info
44 
45  struct Info {
46  double value = 1.0;
47  };
48  Info info;
49 
50  // Summary
51 
52  struct Quantile {
53  double quantile = 0.0;
54  double value = 0.0;
55  };
56 
57  struct Summary {
58  std::uint64_t sample_count = 0;
59  double sample_sum = 0.0;
60  std::vector<Quantile> quantile;
61  };
62  Summary summary;
63 
64  // Histogram
65 
66  struct Bucket {
67  std::uint64_t cumulative_count = 0;
68  double upper_bound = 0.0;
69  };
70 
71  struct Histogram {
72  std::uint64_t sample_count = 0;
73  double sample_sum = 0.0;
74  std::vector<Bucket> bucket;
75  };
76  Histogram histogram;
77 
78  // Untyped
79 
80  struct Untyped {
81  double value = 0;
82  };
83  Untyped untyped;
84 
85  // Timestamp
86 
87  std::int64_t timestamp_ms = 0;
88 };
89 
90 } // namespace prometheus
prometheus::MetricType::Info
@ Info
prometheus::MetricType::Untyped
@ Untyped
prometheus::ClientMetric::Label::operator==
friend bool operator==(const Label &lhs, const Label &rhs)
Definition: 9.0/sources/includes/prometheus/client_metric.h:23
prometheus::ClientMetric::Label::operator<
friend bool operator<(const Label &lhs, const Label &rhs)
Definition: 9.0/sources/includes/prometheus/client_metric.h:19
prometheus::ClientMetric::Label
Definition: sources/includes/prometheus/client_metric.h:15
prometheus::MetricType::Histogram
@ Histogram
prometheus::Label
Labels::value_type Label
Single label and its value.
Definition: sources/includes/prometheus/labels.h:12
prometheus::MetricType::Gauge
@ Gauge
prometheus::Counter
A counter metric to represent a monotonically increasing value.
Definition: sources/includes/prometheus/counter.h:26
prometheus::MetricType::Summary
@ Summary
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