Sha256: 3450e3058b062567cabe7d679089d9d648313413b5ea8b83de726a994eee8202

Contents?: true

Size: 1.49 KB

Versions: 17

Compression:

Stored size: 1.49 KB

Contents

# frozen_string_literal: true

module Aws
  module Telemetry
    # No-op implementation for {TelemetryProviderBase}.
    class NoOpTelemetryProvider < TelemetryProviderBase
      def initialize
        super(
          tracer_provider: NoOpTracerProvider.new,
          context_manager: NoOpContextManager.new
        )
      end
    end

    # No-op implementation for {TracerProviderBase}.
    class NoOpTracerProvider < TracerProviderBase
      def tracer(name = nil)
        @tracer ||= NoOpTracer.new
      end
    end

    # No-op implementation for {TracerBase}.
    class NoOpTracer < TracerBase
      def start_span(name, with_parent: nil, attributes: nil, kind: nil)
        NoOpSpan.new
      end

      def in_span(name, attributes: nil, kind: nil)
        yield NoOpSpan.new
      end

      def current_span
        NoOpSpan.new
      end
    end

    # No-op implementation for {SpanBase}.
    class NoOpSpan < SpanBase
      def set_attribute(key, value)
        self
      end
      alias []= set_attribute

      def add_attributes(attributes)
        self
      end

      def add_event(name, attributes: nil)
        self
      end

      def status=(status); end

      def finish(end_timestamp: nil)
        self
      end

      def record_exception(exception, attributes: nil); end
    end

    # No-op implementation for {ContextManagerBase}.
    class NoOpContextManager < ContextManagerBase
      def current; end

      def attach(context); end

      def detach(token); end
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
aws-sdk-core-3.216.0 lib/aws-sdk-core/telemetry/no_op.rb
aws-sdk-core-3.215.1 lib/aws-sdk-core/telemetry/no_op.rb
aws-sdk-core-3.215.0 lib/aws-sdk-core/telemetry/no_op.rb
aws-sdk-core-3.214.1 lib/aws-sdk-core/telemetry/no_op.rb
aws-sdk-core-3.214.0 lib/aws-sdk-core/telemetry/no_op.rb
aws-sdk-core-3.213.0 lib/aws-sdk-core/telemetry/no_op.rb
aws-sdk-core-3.212.0 lib/aws-sdk-core/telemetry/no_op.rb
aws-sdk-core-3.211.0 lib/aws-sdk-core/telemetry/no_op.rb
aws-sdk-core-3.210.0 lib/aws-sdk-core/telemetry/no_op.rb
aws-sdk-core-3.209.1 lib/aws-sdk-core/telemetry/no_op.rb
aws-sdk-core-3.209.0 lib/aws-sdk-core/telemetry/no_op.rb
aws-sdk-core-3.208.0 lib/aws-sdk-core/telemetry/no_op.rb
aws-sdk-core-3.207.0 lib/aws-sdk-core/telemetry/no_op.rb
aws-sdk-core-3.206.0 lib/aws-sdk-core/telemetry/no_op.rb
aws-sdk-core-3.205.0 lib/aws-sdk-core/telemetry/no_op.rb
aws-sdk-core-3.204.0 lib/aws-sdk-core/telemetry/no_op.rb
aws-sdk-core-3.203.0 lib/aws-sdk-core/telemetry/no_op.rb