Sha256: 64566ec3513275db57b7a6cc487883237d6bd9837162ebee1837de82fa206ef3

Contents?: true

Size: 1002 Bytes

Versions: 25

Compression:

Stored size: 1002 Bytes

Contents

# frozen_string_literal: true

# Copyright The OpenTelemetry Authors
#
# SPDX-License-Identifier: Apache-2.0

module OpenTelemetry
  module SDK
    module Trace
      module Samplers
        # @api private
        #
        # Implements a sampler returning a result with a constant decision.
        class ConstantSampler
          attr_reader :description

          def initialize(decision:, description:)
            @decision = decision
            @description = description
          end

          def ==(other)
            @decision == other.decision && @description == other.description
          end

          # @api private
          #
          # See {Samplers}.
          def should_sample?(trace_id:, parent_context:, links:, name:, kind:, attributes:)
            Result.new(decision: @decision, tracestate: OpenTelemetry::Trace.current_span(parent_context).context.tracestate)
          end

          protected

          attr_reader :decision
        end
      end
    end
  end
end

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
opentelemetry-sdk-1.6.0 lib/opentelemetry/sdk/trace/samplers/constant_sampler.rb
opentelemetry-sdk-1.5.0 lib/opentelemetry/sdk/trace/samplers/constant_sampler.rb
opentelemetry-sdk-1.4.1 lib/opentelemetry/sdk/trace/samplers/constant_sampler.rb
opentelemetry-sdk-1.4.0 lib/opentelemetry/sdk/trace/samplers/constant_sampler.rb
opentelemetry-sdk-1.3.2 lib/opentelemetry/sdk/trace/samplers/constant_sampler.rb
opentelemetry-sdk-1.3.1 lib/opentelemetry/sdk/trace/samplers/constant_sampler.rb
opentelemetry-sdk-1.3.0 lib/opentelemetry/sdk/trace/samplers/constant_sampler.rb
opentelemetry-sdk-1.2.1 lib/opentelemetry/sdk/trace/samplers/constant_sampler.rb
opentelemetry-sdk-1.2.0 lib/opentelemetry/sdk/trace/samplers/constant_sampler.rb
opentelemetry-sdk-1.1.0 lib/opentelemetry/sdk/trace/samplers/constant_sampler.rb
opentelemetry-sdk-1.0.3 lib/opentelemetry/sdk/trace/samplers/constant_sampler.rb
opentelemetry-sdk-1.0.2 lib/opentelemetry/sdk/trace/samplers/constant_sampler.rb
opentelemetry-sdk-1.0.1 lib/opentelemetry/sdk/trace/samplers/constant_sampler.rb
opentelemetry-sdk-1.0.0 lib/opentelemetry/sdk/trace/samplers/constant_sampler.rb
opentelemetry-sdk-1.0.0.rc3 lib/opentelemetry/sdk/trace/samplers/constant_sampler.rb
opentelemetry-sdk-1.0.0.rc2 lib/opentelemetry/sdk/trace/samplers/constant_sampler.rb
opentelemetry-sdk-1.0.0.rc1 lib/opentelemetry/sdk/trace/samplers/constant_sampler.rb
opentelemetry-sdk-0.17.0 lib/opentelemetry/sdk/trace/samplers/constant_sampler.rb
opentelemetry-sdk-0.16.0 lib/opentelemetry/sdk/trace/samplers/constant_sampler.rb
opentelemetry-sdk-0.15.0 lib/opentelemetry/sdk/trace/samplers/constant_sampler.rb