Class: Instana::Trace::SpanLimits

Inherits:
Object
  • Object
show all
Defined in:
lib/instana/trace/span_limits.rb

Overview

Class that holds global trace parameters.

Constant Summary collapse

DEFAULT =
new

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attribute_count_limit: Integer(OpenTelemetry::Common::Utilities.config_opt('OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT', 'OTEL_ATTRIBUTE_COUNT_LIMIT', default: 128)), attribute_length_limit: OpenTelemetry::Common::Utilities.config_opt('OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT', 'OTEL_RUBY_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT', 'OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT'), event_count_limit: Integer(OpenTelemetry::Common::Utilities.config_opt('OTEL_SPAN_EVENT_COUNT_LIMIT', default: 128)), link_count_limit: Integer(OpenTelemetry::Common::Utilities.config_opt('OTEL_SPAN_LINK_COUNT_LIMIT', default: 128)), event_attribute_count_limit: Integer(OpenTelemetry::Common::Utilities.config_opt('OTEL_EVENT_ATTRIBUTE_COUNT_LIMIT', default: 128)), event_attribute_length_limit: OpenTelemetry::Common::Utilities.config_opt('OTEL_EVENT_ATTRIBUTE_VALUE_LENGTH_LIMIT', 'OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT'), link_attribute_count_limit: Integer(OpenTelemetry::Common::Utilities.config_opt('OTEL_LINK_ATTRIBUTE_COUNT_LIMIT', default: 128))) ⇒ SpanLimits

Returns a Instana::Trace::SpanLimits with the desired values.

Raises:

  • (ArgumentError)

    if any of the max numbers are not positive.



34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/instana/trace/span_limits.rb', line 34

def initialize(attribute_count_limit: Integer(OpenTelemetry::Common::Utilities.config_opt('OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT', 'OTEL_ATTRIBUTE_COUNT_LIMIT', default: 128)), # rubocop:disable Metrics/ParameterLists
               attribute_length_limit: OpenTelemetry::Common::Utilities.config_opt('OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT', 'OTEL_RUBY_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT',
                                                                                   'OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT'),
               event_count_limit: Integer(OpenTelemetry::Common::Utilities.config_opt('OTEL_SPAN_EVENT_COUNT_LIMIT', default: 128)),
               link_count_limit: Integer(OpenTelemetry::Common::Utilities.config_opt('OTEL_SPAN_LINK_COUNT_LIMIT', default: 128)),
               event_attribute_count_limit: Integer(OpenTelemetry::Common::Utilities.config_opt('OTEL_EVENT_ATTRIBUTE_COUNT_LIMIT', default: 128)),
               event_attribute_length_limit: OpenTelemetry::Common::Utilities.config_opt('OTEL_EVENT_ATTRIBUTE_VALUE_LENGTH_LIMIT', 'OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT'),
               link_attribute_count_limit: Integer(OpenTelemetry::Common::Utilities.config_opt('OTEL_LINK_ATTRIBUTE_COUNT_LIMIT', default: 128)))
  raise ArgumentError, 'attribute_count_limit must be positive' unless attribute_count_limit.positive?
  raise ArgumentError, 'attribute_length_limit must not be less than 32' unless attribute_length_limit.nil? || Integer(attribute_length_limit) >= 32
  raise ArgumentError, 'event_count_limit must be positive' unless event_count_limit.positive?
  raise ArgumentError, 'link_count_limit must be positive' unless link_count_limit.positive?
  raise ArgumentError, 'event_attribute_count_limit must be positive' unless event_attribute_count_limit.positive?
  raise ArgumentError, 'event_attribute_length_limit must not be less than 32' unless event_attribute_length_limit.nil? || Integer(event_attribute_length_limit) >= 32
  raise ArgumentError, 'link_attribute_count_limit must be positive' unless link_attribute_count_limit.positive?

  @attribute_count_limit = attribute_count_limit
  @attribute_length_limit = attribute_length_limit.nil? ? nil : Integer(attribute_length_limit)
  @event_count_limit = event_count_limit
  @link_count_limit = link_count_limit
  @event_attribute_count_limit = event_attribute_count_limit
  @event_attribute_length_limit = event_attribute_length_limit.nil? ? nil : Integer(event_attribute_length_limit)
  @link_attribute_count_limit = link_attribute_count_limit
end

Instance Attribute Details

#attribute_count_limitObject (readonly)

The global default max number of attributes per Span.



10
11
12
# File 'lib/instana/trace/span_limits.rb', line 10

def attribute_count_limit
  @attribute_count_limit
end

#attribute_length_limitObject (readonly)

The global default max length of attribute value per Span.



13
14
15
# File 'lib/instana/trace/span_limits.rb', line 13

def attribute_length_limit
  @attribute_length_limit
end

#event_attribute_count_limitObject (readonly)

The global default max number of attributes per OpenTelemetry::SDK::Trace::Event.



22
23
24
# File 'lib/instana/trace/span_limits.rb', line 22

def event_attribute_count_limit
  @event_attribute_count_limit
end

#event_attribute_length_limitObject (readonly)

The global default max length of attribute value per OpenTelemetry::SDK::Trace::Event.



25
26
27
# File 'lib/instana/trace/span_limits.rb', line 25

def event_attribute_length_limit
  @event_attribute_length_limit
end

#event_count_limitObject (readonly)

The global default max number of OpenTelemetry::SDK::Trace::Events per Span.



16
17
18
# File 'lib/instana/trace/span_limits.rb', line 16

def event_count_limit
  @event_count_limit
end

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



28
29
30
# File 'lib/instana/trace/span_limits.rb', line 28

def link_attribute_count_limit
  @link_attribute_count_limit
end

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



19
20
21
# File 'lib/instana/trace/span_limits.rb', line 19

def link_count_limit
  @link_count_limit
end