Class: OpenTelemetry::SDK::Trace::Config::TraceConfig
- Inherits:
-
Object
- Object
- OpenTelemetry::SDK::Trace::Config::TraceConfig
- Defined in:
- lib/opentelemetry/sdk/trace/config/trace_config.rb
Overview
Class that holds global trace parameters.
Instance Attribute Summary collapse
-
#max_attributes_count ⇒ Object
readonly
The global default max number of attributes per Span.
-
#max_attributes_length ⇒ Object
readonly
The global default max length of attribute value per Span.
-
#max_attributes_per_event ⇒ Object
readonly
The global default max number of attributes per Event.
-
#max_attributes_per_link ⇒ Object
readonly
The global default max number of attributes per Trace::Link.
- #max_events_count ⇒ Object readonly
-
#max_links_count ⇒ Object
readonly
The global default max number of Trace::Link entries per Span.
-
#sampler ⇒ Object
readonly
The global default sampler (see Samplers).
Instance Method Summary collapse
-
#initialize(sampler: sampler_from_environment(Samplers.parent_based(root: Samplers::ALWAYS_ON)), max_attributes_count: Integer(ENV.fetch('OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT', 128)), max_attributes_length: ENV['OTEL_RUBY_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT'], max_events_count: Integer(ENV.fetch('OTEL_SPAN_EVENT_COUNT_LIMIT', 128)), max_links_count: Integer(ENV.fetch('OTEL_SPAN_LINK_COUNT_LIMIT', 128)), max_attributes_per_event: max_attributes_count, max_attributes_per_link: max_attributes_count) ⇒ TraceConfig
constructor
Returns a TraceConfig with the desired values.
Constructor Details
#initialize(sampler: sampler_from_environment(Samplers.parent_based(root: Samplers::ALWAYS_ON)), max_attributes_count: Integer(ENV.fetch('OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT', 128)), max_attributes_length: ENV['OTEL_RUBY_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT'], max_events_count: Integer(ENV.fetch('OTEL_SPAN_EVENT_COUNT_LIMIT', 128)), max_links_count: Integer(ENV.fetch('OTEL_SPAN_LINK_COUNT_LIMIT', 128)), max_attributes_per_event: max_attributes_count, max_attributes_per_link: max_attributes_count) ⇒ TraceConfig
Returns a OpenTelemetry::SDK::Trace::Config::TraceConfig with the desired values.
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/opentelemetry/sdk/trace/config/trace_config.rb', line 38 def initialize(sampler: sampler_from_environment(Samplers.parent_based(root: Samplers::ALWAYS_ON)), # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity max_attributes_count: Integer(ENV.fetch('OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT', 128)), max_attributes_length: ENV['OTEL_RUBY_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT'], max_events_count: Integer(ENV.fetch('OTEL_SPAN_EVENT_COUNT_LIMIT', 128)), max_links_count: Integer(ENV.fetch('OTEL_SPAN_LINK_COUNT_LIMIT', 128)), max_attributes_per_event: max_attributes_count, max_attributes_per_link: max_attributes_count) raise ArgumentError, 'max_attributes_count must be positive' unless max_attributes_count.positive? raise ArgumentError, 'max_attributes_length must not be less than 32' unless max_attributes_length.nil? || Integer(max_attributes_length) >= 32 raise ArgumentError, 'max_events_count must be positive' unless max_events_count.positive? raise ArgumentError, 'max_links_count must be positive' unless max_links_count.positive? raise ArgumentError, 'max_attributes_per_event must be positive' unless max_attributes_per_event.positive? raise ArgumentError, 'max_attributes_per_link must be positive' unless max_attributes_per_link.positive? @sampler = sampler @max_attributes_count = max_attributes_count @max_attributes_length = max_attributes_length.nil? ? nil : Integer(max_attributes_length) @max_events_count = max_events_count @max_links_count = max_links_count @max_attributes_per_event = max_attributes_per_event @max_attributes_per_link = max_attributes_per_link end |
Instance Attribute Details
#max_attributes_count ⇒ Object (readonly)
The global default max number of attributes per Span.
17 18 19 |
# File 'lib/opentelemetry/sdk/trace/config/trace_config.rb', line 17 def max_attributes_count @max_attributes_count end |
#max_attributes_length ⇒ Object (readonly)
The global default max length of attribute value per Span.
20 21 22 |
# File 'lib/opentelemetry/sdk/trace/config/trace_config.rb', line 20 def max_attributes_length @max_attributes_length end |
#max_attributes_per_event ⇒ Object (readonly)
The global default max number of attributes per Event.
29 30 31 |
# File 'lib/opentelemetry/sdk/trace/config/trace_config.rb', line 29 def max_attributes_per_event @max_attributes_per_event end |
#max_attributes_per_link ⇒ Object (readonly)
The global default max number of attributes per Trace::Link.
32 33 34 |
# File 'lib/opentelemetry/sdk/trace/config/trace_config.rb', line 32 def max_attributes_per_link @max_attributes_per_link end |
#max_events_count ⇒ Object (readonly)
23 24 25 |
# File 'lib/opentelemetry/sdk/trace/config/trace_config.rb', line 23 def max_events_count @max_events_count end |
#max_links_count ⇒ Object (readonly)
The global default max number of Trace::Link entries per Span.
26 27 28 |
# File 'lib/opentelemetry/sdk/trace/config/trace_config.rb', line 26 def max_links_count @max_links_count end |
#sampler ⇒ Object (readonly)
The global default sampler (see Samplers).
14 15 16 |
# File 'lib/opentelemetry/sdk/trace/config/trace_config.rb', line 14 def sampler @sampler end |