NVIDIA DeepStream SDK API Reference

9.2 Release
9.2/includes/opentelemetry/sdk/metrics/aggregation/base2_exponential_histogram_aggregation.h
Go to the documentation of this file.
1 // Copyright The OpenTelemetry Authors
2 // SPDX-License-Identifier: Apache-2.0
3 
4 #pragma once
5 
6 #include <stdint.h>
7 #include <memory>
8 
9 #include "opentelemetry/common/spin_lock_mutex.h"
10 #include "opentelemetry/sdk/metrics/aggregation/aggregation.h"
11 #include "opentelemetry/sdk/metrics/aggregation/aggregation_config.h"
12 #include "opentelemetry/sdk/metrics/aggregation/base2_exponential_histogram_indexer.h"
13 #include "opentelemetry/sdk/metrics/data/circular_buffer.h"
14 #include "opentelemetry/sdk/metrics/data/metric_data.h"
15 #include "opentelemetry/sdk/metrics/data/point_data.h"
16 #include "opentelemetry/version.h"
17 
19 namespace sdk
20 {
21 namespace metrics
22 {
23 
24 class Base2ExponentialHistogramAggregation : public Aggregation
25 {
26 public:
27  Base2ExponentialHistogramAggregation(const AggregationConfig *aggregation_config = nullptr);
28  Base2ExponentialHistogramAggregation(const Base2ExponentialHistogramPointData &point_data);
29  Base2ExponentialHistogramAggregation(Base2ExponentialHistogramPointData &&point_data);
30 
31  void Aggregate(int64_t value, const PointAttributes &attributes = {}) noexcept override;
32  void Aggregate(double value, const PointAttributes &attributes = {}) noexcept override;
33 
34  /* Returns the result of merge of the existing aggregation with delta
35  * aggregation with same boundaries */
36  std::unique_ptr<Aggregation> Merge(const Aggregation &delta) const noexcept override;
37 
38  /* Returns the new delta aggregation by comparing existing aggregation with
39  * next aggregation with same boundaries. Data points for `next` aggregation
40  * (sum , bucket-counts) should be more than the current aggregation - which
41  * is the normal scenario as measurements values are monotonic increasing.
42  */
43  std::unique_ptr<Aggregation> Diff(const Aggregation &next) const noexcept override;
44 
45  PointType ToPoint() const noexcept override;
46 
47 private:
48  void AggregateIntoBuckets(std::unique_ptr<AdaptingCircularBufferCounter> &buckets,
49  double value) noexcept;
50  void Downscale(uint32_t by) noexcept;
51 
52  mutable opentelemetry::common::SpinLockMutex lock_;
53  Base2ExponentialHistogramPointData point_data_;
54  Base2ExponentialHistogramIndexer indexer_;
55  bool record_min_max_ = true;
56 };
57 
58 } // namespace metrics
59 } // namespace sdk
nostd::unique_ptr
std::unique_ptr< _Types... > unique_ptr
Definition: includes/opentelemetry/std/unique_ptr.h:19
sdk::metrics::PointAttributes
opentelemetry::sdk::common::OrderedAttributeMap PointAttributes
Definition: includes/opentelemetry/sdk/metrics/data/metric_data.h:20
sdk::metrics::Base2ExponentialHistogramAggregation::Base2ExponentialHistogramAggregation
Base2ExponentialHistogramAggregation(const AggregationConfig *aggregation_config=nullptr)
OPENTELEMETRY_BEGIN_NAMESPACE
#define OPENTELEMETRY_BEGIN_NAMESPACE
Definition: includes/opentelemetry/version.h:21
sdk::metrics::Base2ExponentialHistogramAggregation::Aggregate
void Aggregate(int64_t value, const PointAttributes &attributes={}) noexcept override
OPENTELEMETRY_END_NAMESPACE
#define OPENTELEMETRY_END_NAMESPACE
Definition: includes/opentelemetry/version.h:24
sdk::metrics::Base2ExponentialHistogramAggregation::Diff
std::unique_ptr< Aggregation > Diff(const Aggregation &next) const noexcept override
std
Extensions to the C++ standard library.
Definition: includes/opentelemetry/nostd/string_view.h:212
sdk
Definition: includes/opentelemetry/sdk/common/atomic_shared_ptr.h:13
metrics
Definition: includes/opentelemetry/metrics/async_instruments.h:10
sdk::metrics::PointType
opentelemetry::nostd::variant< SumPointData, HistogramPointData, Base2ExponentialHistogramPointData, LastValuePointData, DropPointData > PointType
Definition: includes/opentelemetry/sdk/metrics/data/metric_data.h:25
sdk::metrics::Base2ExponentialHistogramAggregation::Merge
std::unique_ptr< Aggregation > Merge(const Aggregation &delta) const noexcept override
opentelemetry
Definition: includes/opentelemetry/exporters/otlp/otlp_grpc_client.h:38
common
Definition: includes/opentelemetry/common/attribute_value.h:14
sdk::metrics::Base2ExponentialHistogramAggregation::ToPoint
PointType ToPoint() const noexcept override