/** * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0. */ #pragma once #include #include namespace smithy { namespace components { namespace tracing { /** * A no-op implementation of TraceSpan that is pass through. */ class NoopTracerSpan : public TraceSpan { public: NoopTracerSpan(const Aws::String &name) : TraceSpan(name) {} void emitEvent(Aws::String name, const Aws::Map &attributes) override { AWS_UNREFERENCED_PARAM(name); AWS_UNREFERENCED_PARAM(attributes); } void setAttribute(Aws::String key, Aws::String value) override { AWS_UNREFERENCED_PARAM(key); AWS_UNREFERENCED_PARAM(value); } void setStatus(TraceSpanStatus status) override { AWS_UNREFERENCED_PARAM(status); } void end() override {} }; /** * A no-op implementation of Tracer that is pass through. */ class NoopTracer : public Tracer { public: std::shared_ptr CreateSpan(Aws::String name, const Aws::Map &attributes, SpanKind spanKind) override { AWS_UNREFERENCED_PARAM(attributes); AWS_UNREFERENCED_PARAM(spanKind); return Aws::MakeShared("NO_OP", name); } }; /** * A no-op implementation of NoopTracerProvider that is pass through. */ class NoopTracerProvider : public TracerProvider { public: explicit NoopTracerProvider(std::shared_ptr tracer) : m_tracer(std::move(tracer)) {} std::shared_ptr GetTracer(Aws::String scope, const Aws::Map &attributes) override { AWS_UNREFERENCED_PARAM(scope); AWS_UNREFERENCED_PARAM(attributes); return m_tracer; } private: std::shared_ptr m_tracer; }; } } }