Sha256: 5e2987b0a0df3b08adb4f171d9a763f36829fcb0474a2da2de27d341f1c0c9ea

Contents?: true

Size: 763 Bytes

Versions: 6

Compression:

Stored size: 763 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 constant result.
        class ConstantSampler
          attr_reader :description

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

          # @api private
          #
          # See {Samplers}.
          def should_sample?(trace_id:, parent_context:, links:, name:, kind:, attributes:)
            # All arguments ignored for sampling decision.
            @result
          end
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
opentelemetry-sdk-0.9.0 lib/opentelemetry/sdk/trace/samplers/constant_sampler.rb
opentelemetry-sdk-0.8.0 lib/opentelemetry/sdk/trace/samplers/constant_sampler.rb
opentelemetry-sdk-0.7.0 lib/opentelemetry/sdk/trace/samplers/constant_sampler.rb
opentelemetry-sdk-0.6.0 lib/opentelemetry/sdk/trace/samplers/constant_sampler.rb
opentelemetry-sdk-0.5.1 lib/opentelemetry/sdk/trace/samplers/constant_sampler.rb
opentelemetry-sdk-0.5.0 lib/opentelemetry/sdk/trace/samplers/constant_sampler.rb