Class: OpenTelemetry::SDK::Trace::Config::TraceConfig

Inherits:
Object
  • Object
show all
Defined in:
lib/opentelemetry/sdk/trace/config/trace_config.rb

Overview

Class that holds global trace parameters.

Constant Summary collapse

DEFAULT =
new

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(sampler: DEFAULT_SAMPLER, max_attributes_count: DEFAULT_MAX_ATTRIBUTES_COUNT, max_events_count: DEFAULT_MAX_EVENTS_COUNT, max_links_count: DEFAULT_MAX_LINKS_COUNT, max_attributes_per_event: DEFAULT_MAX_ATTRIBUTES_PER_EVENT, max_attributes_per_link: DEFAULT_MAX_ATTRIBUTES_PER_LINK) ⇒ TraceConfig

Returns a OpenTelemetry::SDK::Trace::Config::TraceConfig with the desired values.

Raises:

  • (ArgumentError)

    if any of the max numbers are not positive.



49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# File 'lib/opentelemetry/sdk/trace/config/trace_config.rb', line 49

def initialize(sampler: DEFAULT_SAMPLER,
               max_attributes_count: DEFAULT_MAX_ATTRIBUTES_COUNT,
               max_events_count: DEFAULT_MAX_EVENTS_COUNT,
               max_links_count: DEFAULT_MAX_LINKS_COUNT,
               max_attributes_per_event: DEFAULT_MAX_ATTRIBUTES_PER_EVENT,
               max_attributes_per_link: DEFAULT_MAX_ATTRIBUTES_PER_LINK)
  raise ArgumentError, 'max_attributes_count must be positive' unless max_attributes_count.positive?
  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_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_countObject (readonly)

The global default max number of attributes per Span.



31
32
33
# File 'lib/opentelemetry/sdk/trace/config/trace_config.rb', line 31

def max_attributes_count
  @max_attributes_count
end

#max_attributes_per_eventObject (readonly)

The global default max number of attributes per Event.



40
41
42
# File 'lib/opentelemetry/sdk/trace/config/trace_config.rb', line 40

def max_attributes_per_event
  @max_attributes_per_event
end

The global default max number of attributes per Trace::Link.



43
44
45
# File 'lib/opentelemetry/sdk/trace/config/trace_config.rb', line 43

def max_attributes_per_link
  @max_attributes_per_link
end

#max_events_countObject (readonly)

The global default max number of Events per Span.



34
35
36
# File 'lib/opentelemetry/sdk/trace/config/trace_config.rb', line 34

def max_events_count
  @max_events_count
end

The global default max number of Trace::Link entries per Span.



37
38
39
# File 'lib/opentelemetry/sdk/trace/config/trace_config.rb', line 37

def max_links_count
  @max_links_count
end

#samplerObject (readonly)

The global default sampler (see Samplers).



28
29
30
# File 'lib/opentelemetry/sdk/trace/config/trace_config.rb', line 28

def sampler
  @sampler
end