]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/jaegertracing/opentelemetry-cpp/sdk/include/opentelemetry/sdk/metrics/aggregation/sum_aggregation.h
update ceph source to reef 18.1.2
[ceph.git] / ceph / src / jaegertracing / opentelemetry-cpp / sdk / include / opentelemetry / sdk / metrics / aggregation / sum_aggregation.h
diff --git a/ceph/src/jaegertracing/opentelemetry-cpp/sdk/include/opentelemetry/sdk/metrics/aggregation/sum_aggregation.h b/ceph/src/jaegertracing/opentelemetry-cpp/sdk/include/opentelemetry/sdk/metrics/aggregation/sum_aggregation.h
new file mode 100644 (file)
index 0000000..14f13bd
--- /dev/null
@@ -0,0 +1,64 @@
+// Copyright The OpenTelemetry Authors
+// SPDX-License-Identifier: Apache-2.0
+
+#pragma once
+#ifndef ENABLE_METRICS_PREVIEW
+#  include "opentelemetry/common/spin_lock_mutex.h"
+#  include "opentelemetry/sdk/metrics/aggregation/aggregation.h"
+
+#  include <mutex>
+
+OPENTELEMETRY_BEGIN_NAMESPACE
+namespace sdk
+{
+namespace metrics
+{
+
+class LongSumAggregation : public Aggregation
+{
+public:
+  LongSumAggregation();
+  LongSumAggregation(SumPointData &&);
+  LongSumAggregation(const SumPointData &);
+
+  void Aggregate(long value, const PointAttributes &attributes = {}) noexcept override;
+
+  void Aggregate(double value, const PointAttributes &attributes = {}) noexcept override {}
+
+  std::unique_ptr<Aggregation> Merge(const Aggregation &delta) const noexcept override;
+
+  std::unique_ptr<Aggregation> Diff(const Aggregation &next) const noexcept override;
+
+  PointType ToPoint() const noexcept override;
+
+private:
+  opentelemetry::common::SpinLockMutex lock_;
+  SumPointData point_data_;
+};
+
+class DoubleSumAggregation : public Aggregation
+{
+public:
+  DoubleSumAggregation();
+  DoubleSumAggregation(SumPointData &&);
+  DoubleSumAggregation(const SumPointData &);
+
+  void Aggregate(long value, const PointAttributes &attributes = {}) noexcept override {}
+
+  void Aggregate(double value, const PointAttributes &attributes = {}) noexcept override;
+
+  std::unique_ptr<Aggregation> Merge(const Aggregation &delta) const noexcept override;
+
+  std::unique_ptr<Aggregation> Diff(const Aggregation &next) const noexcept override;
+
+  PointType ToPoint() const noexcept override;
+
+private:
+  mutable opentelemetry::common::SpinLockMutex lock_;
+  SumPointData point_data_;
+};
+
+}  // namespace metrics
+}  // namespace sdk
+OPENTELEMETRY_END_NAMESPACE
+#endif
\ No newline at end of file