Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
826a908
[METRICS SDK] Enforce a runtime minimum scale for Base2ExponentialHis…
ThomsonTan Aug 4, 2026
fc14b21
Merge branch 'main' into runtime_scale
ThomsonTan Aug 4, 2026
2c25401
Update changelog
ThomsonTan Aug 4, 2026
cf355bd
Fix IWYU
ThomsonTan Aug 4, 2026
a2c7948
Merge branch 'main' into runtime_scale
ThomsonTan Aug 4, 2026
173b81e
Fix cppcheck
ThomsonTan Aug 6, 2026
6dafb49
Merge branch 'main' into runtime_scale
ThomsonTan Aug 6, 2026
d2a3d9d
Address feedback
ThomsonTan Aug 7, 2026
bf604d3
Merge branch 'main' into runtime_scale
ThomsonTan Aug 11, 2026
3b2df84
Fix iwyu
ThomsonTan Aug 12, 2026
a5af8bd
Merge branch 'main' into runtime_scale
ThomsonTan Aug 12, 2026
adee66f
Merge branch 'main' into runtime_scale
ThomsonTan Aug 12, 2026
4cdde54
Merge branch 'main' into runtime_scale
ThomsonTan Aug 12, 2026
8aeab83
Merge branch 'main' into runtime_scale
dbarker Aug 18, 2026
6831016
Address feedback
ThomsonTan Aug 19, 2026
e68791e
Merge branch 'main' into runtime_scale
ThomsonTan Aug 19, 2026
396b814
Fix bad merge
ThomsonTan Aug 19, 2026
6e40f74
Merge branch 'main' into runtime_scale
ThomsonTan Aug 20, 2026
5bf9c62
Merge branch 'main' into runtime_scale
ThomsonTan Aug 21, 2026
d67c30b
Merge branch 'main' into runtime_scale
ThomsonTan Aug 22, 2026
c759055
Merge branch 'main' into runtime_scale
dbarker Aug 24, 2026
db3bdcf
Merge branch 'main' into runtime_scale
dbarker Aug 25, 2026
b89e05b
Merge branch 'main' into runtime_scale
dbarker Aug 31, 2026
95f0c49
Merge branch 'main' into runtime_scale
dbarker Sep 1, 2026
db18aa3
Merge branch 'main' into runtime_scale
ThomsonTan Sep 2, 2026
abf4fbb
Reject malformed base2 exponential histogram points
ThomsonTan Sep 4, 2026
815c7b6
Merge branch 'main' into runtime_scale
ThomsonTan Sep 4, 2026
08dcb54
Fix format
ThomsonTan Sep 4, 2026
213de69
Merge branch 'main' into runtime_scale
ThomsonTan Sep 5, 2026
e824ba6
Merge branch 'main' into runtime_scale
marcalff Sep 7, 2026
5f69cd3
Merge branch 'main' into runtime_scale
dbarker Sep 11, 2026
88246ae
Merge branch 'main' into runtime_scale
dbarker Sep 11, 2026
bcac380
Merge branch 'main' into runtime_scale
ThomsonTan Sep 11, 2026
bb77c83
Fix base2 histogram Diff count loss and UB on supplied points
ThomsonTan Sep 24, 2026
43095c1
Merge remote-tracking branch 'origin/main' into pr-4353
ThomsonTan Sep 24, 2026
5003e3f
Merge branch 'main' into runtime_scale
ThomsonTan Sep 24, 2026
fe86d2c
Merge branch 'main' into runtime_scale
marcalff Sep 26, 2026
af0db80
Merge branch 'main' into runtime_scale
marcalff Sep 26, 2026
e51410f
Merge branch 'main' into runtime_scale
marcalff Sep 30, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ Increment the:

## [Unreleased]

* [METRICS SDK] Enforce a runtime minimum scale of `-11` for
`Base2ExponentialHistogramAggregation`, so a recording that spans the full
double range no longer downscales without end.
[#4353](https://github.com/open-telemetry/opentelemetry-cpp/pull/4353)

* [LOGS] Fix undefined behavior in `Logger::EmitLogRecord()` when a logger is
enabled (e.g. via `LoggerProvider::UpdateLoggerConfigurator()`) after
`CreateLogRecord()` was called while it was still disabled. The disabled
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,12 @@ constexpr std::int32_t kMaxScaleMin = -10;
constexpr std::int32_t kMaxScaleMax = 20;
constexpr std::size_t kMaxSizeMin = 2;

// Lower bound for the scale chosen at runtime by automatic downscaling. The specification only
// requires a "reasonable minimum". At -11 every finite double maps to a bucket index in [-1, 0],
// so the whole range fits in kMaxSizeMin buckets and no configuration needs more than its
// max_size. This bounds the runtime scale only; max_scale still starts no lower than kMaxScaleMin.
constexpr std::int32_t kMinRuntimeScale = -11;

class Base2ExponentialHistogramAggregationConfig : public AggregationConfig
{
public:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,17 @@ class Base2ExponentialHistogramAggregation : public Aggregation
private:
void AggregateIntoBuckets(std::unique_ptr<AdaptingCircularBufferCounter> &buckets,
double value) noexcept;
void Downscale(uint32_t by) noexcept;

/* Reduces the scale by up to `by`, stopping at kMinRuntimeScale. Returns the reduction that was
* actually applied, which callers must use to shift bucket indices. */
uint32_t Downscale(uint32_t by) noexcept;

mutable opentelemetry::common::SpinLockMutex lock_;
Base2ExponentialHistogramPointData point_data_;
Base2ExponentialHistogramIndexer indexer_;
bool record_min_max_ = true;
// Keeps the scale floor warning off the record hot path after the first occurrence.
bool floor_warning_emitted_ = false;
};

} // namespace metrics
Expand Down
Loading
Loading