Class: OpenTelemetry::SDK::Logs::LogRecordLimits

Inherits:
Object
  • Object
show all
Defined in:
lib/opentelemetry/sdk/logs/log_record_limits.rb

Overview

Class that holds log record attribute limit 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_LOG_RECORD_ATTRIBUTE_COUNT_LIMIT', 'OTEL_ATTRIBUTE_COUNT_LIMIT', default: 128 )), attribute_length_limit: OpenTelemetry::Common::Utilities.config_opt( 'OTEL_LOG_RECORD_ATTRIBUTE_VALUE_LENGTH_LIMIT', 'OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT' )) ⇒ LogRecordLimits

Returns a OpenTelemetry::SDK::Logs::LogRecordLimits with the desired values.

Raises:

  • (ArgumentError)

    if any of the max numbers are not positive.



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/opentelemetry/sdk/logs/log_record_limits.rb', line 22

def initialize(attribute_count_limit: Integer(OpenTelemetry::Common::Utilities.config_opt(
                                                'OTEL_LOG_RECORD_ATTRIBUTE_COUNT_LIMIT',
                                                'OTEL_ATTRIBUTE_COUNT_LIMIT',
                                                default: 128
                                              )),
               attribute_length_limit: OpenTelemetry::Common::Utilities.config_opt(
                 'OTEL_LOG_RECORD_ATTRIBUTE_VALUE_LENGTH_LIMIT',
                 'OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT'
               ))
  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

  @attribute_count_limit = attribute_count_limit
  @attribute_length_limit = attribute_length_limit.nil? ? nil : Integer(attribute_length_limit)
end

Instance Attribute Details

#attribute_count_limitObject (readonly)

The global default max number of attributes per OpenTelemetry::SDK::Logs::LogRecord.



13
14
15
# File 'lib/opentelemetry/sdk/logs/log_record_limits.rb', line 13

def attribute_count_limit
  @attribute_count_limit
end

#attribute_length_limitObject (readonly)

The global default max length of attribute value per OpenTelemetry::SDK::Logs::LogRecord.



16
17
18
# File 'lib/opentelemetry/sdk/logs/log_record_limits.rb', line 16

def attribute_length_limit
  @attribute_length_limit
end