Class: OpenTelemetry::SDK::Trace::Samplers::Result
- Inherits:
-
Object
- Object
- OpenTelemetry::SDK::Trace::Samplers::Result
- Defined in:
- lib/opentelemetry/sdk/trace/samplers/result.rb
Overview
The Result class represents an arbitrary sampling result. It has boolean values for the sampling decision and whether to record events, and a collection of attributes to be attached to a sampled root span.
Instance Attribute Summary collapse
-
#attributes ⇒ Hash{String => String, Numeric, Boolean, Array<String, Numeric, Boolean>}
readonly
Returns a frozen hash of attributes to be attached span.
Instance Method Summary collapse
-
#initialize(decision:, attributes: nil) ⇒ Result
constructor
Returns a new sampling result with the specified decision and attributes.
-
#recording? ⇒ Boolean
Returns true if this span should record events, attributes, status, etc.
-
#sampled? ⇒ Boolean
Returns true if this span should be sampled.
Constructor Details
#initialize(decision:, attributes: nil) ⇒ Result
Returns a new sampling result with the specified decision and attributes.
33 34 35 36 |
# File 'lib/opentelemetry/sdk/trace/samplers/result.rb', line 33 def initialize(decision:, attributes: nil) @decision = decision @attributes = attributes.freeze || EMPTY_HASH end |
Instance Attribute Details
#attributes ⇒ Hash{String => String, Numeric, Boolean, Array<String, Numeric, Boolean>} (readonly)
Returns a frozen hash of attributes to be attached span.
23 24 25 |
# File 'lib/opentelemetry/sdk/trace/samplers/result.rb', line 23 def attributes @attributes end |
Instance Method Details
#recording? ⇒ Boolean
Returns true if this span should record events, attributes, status, etc.
48 49 50 |
# File 'lib/opentelemetry/sdk/trace/samplers/result.rb', line 48 def recording? @decision != Decision::DROP end |
#sampled? ⇒ Boolean
Returns true if this span should be sampled.
41 42 43 |
# File 'lib/opentelemetry/sdk/trace/samplers/result.rb', line 41 def sampled? @decision == Decision::RECORD_AND_SAMPLE end |