Sha256: 6d58cd19ed99526fc97d8f2e07204cbeba6a665fed9305019c158d14e121686f

Contents?: true

Size: 832 Bytes

Versions: 3

Compression:

Stored size: 832 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

          # @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
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
opentelemetry-sdk-0.11.1 lib/opentelemetry/sdk/trace/samplers/constant_sampler.rb
opentelemetry-sdk-0.11.0 lib/opentelemetry/sdk/trace/samplers/constant_sampler.rb
opentelemetry-sdk-0.10.0 lib/opentelemetry/sdk/trace/samplers/constant_sampler.rb