-
Notifications
You must be signed in to change notification settings - Fork 277
Open
Labels
bugSomething isn't workingSomething isn't working
Description
When recording values for a histogram to which an ExponentialBucketAggregation has been added as a aggregation, a normal sequence of measurements can lead to the histogram scale getting very low, often going below the minimum of -10. This seems to mostly occur when recording for more than one set of attributes.
Share details about your runtime
Operating system details: macOS Sequoia 15.7.2
RUBY_ENGINE: "ruby"
RUBY_VERSION: "3.2.7"
RUBY_DESCRIPTION: "ruby 3.2.7 (2025-02-04 revision 02ec315244) [arm64-darwin24]"
Share a simplified reproduction if possible
require 'bundler/inline'
gemfile(true) do
source 'https://rubygems.org'
gem 'opentelemetry-api'
gem 'opentelemetry-sdk'
gem 'opentelemetry-metrics-sdk'
end
require 'opentelemetry-metrics-sdk'
OpenTelemetry::SDK.configure do |c|
c.add_metric_reader(
OpenTelemetry::SDK::Metrics::Export::PeriodicMetricReader.new(
exporter: OpenTelemetry::SDK::Metrics::Export::ConsoleMetricPullExporter.new
)
)
end
OpenTelemetry.meter_provider.add_view(
'example_hist',
aggregation: OpenTelemetry::SDK::Metrics::Aggregation::ExponentialBucketHistogram.new
)
meter = OpenTelemetry.meter_provider.meter('exp-hist-bug')
hist = meter.create_histogram('example_hist')
attr1 = {foo: 1}
attr2 = {foo: 2}
hist.record(0.010359524076171637, attributes: attr1)
hist.record(0.006354922335082751, attributes: attr2)
hist.record(0.009615690848606532, attributes: attr1)
hist.record(0.00007659464778730196, attributes: attr1)
hist.record(0.0101281877195143937, attributes: attr2)
OpenTelemetry.tracer_provider.shutdownThis generated the log line
E, [2025-12-15T08:39:35.907901 #15628] ERROR -- : OpenTelemetry error: Scale -12 is smaller than minimum scale -10 - /Users/USERNAME/.rbenv/versions/3.2.7/lib/ruby/gems/3.2.0/gems/opentelemetry-metrics-sdk-0.11.2/lib/opentelemetry/sdk/metrics/aggregation/exponential_bucket_histogram.rb:344:in `validate_scale'
Tip: React with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding +1 or me too, to help us triage it. Learn more here.
araishikeiwai, stellaconyer, anselina, hdeng68, zafardbx and 4 more
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working