OpenTelemetry C++: Histogram fixes for NaN and infinity

OpenTelemetry C++, a C++ telemetry library, added two histogram fixes to main this week. They reject NaN and infinity before those values corrupt histogram statistics. For developers who maintain metric instrumentation, these changes deserve attention alongside updates to semantic convention headers and build checks.

Histogram checks protect counts and totals

The instrument validation fix restores a finite value check in DoubleHistogram::Record. The changes in sdk/src/metrics/sync_instruments.cc cover its overloads and the bound histogram implementation. NaN and positive infinity return before storage receives the measurement. The instrument emits an internal warning for these rejected values.

A separate exponential histogram fix adds a check inside the aggregation layer. The aggregation implementation rejects NaN and both infinities before it changes the count, sum, minimum or maximum. These values previously affected the statistics despite their exclusion from histogram buckets. The second check protects aggregation code independently of the instrument check.

The added regression test supplies 1.0, NaN, positive infinity, negative infinity and 2.0. It expects a count of 2, a sum of 3.0, a minimum of 1.0 and a maximum of 2.0. That example makes the intended behavior explicit: rejected measurements contribute nothing to those statistics. If application code calculates histogram measurements, include invalid numeric results in its tests.

Semantic convention headers reach 1.45.0

The semantic convention update moves the generated C++ headers to version 1.45.0. The generator also moves from Weaver 0.25.1 to 0.28.0. Contributors who regenerate these headers need that tool version to reproduce the output.

For database instrumentation, db_attributes.h clarifies batch attribute rules. It compares each operation’s attributes with the values that operation would have outside a batch. The documentation also permits a synthetic client library status for db.response.status_code. These are useful details when you maintain custom database instrumentation. The header update itself does not rewrite the attributes your application emits.

Compiler and package checks change

The C++ standard test matrix replaces separate jobs in .github/workflows/ci.yml. Its combinations cover C++14 through C++23 with selected GCC and Clang versions. Each combination tests both STL modes. The matrix disables fail-fast, which lets the other combinations continue after one fails. That gives contributors more evidence about compiler compatibility in one CI run.

The Conan job revision removes the Ubuntu stable dependency job and moves the macOS job to the latest dependency recipe. The remaining Ubuntu and macOS Conan jobs use Release builds with two concurrent links. Ubuntu also uses lld to reduce memory use during static gRPC test links. These workflow choices help explain differences when developers reproduce CI failures locally.

Two smaller changes keep the build configuration precise. A Windows runner correction restores the Windows 2022 CMake install check to windows-2022. The Bazel dependency cleanup removes unused rules_foreign_cc from MODULE.bazel.

What to watch

The histogram fixes appear under Unreleased in the changelog. Check that your selected release includes both changes before you rely on them in production.

For histogram validation, check the aggregate statistics as well as bucket contents. The regression example shows why a bucket check alone misses the defect.

If you reproduce a Conan failure, match the revised Release configuration and link concurrency. An older Debug recipe no longer matches those CI jobs.

← All updates