AWS SDK for C++

AWS SDK for C++ Version 1.11.440

Loading...
Searching...
No Matches
NoopTracerProvider.h
1
5#pragma once
6
7#include <smithy/Smithy_EXPORTS.h>
8#include <smithy/tracing/TracerProvider.h>
9
10
11namespace smithy {
12 namespace components {
13 namespace tracing {
17 class NoopTracerSpan : public TraceSpan {
18 public:
19 NoopTracerSpan(const Aws::String &name) : TraceSpan(name) {}
20
21 void emitEvent(Aws::String name, const Aws::Map<Aws::String, Aws::String> &attributes) override {
22 AWS_UNREFERENCED_PARAM(name);
23 AWS_UNREFERENCED_PARAM(attributes);
24 }
25
26 void setAttribute(Aws::String key, Aws::String value) override {
27 AWS_UNREFERENCED_PARAM(key);
28 AWS_UNREFERENCED_PARAM(value);
29 }
30
31 void setStatus(TraceSpanStatus status) override {
32 AWS_UNREFERENCED_PARAM(status);
33 }
34
35 void end() override {}
36 };
37
41 class NoopTracer : public Tracer {
42 public:
43 std::shared_ptr<TraceSpan> CreateSpan(Aws::String name,
44 const Aws::Map<Aws::String, Aws::String> &attributes,
45 SpanKind spanKind) override {
46 AWS_UNREFERENCED_PARAM(attributes);
47 AWS_UNREFERENCED_PARAM(spanKind);
48 return Aws::MakeShared<NoopTracerSpan>("NO_OP", name);
49 }
50 };
51
56 public:
57 explicit NoopTracerProvider(std::shared_ptr<NoopTracer> tracer) : m_tracer(std::move(tracer)) {}
58
59 std::shared_ptr<Tracer> GetTracer(Aws::String scope,
60 const Aws::Map<Aws::String, Aws::String> &attributes) override {
61 AWS_UNREFERENCED_PARAM(scope);
62 AWS_UNREFERENCED_PARAM(attributes);
63 return m_tracer;
64 }
65
66 private:
67 std::shared_ptr<NoopTracer> m_tracer;
68 };
69 }
70 }
71}
std::shared_ptr< TraceSpan > CreateSpan(Aws::String name, const Aws::Map< Aws::String, Aws::String > &attributes, SpanKind spanKind) override
NoopTracerProvider(std::shared_ptr< NoopTracer > tracer)
std::shared_ptr< Tracer > GetTracer(Aws::String scope, const Aws::Map< Aws::String, Aws::String > &attributes) override
void setAttribute(Aws::String key, Aws::String value) override
void setStatus(TraceSpanStatus status) override
void emitEvent(Aws::String name, const Aws::Map< Aws::String, Aws::String > &attributes) override
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