]> git.proxmox.com Git - ceph.git/blob - ceph/src/jaegertracing/opentelemetry-cpp/sdk/include/opentelemetry/sdk/metrics/aggregation/aggregation.h
update ceph source to reef 18.1.2
[ceph.git] / ceph / src / jaegertracing / opentelemetry-cpp / sdk / include / opentelemetry / sdk / metrics / aggregation / aggregation.h
1 // Copyright The OpenTelemetry Authors
2 // SPDX-License-Identifier: Apache-2.0
3
4 #pragma once
5 #ifndef ENABLE_METRICS_PREVIEW
6 # include "opentelemetry/nostd/string_view.h"
7 # include "opentelemetry/sdk/metrics/data/metric_data.h"
8 # include "opentelemetry/sdk/metrics/data/point_data.h"
9 OPENTELEMETRY_BEGIN_NAMESPACE
10 namespace sdk
11 {
12 namespace metrics
13 {
14 class Aggregation
15 {
16 public:
17 virtual void Aggregate(long value, const PointAttributes &attributes = {}) noexcept = 0;
18
19 virtual void Aggregate(double value, const PointAttributes &attributes = {}) noexcept = 0;
20
21 /**
22 * Returns the result of the merge of the two aggregations.
23 *
24 * This should always assume that the aggregations do not overlap and merge together for a new
25 * cumulative report.
26 *
27 * @param delta the newly captured (delta) aggregation
28 * @return the result of the merge of the given aggregation.
29 */
30
31 virtual std::unique_ptr<Aggregation> Merge(const Aggregation &delta) const noexcept = 0;
32
33 /**
34 * Returns a new delta aggregation by comparing two cumulative measurements.
35 *
36 * @param next the newly captured (cumulative) aggregation.
37 * @return The resulting delta aggregation.
38 */
39 virtual std::unique_ptr<Aggregation> Diff(const Aggregation &next) const noexcept = 0;
40
41 /**
42 * Returns the point data that the aggregation will produce.
43 *
44 * @return PointType
45 */
46
47 virtual PointType ToPoint() const noexcept = 0;
48
49 virtual ~Aggregation() = default;
50 };
51
52 } // namespace metrics
53 } // namespace sdk
54 OPENTELEMETRY_END_NAMESPACE
55 #endif