AWS SDK for C++

AWS SDK for C++ Version 1.11.440

Loading...
Searching...
No Matches
MeterAdapters.h
1
5#pragma once
6
7#include <smithy/Smithy_EXPORTS.h>
8#include <smithy/tracing/Meter.h>
9#include <opentelemetry/nostd/shared_ptr.h>
10#include <opentelemetry/metrics/meter.h>
11#include <opentelemetry/metrics/observer_result.h>
12#include <opentelemetry/metrics/async_instruments.h>
13#include <utility>
14
15namespace smithy {
16 namespace components {
17 namespace tracing {
21 class OtelMeterAdapter final : public Meter {
22 public:
23 explicit OtelMeterAdapter(opentelemetry::nostd::shared_ptr<opentelemetry::metrics::Meter> meter) :
24 otelMeter(std::move(meter)) {}
25
27 std::function<void(Aws::UniquePtr<AsyncMeasurement>)> callback,
28 Aws::String units,
29 Aws::String description) const override;
30
32 Aws::String units,
33 Aws::String description) const override;
34
36 Aws::String units,
37 Aws::String description) const override;
38
40 Aws::String units,
41 Aws::String description) const override;
42
43 private:
44 opentelemetry::nostd::shared_ptr<opentelemetry::metrics::Meter> otelMeter;
45 };
46
50 class OtelCounterAdapter final : public MonotonicCounter {
51 public:
53 opentelemetry::nostd::unique_ptr<opentelemetry::metrics::Counter<uint64_t>> counter);
54
55 void add(long value, Aws::Map<Aws::String, Aws::String> attributes) override;
56
57 private:
58 opentelemetry::nostd::unique_ptr<opentelemetry::metrics::Counter<uint64_t>> otelCounter;
59 };
60
65 public:
67 opentelemetry::nostd::unique_ptr<opentelemetry::metrics::UpDownCounter<int64_t>> counter);
68
69 void add(long value, Aws::Map<Aws::String, Aws::String> attributes) override;
70
71 private:
72 opentelemetry::nostd::unique_ptr<opentelemetry::metrics::UpDownCounter<int64_t>> otelUpDownCounter;
73 };
74
78 class OtelHistogramAdapter final : public Histogram {
79 public:
81 opentelemetry::nostd::unique_ptr<opentelemetry::metrics::Histogram<double>> otelHistogram);
82
83 void record(double value,
84 Aws::Map<Aws::String, Aws::String> attributes) override;
85
86 private:
87 opentelemetry::nostd::unique_ptr<opentelemetry::metrics::Histogram<double>> otelHistogram;
88 };
89
95 };
96
100 class OtelGaugeAdapter final : public GaugeHandle {
101 public:
103 opentelemetry::nostd::shared_ptr<opentelemetry::metrics::ObservableInstrument> otelGauge,
104 opentelemetry::metrics::ObservableCallbackPtr callback);
105
106 void Stop() override;
107
108 private:
109 opentelemetry::nostd::shared_ptr<opentelemetry::metrics::ObservableInstrument> otelGauge;
110 opentelemetry::metrics::ObservableCallbackPtr otelCallback;
111 };
112
117 public:
118 explicit OtelObserverAdapter(const opentelemetry::metrics::ObserverResult &otelResult);
119
120 void Record(double value, const Aws::Map<Aws::String, Aws::String> &attributes) override;
121
122 private:
123 const opentelemetry::metrics::ObserverResult &otelResult;
124 };
125 }
126 }
127}
OtelCounterAdapter(opentelemetry::nostd::unique_ptr< opentelemetry::metrics::Counter< uint64_t > > counter)
void add(long value, Aws::Map< Aws::String, Aws::String > attributes) override
OtelGaugeAdapter(opentelemetry::nostd::shared_ptr< opentelemetry::metrics::ObservableInstrument > otelGauge, opentelemetry::metrics::ObservableCallbackPtr callback)
void record(double value, Aws::Map< Aws::String, Aws::String > attributes) override
OtelHistogramAdapter(opentelemetry::nostd::unique_ptr< opentelemetry::metrics::Histogram< double > > otelHistogram)
Aws::UniquePtr< Histogram > CreateHistogram(Aws::String name, Aws::String units, Aws::String description) const override
Aws::UniquePtr< GaugeHandle > CreateGauge(Aws::String name, std::function< void(Aws::UniquePtr< AsyncMeasurement >)> callback, Aws::String units, Aws::String description) const override
OtelMeterAdapter(opentelemetry::nostd::shared_ptr< opentelemetry::metrics::Meter > meter)
Aws::UniquePtr< MonotonicCounter > CreateCounter(Aws::String name, Aws::String units, Aws::String description) const override
Aws::UniquePtr< UpDownCounter > CreateUpDownCounter(Aws::String name, Aws::String units, Aws::String description) const override
OtelObserverAdapter(const opentelemetry::metrics::ObserverResult &otelResult)
void Record(double value, const Aws::Map< Aws::String, Aws::String > &attributes) override
void add(long value, Aws::Map< Aws::String, Aws::String > attributes) override
OtelUpDownCounterAdapter(opentelemetry::nostd::unique_ptr< opentelemetry::metrics::UpDownCounter< int64_t > > counter)
std::map< K, V, std::less< K >, Aws::Allocator< std::pair< const K, V > > > Map
Definition AWSMap.h:20
std::basic_string< char, std::char_traits< char >, Aws::Allocator< char > > String
Definition AWSString.h:97
std::unique_ptr< T, D > UniquePtr
Definition AWSMemory.h:255
std::function< void(Aws::UniquePtr< AsyncMeasurement >)> callback