lib/opentelemetry/sdk/trace/config/trace_config.rb in opentelemetry-sdk-0.14.0 vs lib/opentelemetry/sdk/trace/config/trace_config.rb in opentelemetry-sdk-0.15.0
- old
+ new
@@ -31,13 +31,13 @@
# Returns a {TraceConfig} with the desired values.
#
# @return [TraceConfig] with the desired values.
# @raise [ArgumentError] if any of the max numbers are not positive.
def initialize(sampler: sampler_from_environment(Samplers.parent_based(root: Samplers::ALWAYS_ON)),
- max_attributes_count: Integer(ENV.fetch('OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT', 1000)),
- max_events_count: Integer(ENV.fetch('OTEL_SPAN_EVENT_COUNT_LIMIT', 1000)),
- max_links_count: Integer(ENV.fetch('OTEL_SPAN_LINK_COUNT_LIMIT', 1000)),
+ max_attributes_count: Integer(ENV.fetch('OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT', 128)),
+ 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_events_count must be positive' unless max_events_count.positive?
raise ArgumentError, 'max_links_count must be positive' unless max_links_count.positive?
@@ -54,16 +54,16 @@
# TODO: from_proto
private
def sampler_from_environment(default_sampler) # rubocop:disable Metrics/CyclomaticComplexity
- case ENV['OTEL_TRACE_SAMPLER']
+ case ENV['OTEL_TRACES_SAMPLER']
when 'always_on' then Samplers::ALWAYS_ON
when 'always_off' then Samplers::ALWAYS_OFF
- when 'traceidratio' then Samplers.trace_id_ratio_based(Float(ENV.fetch('OTEL_TRACE_SAMPLER_ARG', 1.0)))
+ when 'traceidratio' then Samplers.trace_id_ratio_based(Float(ENV.fetch('OTEL_TRACES_SAMPLER_ARG', 1.0)))
when 'parentbased_always_on' then Samplers.parent_based(root: Samplers::ALWAYS_ON)
when 'parentbased_always_off' then Samplers.parent_based(root: Samplers::ALWAYS_OFF)
- when 'parentbased_traceidratio' then Samplers.parent_based(root: Samplers.trace_id_ratio_based(Float(ENV.fetch('OTEL_TRACE_SAMPLER_ARG', 1.0))))
+ when 'parentbased_traceidratio' then Samplers.parent_based(root: Samplers.trace_id_ratio_based(Float(ENV.fetch('OTEL_TRACES_SAMPLER_ARG', 1.0))))
else default_sampler
end
rescue StandardError => e
OpenTelemetry.handle_error(exception: e, message: "installing default sampler #{default_sampler.description}")
default_sampler