Skip to content

Add NaN/Infinity handling policy across aggregations #2368

Description

@kaylareopelle

Spec requirement

The SDK MUST handle numerical limits gracefully, including IEEE-754 NaN/Infinity inputs (sdk.md:1956-1973, Numerical limits handling). [Development] Exponential histograms specifically MUST accept the full normal IEEE-754 range excluding ±Inf/NaN, and SHOULD NOT let non-normal values pollute sum/min/max (sdk.md:798-810, Handle all normal values).

Current behavior

No explicit NaN/Infinity guards exist in any aggregation's update path (sum.rb:54-68 (permalink), explicit_bucket_histogram.rb:63-74 (permalink), exponential_bucket_histogram.rb:224-235,268-283 (permalink)). Ruby's native float semantics apply implicitly which prevents crashes, but a NaN measurement silently poisons a running sum rather than being handled by any documented policy.

Suggested fix

Add a guard in each aggregation's update path (Sum, Explicit/Exponential Histogram) that rejects or specially handles NaN/Infinity measurements before they reach sum/min/max, applied consistently across all three aggregation classes in one pass since they share the same underlying pattern.

Related rows in SPEC_COMPLIANCE_METRICS.md

SDK-63, SDK-21

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingmetricsspec-complianceRequired for OpenTelemetry spec compliancespec:stableRelated to a stable specification

    Type

    No type

    Projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions