Class: Flare::AlwaysRecordOnly

Inherits:
Object
  • Object
show all
Defined in:
lib/flare/sampler.rb

Overview

Tiny sampler whose should_sample? returns RECORD_ONLY for every span. Slot this into the ParentBased local_parent_not_sampled position so children of an unsampled local parent stay recording (the default ALWAYS_OFF turns them into NoOp spans no processor ever sees).

Constant Summary collapse

Decision =
OpenTelemetry::SDK::Trace::Samplers::Decision
Result =
OpenTelemetry::SDK::Trace::Samplers::Result

Instance Method Summary collapse

Instance Method Details

#descriptionObject



124
125
126
# File 'lib/flare/sampler.rb', line 124

def description
  "Flare::AlwaysRecordOnly"
end

#should_sample?(parent_context: nil) ⇒ Boolean

Returns:

  • (Boolean)


118
119
120
121
122
# File 'lib/flare/sampler.rb', line 118

def should_sample?(parent_context: nil, **)
  tracestate = OpenTelemetry::Trace.current_span(parent_context).context.tracestate ||
    OpenTelemetry::Trace::Tracestate::DEFAULT
  Result.new(decision: Decision::RECORD_ONLY, tracestate: tracestate)
end