Skip to content

PoC: allow reservoirs to defer recording the timestamp until storage#7711

Closed
dashpole wants to merge 1 commit intoopen-telemetry:mainfrom
dashpole:defer_timestamp
Closed

PoC: allow reservoirs to defer recording the timestamp until storage#7711
dashpole wants to merge 1 commit intoopen-telemetry:mainfrom
dashpole:defer_timestamp

Conversation

@dashpole
Copy link
Copy Markdown
Contributor

@dashpole dashpole commented Dec 15, 2025

recording the current time can be expensive, so I thought maybe deferring it until after the time-weighted algorithm decided to store it would have a positive impact on performance. But in my testing, it is less than a 1% improvement, which i'm not sure is worth the additional complexity:

Benchmarks are both after #7447 is applied.

                                                                          │ optimizefixed.txt │         defertimestamp.txt         │
                                                                          │      sec/op       │    sec/op     vs base              │
SyncMeasure/NoView/ExemplarsEnabled/Int64Counter/Attributes/0-24                 68.14n ± 11%   65.21n ±  6%       ~ (p=0.093 n=6)
SyncMeasure/NoView/ExemplarsEnabled/Int64Counter/Attributes/1-24                 70.31n ±  9%   73.17n ± 11%       ~ (p=0.180 n=6)
SyncMeasure/NoView/ExemplarsEnabled/Int64Counter/Attributes/10-24                68.20n ±  3%   72.36n ±  6%  +6.11% (p=0.002 n=6)
SyncMeasure/NoView/ExemplarsEnabled/Float64Counter/Attributes/0-24               71.31n ± 12%   67.80n ± 14%       ~ (p=0.589 n=6)
SyncMeasure/NoView/ExemplarsEnabled/Float64Counter/Attributes/1-24               69.35n ± 10%   65.89n ±  4%  -4.98% (p=0.004 n=6)
SyncMeasure/NoView/ExemplarsEnabled/Float64Counter/Attributes/10-24              66.04n ±  6%   65.62n ±  5%       ~ (p=0.310 n=6)
SyncMeasure/NoView/ExemplarsEnabled/Int64UpDownCounter/Attributes/0-24           65.47n ±  7%   68.67n ±  4%       ~ (p=0.180 n=6)
SyncMeasure/NoView/ExemplarsEnabled/Int64UpDownCounter/Attributes/1-24           68.15n ±  7%   66.19n ±  3%       ~ (p=0.132 n=6)
SyncMeasure/NoView/ExemplarsEnabled/Int64UpDownCounter/Attributes/10-24          69.06n ± 12%   67.82n ±  7%       ~ (p=0.093 n=6)
SyncMeasure/NoView/ExemplarsEnabled/Float64UpDownCounter/Attributes/0-24         71.47n ± 10%   66.61n ±  3%       ~ (p=0.180 n=6)
SyncMeasure/NoView/ExemplarsEnabled/Float64UpDownCounter/Attributes/1-24         68.14n ±  7%   66.16n ± 11%       ~ (p=0.589 n=6)
SyncMeasure/NoView/ExemplarsEnabled/Float64UpDownCounter/Attributes/10-24        65.73n ±  4%   67.22n ±  7%       ~ (p=0.589 n=6)
geomean                                                                          68.42n         67.68n        -1.08%

@dashpole dashpole closed this Dec 15, 2025
@codecov
Copy link
Copy Markdown

codecov Bot commented Dec 15, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 86.2%. Comparing base (19a5a68) to head (ce9849f).

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##            main   #7711     +/-   ##
=======================================
- Coverage   86.2%   86.2%   -0.1%     
=======================================
  Files        302     302             
  Lines      21971   21977      +6     
=======================================
+ Hits       18950   18954      +4     
- Misses      2640    2642      +2     
  Partials     381     381             
Files with missing lines Coverage Δ
sdk/metric/exemplar/fixed_size_reservoir.go 94.7% <ø> (ø)
sdk/metric/exemplar/histogram_reservoir.go 90.9% <ø> (ø)
sdk/metric/exemplar/storage.go 100.0% <100.0%> (ø)
...dk/metric/internal/aggregate/filtered_reservoir.go 100.0% <100.0%> (ø)

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@MrAlias MrAlias mentioned this pull request Jan 16, 2026
39 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant