NVIDIA DeepStream SDK API Reference

9.2 Release
9.2/includes/prometheus/client_metric.h
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3  * SPDX-License-Identifier: Apache-2.0
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17 
18 #pragma once
19 
20 #include <cstdint>
21 #include <string>
22 #include <tuple>
23 #include <vector>
24 
25 #include "prometheus/detail/core_export.h"
26 
27 namespace prometheus {
28 
29 struct PROMETHEUS_CPP_CORE_EXPORT ClientMetric {
30  // Label
31 
32  struct Label {
33  std::string name;
34  std::string value;
35 
36  friend bool operator<(const Label& lhs, const Label& rhs) {
37  return std::tie(lhs.name, lhs.value) < std::tie(rhs.name, rhs.value);
38  }
39 
40  friend bool operator==(const Label& lhs, const Label& rhs) {
41  return std::tie(lhs.name, lhs.value) == std::tie(rhs.name, rhs.value);
42  }
43  };
44  std::vector<Label> label;
45 
46  // Counter
47 
48  struct Counter {
49  double value = 0.0;
50  };
51  Counter counter;
52 
53  // Gauge
54 
55  struct Gauge {
56  double value = 0.0;
57  };
58  Gauge gauge;
59 
60  // Info
61 
62  struct Info {
63  double value = 1.0;
64  };
65  Info info;
66 
67  // Summary
68 
69  struct Quantile {
70  double quantile = 0.0;
71  double value = 0.0;
72  };
73 
74  struct Summary {
75  std::uint64_t sample_count = 0;
76  double sample_sum = 0.0;
77  std::vector<Quantile> quantile;
78  };
79  Summary summary;
80 
81  // Histogram
82 
83  struct Bucket {
84  std::uint64_t cumulative_count = 0;
85  double upper_bound = 0.0;
86  };
87 
88  struct Histogram {
89  std::uint64_t sample_count = 0;
90  double sample_sum = 0.0;
91  std::vector<Bucket> bucket;
92  };
94 
95  // Untyped
96 
97  struct Untyped {
98  double value = 0;
99  };
100  Untyped untyped;
101 
102  // Timestamp
103 
104  std::int64_t timestamp_ms = 0;
105 };
106 
107 } // namespace prometheus
prometheus::MetricType::Untyped
@ Untyped
sdk::configuration::InstrumentType::histogram
@ histogram
prometheus::ClientMetric::Label::operator==
friend bool operator==(const Label &lhs, const Label &rhs)
Definition: 9.2/includes/prometheus/client_metric.h:40
prometheus::ClientMetric::Label::operator<
friend bool operator<(const Label &lhs, const Label &rhs)
Definition: 9.2/includes/prometheus/client_metric.h:36
prometheus::ClientMetric::Label
Definition: includes/prometheus/client_metric.h:32
PROMETHEUS_CPP_CORE_EXPORT
#define PROMETHEUS_CPP_CORE_EXPORT
Definition: includes/prometheus/detail/core_export.h:31
prometheus::MetricType::Histogram
@ Histogram
prometheus::Label
Labels::value_type Label
Single label and its value.
Definition: includes/prometheus/labels.h:29
sdk::common::internal_log::LogLevel::Info
@ Info
prometheus::MetricType::Gauge
@ Gauge
prometheus::Counter
A counter metric to represent a monotonically increasing value.
Definition: includes/prometheus/counter.h:43
prometheus::MetricType::Summary
@ Summary
prometheus
Definition: includes/prometheus/check_names.h:25