Class: OpenTelemetry::Sampler::XRay::AWSXRayRemoteSampler

Inherits:
Object
  • Object
show all
Defined in:
lib/opentelemetry/sampler/xray/aws_xray_remote_sampler.rb

Overview

AWSXRayRemoteSampler is a Wrapper class to ensure that all XRay Sampler Functionality in InternalAWSXRayRemoteSampler uses ParentBased logic to respect the parent span's sampling decision

Instance Method Summary collapse

Constructor Details

#initialize(endpoint: '127.0.0.1:2000', polling_interval: DEFAULT_RULES_POLLING_INTERVAL_SECONDS, resource: OpenTelemetry::SDK::Resources::Resource.create) ⇒ AWSXRayRemoteSampler

Returns a new instance of AWSXRayRemoteSampler.



26
27
28
29
30
# File 'lib/opentelemetry/sampler/xray/aws_xray_remote_sampler.rb', line 26

def initialize(endpoint: '127.0.0.1:2000', polling_interval: DEFAULT_RULES_POLLING_INTERVAL_SECONDS, resource: OpenTelemetry::SDK::Resources::Resource.create)
  @root = OpenTelemetry::SDK::Trace::Samplers.parent_based(
    root: OpenTelemetry::Sampler::XRay::InternalAWSXRayRemoteSampler.new(endpoint: endpoint, polling_interval: polling_interval, resource: resource)
  )
end

Instance Method Details

#descriptionObject



38
39
40
# File 'lib/opentelemetry/sampler/xray/aws_xray_remote_sampler.rb', line 38

def description
  "AWSXRayRemoteSampler{root=#{@root.description}}"
end

#should_sample?(trace_id:, parent_context:, links:, name:, kind:, attributes:) ⇒ Boolean

Returns:

  • (Boolean)


32
33
34
35
36
# File 'lib/opentelemetry/sampler/xray/aws_xray_remote_sampler.rb', line 32

def should_sample?(trace_id:, parent_context:, links:, name:, kind:, attributes:)
  @root.should_sample?(
    trace_id: trace_id, parent_context: parent_context, links: links, name: name, kind: kind, attributes: attributes
  )
end