Skip to content

Allow optimizing locking for built-in exemplar reservoirs - #7423

Merged
dashpole merged 4 commits into
open-telemetry:mainfrom
dashpole:change_exemplar_locking
Oct 1, 2025
Merged

Allow optimizing locking for built-in exemplar reservoirs #7423
dashpole merged 4 commits into
open-telemetry:mainfrom
dashpole:change_exemplar_locking

Conversation

@dashpole

@dashpole dashpole commented Sep 26, 2025

Copy link
Copy Markdown
Collaborator

Fixes #7388

Benchmarks seem like mostly noise. It isn't actually necessary to lock in the exemplar reservoir today because of our SDK design, but this allows us to make optimizations in the future. After #7427, improvements to exemplar reservoir locking will greatly improve the ExemplarEnabled benchmarks.

Parallel benchmarks:

goos: linux
goarch: amd64
pkg: go.opentelemetry.io/otel/sdk/metric
cpu: Intel(R) Xeon(R) CPU @ 2.20GHz
                                                                                  │  main24.txt  │           exemplar24.txt            │
                                                                                  │    sec/op    │    sec/op     vs base               │
SyncMeasure/NoView/ExemplarsDisabled/Int64Counter/Attributes/0-24                   399.5n ± 16%   367.8n ± 17%        ~ (p=0.310 n=6)
SyncMeasure/NoView/ExemplarsDisabled/Int64Counter/Attributes/1-24                   369.4n ± 27%   410.2n ± 11%        ~ (p=0.240 n=6)
SyncMeasure/NoView/ExemplarsDisabled/Int64Counter/Attributes/10-24                  372.6n ± 23%   398.9n ±  8%        ~ (p=0.394 n=6)
SyncMeasure/NoView/ExemplarsDisabled/Float64Counter/Attributes/0-24                 313.4n ± 12%   357.7n ± 20%        ~ (p=0.065 n=6)
SyncMeasure/NoView/ExemplarsDisabled/Float64Counter/Attributes/1-24                 389.9n ± 12%   379.5n ±  9%        ~ (p=0.818 n=6)
SyncMeasure/NoView/ExemplarsDisabled/Float64Counter/Attributes/10-24                441.4n ± 13%   359.1n ± 18%  -18.64% (p=0.009 n=6)
SyncMeasure/NoView/ExemplarsDisabled/Int64UpDownCounter/Attributes/0-24             415.8n ± 22%   400.3n ± 16%        ~ (p=0.937 n=6)
SyncMeasure/NoView/ExemplarsDisabled/Int64UpDownCounter/Attributes/1-24             346.9n ±  8%   364.6n ± 19%        ~ (p=0.240 n=6)
SyncMeasure/NoView/ExemplarsDisabled/Int64UpDownCounter/Attributes/10-24            358.9n ± 14%   407.1n ± 17%        ~ (p=0.093 n=6)
SyncMeasure/NoView/ExemplarsDisabled/Float64UpDownCounter/Attributes/0-24           381.9n ± 27%   375.2n ± 10%        ~ (p=0.937 n=6)
SyncMeasure/NoView/ExemplarsDisabled/Float64UpDownCounter/Attributes/1-24           361.9n ± 19%   389.6n ± 23%        ~ (p=0.818 n=6)
SyncMeasure/NoView/ExemplarsDisabled/Float64UpDownCounter/Attributes/10-24          356.0n ±  8%   416.1n ± 14%  +16.90% (p=0.015 n=6)
SyncMeasure/NoView/ExemplarsDisabled/Int64Gauge/Attributes/0-24                     313.9n ± 11%   385.7n ± 19%  +22.88% (p=0.041 n=6)
SyncMeasure/NoView/ExemplarsDisabled/Int64Gauge/Attributes/1-24                     368.8n ± 18%   387.6n ± 17%        ~ (p=0.394 n=6)
SyncMeasure/NoView/ExemplarsDisabled/Int64Gauge/Attributes/10-24                    346.1n ± 40%   460.3n ± 16%        ~ (p=0.065 n=6)
SyncMeasure/NoView/ExemplarsDisabled/Float64Gauge/Attributes/0-24                   325.9n ± 10%   357.8n ± 19%   +9.77% (p=0.026 n=6)
SyncMeasure/NoView/ExemplarsDisabled/Float64Gauge/Attributes/1-24                   372.1n ± 18%   395.2n ± 14%        ~ (p=0.180 n=6)
SyncMeasure/NoView/ExemplarsDisabled/Float64Gauge/Attributes/10-24                  353.5n ± 23%   416.0n ± 15%  +17.66% (p=0.024 n=6)
SyncMeasure/NoView/ExemplarsDisabled/Int64Histogram/Attributes/0-24                 351.8n ± 15%   362.7n ±  7%        ~ (p=0.699 n=6)
SyncMeasure/NoView/ExemplarsDisabled/Int64Histogram/Attributes/1-24                 378.8n ± 17%   413.4n ± 13%        ~ (p=0.288 n=6)
SyncMeasure/NoView/ExemplarsDisabled/Int64Histogram/Attributes/10-24                361.5n ± 13%   418.2n ± 14%        ~ (p=0.132 n=6)
SyncMeasure/NoView/ExemplarsDisabled/Float64Histogram/Attributes/0-24               305.0n ± 21%   361.9n ± 13%        ~ (p=0.065 n=6)
SyncMeasure/NoView/ExemplarsDisabled/Float64Histogram/Attributes/1-24               411.1n ± 12%   403.9n ±  9%        ~ (p=0.937 n=6)
SyncMeasure/NoView/ExemplarsDisabled/Float64Histogram/Attributes/10-24              353.4n ± 39%   380.9n ± 17%        ~ (p=0.394 n=6)
SyncMeasure/NoView/ExemplarsDisabled/ExponentialInt64Histogram/Attributes/0-24      457.5n ± 33%   454.2n ± 13%        ~ (p=1.000 n=6)
SyncMeasure/NoView/ExemplarsDisabled/ExponentialInt64Histogram/Attributes/1-24      436.6n ± 23%   459.0n ± 10%        ~ (p=0.310 n=6)
SyncMeasure/NoView/ExemplarsDisabled/ExponentialInt64Histogram/Attributes/10-24     383.3n ± 22%   461.9n ± 12%  +20.51% (p=0.002 n=6)
SyncMeasure/NoView/ExemplarsDisabled/ExponentialFloat64Histogram/Attributes/0-24    371.9n ± 14%   421.4n ± 19%  +13.33% (p=0.004 n=6)
SyncMeasure/NoView/ExemplarsDisabled/ExponentialFloat64Histogram/Attributes/1-24    433.7n ± 20%   490.8n ± 10%        ~ (p=0.310 n=6)
SyncMeasure/NoView/ExemplarsDisabled/ExponentialFloat64Histogram/Attributes/10-24   433.2n ± 18%   511.4n ±  9%  +18.05% (p=0.041 n=6)
SyncMeasure/NoView/ExemplarsEnabled/Int64Counter/Attributes/0-24                    477.5n ± 14%   384.6n ±  7%  -19.47% (p=0.002 n=6)
SyncMeasure/NoView/ExemplarsEnabled/Int64Counter/Attributes/1-24                    481.1n ± 17%   430.0n ± 18%        ~ (p=0.065 n=6)
SyncMeasure/NoView/ExemplarsEnabled/Int64Counter/Attributes/10-24                   425.1n ± 27%   436.3n ± 12%        ~ (p=0.699 n=6)
SyncMeasure/NoView/ExemplarsEnabled/Float64Counter/Attributes/0-24                  394.5n ±  8%   415.5n ± 15%        ~ (p=0.589 n=6)
SyncMeasure/NoView/ExemplarsEnabled/Float64Counter/Attributes/1-24                  434.4n ± 13%   440.8n ± 15%        ~ (p=0.937 n=6)
SyncMeasure/NoView/ExemplarsEnabled/Float64Counter/Attributes/10-24                 481.3n ± 19%   404.1n ± 14%  -16.05% (p=0.009 n=6)
SyncMeasure/NoView/ExemplarsEnabled/Int64UpDownCounter/Attributes/0-24              364.9n ± 29%   424.3n ±  8%        ~ (p=0.065 n=6)
SyncMeasure/NoView/ExemplarsEnabled/Int64UpDownCounter/Attributes/1-24              401.2n ± 24%   482.2n ± 12%  +20.20% (p=0.002 n=6)
SyncMeasure/NoView/ExemplarsEnabled/Int64UpDownCounter/Attributes/10-24             438.6n ± 19%   404.8n ± 18%        ~ (p=0.485 n=6)
SyncMeasure/NoView/ExemplarsEnabled/Float64UpDownCounter/Attributes/0-24            392.7n ± 17%   427.7n ± 25%        ~ (p=0.180 n=6)
SyncMeasure/NoView/ExemplarsEnabled/Float64UpDownCounter/Attributes/1-24            392.6n ±  5%   388.5n ±  7%        ~ (p=0.818 n=6)
SyncMeasure/NoView/ExemplarsEnabled/Float64UpDownCounter/Attributes/10-24           401.3n ± 19%   409.7n ±  8%        ~ (p=0.818 n=6)
SyncMeasure/NoView/ExemplarsEnabled/Int64Gauge/Attributes/0-24                      369.8n ± 15%   374.2n ± 17%        ~ (p=0.818 n=6)
SyncMeasure/NoView/ExemplarsEnabled/Int64Gauge/Attributes/1-24                      359.4n ± 13%   387.1n ± 16%        ~ (p=0.180 n=6)
SyncMeasure/NoView/ExemplarsEnabled/Int64Gauge/Attributes/10-24                     393.2n ± 18%   450.0n ± 10%  +14.43% (p=0.015 n=6)
SyncMeasure/NoView/ExemplarsEnabled/Float64Gauge/Attributes/0-24                    399.8n ± 23%   361.2n ± 11%        ~ (p=0.065 n=6)
SyncMeasure/NoView/ExemplarsEnabled/Float64Gauge/Attributes/1-24                    439.4n ± 25%   412.0n ± 10%        ~ (p=0.310 n=6)
SyncMeasure/NoView/ExemplarsEnabled/Float64Gauge/Attributes/10-24                   401.7n ± 17%   380.0n ± 11%        ~ (p=0.394 n=6)
SyncMeasure/NoView/ExemplarsEnabled/Int64Histogram/Attributes/0-24                  508.8n ± 18%   532.6n ± 16%        ~ (p=0.937 n=6)
SyncMeasure/NoView/ExemplarsEnabled/Int64Histogram/Attributes/1-24                  505.9n ± 22%   494.8n ± 14%        ~ (p=0.589 n=6)
SyncMeasure/NoView/ExemplarsEnabled/Int64Histogram/Attributes/10-24                 597.8n ± 10%   490.5n ± 23%        ~ (p=0.065 n=6)
SyncMeasure/NoView/ExemplarsEnabled/Float64Histogram/Attributes/0-24                566.2n ± 21%   482.9n ± 10%        ~ (p=0.132 n=6)
SyncMeasure/NoView/ExemplarsEnabled/Float64Histogram/Attributes/1-24                440.2n ±  9%   549.3n ±  8%  +24.77% (p=0.002 n=6)
SyncMeasure/NoView/ExemplarsEnabled/Float64Histogram/Attributes/10-24               436.3n ± 16%   530.8n ± 19%        ~ (p=0.093 n=6)
SyncMeasure/NoView/ExemplarsEnabled/ExponentialInt64Histogram/Attributes/0-24       395.8n ± 25%   441.6n ±  9%        ~ (p=0.065 n=6)
SyncMeasure/NoView/ExemplarsEnabled/ExponentialInt64Histogram/Attributes/1-24       440.2n ±  9%   455.2n ±  7%        ~ (p=0.180 n=6)
SyncMeasure/NoView/ExemplarsEnabled/ExponentialInt64Histogram/Attributes/10-24      415.7n ± 12%   527.5n ±  9%  +26.91% (p=0.002 n=6)
SyncMeasure/NoView/ExemplarsEnabled/ExponentialFloat64Histogram/Attributes/0-24     376.1n ± 19%   461.9n ± 13%  +22.81% (p=0.009 n=6)
SyncMeasure/NoView/ExemplarsEnabled/ExponentialFloat64Histogram/Attributes/1-24     383.6n ± 10%   422.7n ± 26%  +10.21% (p=0.015 n=6)
SyncMeasure/NoView/ExemplarsEnabled/ExponentialFloat64Histogram/Attributes/10-24    398.5n ±  9%   538.5n ±  7%  +35.13% (p=0.002 n=6)
geomean                                                                             399.4n         422.3n         +5.72%

Single-threaded benchmarks:

goos: linux
goarch: amd64
pkg: go.opentelemetry.io/otel/sdk/metric
cpu: Intel(R) Xeon(R) CPU @ 2.20GHz
                                                                               │  main1.txt   │            exemplar1.txt            │
                                                                               │    sec/op    │    sec/op     vs base               │
SyncMeasure/NoView/ExemplarsDisabled/Int64Counter/Attributes/0                   180.1n ± 21%   156.2n ± 10%        ~ (p=0.132 n=6)
SyncMeasure/NoView/ExemplarsDisabled/Int64Counter/Attributes/1                   168.4n ±  9%   179.2n ± 11%        ~ (p=0.132 n=6)
SyncMeasure/NoView/ExemplarsDisabled/Int64Counter/Attributes/10                  164.0n ± 10%   199.0n ± 20%  +21.30% (p=0.004 n=6)
SyncMeasure/NoView/ExemplarsDisabled/Float64Counter/Attributes/0                 153.9n ±  6%   170.1n ±  2%  +10.53% (p=0.002 n=6)
SyncMeasure/NoView/ExemplarsDisabled/Float64Counter/Attributes/1                 178.0n ±  5%   178.5n ±  6%        ~ (p=0.818 n=6)
SyncMeasure/NoView/ExemplarsDisabled/Float64Counter/Attributes/10                175.8n ±  7%   165.3n ± 18%        ~ (p=0.589 n=6)
SyncMeasure/NoView/ExemplarsDisabled/Int64UpDownCounter/Attributes/0             152.0n ±  8%   163.1n ± 26%        ~ (p=0.132 n=6)
SyncMeasure/NoView/ExemplarsDisabled/Int64UpDownCounter/Attributes/1             168.1n ±  8%   168.0n ± 14%        ~ (p=0.818 n=6)
SyncMeasure/NoView/ExemplarsDisabled/Int64UpDownCounter/Attributes/10            167.4n ±  4%   164.3n ± 12%        ~ (p=0.699 n=6)
SyncMeasure/NoView/ExemplarsDisabled/Float64UpDownCounter/Attributes/0           151.7n ± 17%   156.0n ± 28%        ~ (p=0.310 n=6)
SyncMeasure/NoView/ExemplarsDisabled/Float64UpDownCounter/Attributes/1           173.6n ±  5%   169.3n ±  5%   -2.45% (p=0.041 n=6)
SyncMeasure/NoView/ExemplarsDisabled/Float64UpDownCounter/Attributes/10          169.3n ±  4%   165.7n ±  7%        ~ (p=0.394 n=6)
SyncMeasure/NoView/ExemplarsDisabled/Int64Gauge/Attributes/0                     155.5n ± 15%   153.8n ± 11%        ~ (p=0.558 n=6)
SyncMeasure/NoView/ExemplarsDisabled/Int64Gauge/Attributes/1                     166.7n ±  3%   173.5n ±  7%        ~ (p=0.132 n=6)
SyncMeasure/NoView/ExemplarsDisabled/Int64Gauge/Attributes/10                    174.4n ± 17%   167.6n ± 13%        ~ (p=0.699 n=6)
SyncMeasure/NoView/ExemplarsDisabled/Float64Gauge/Attributes/0                   180.1n ± 32%   154.8n ±  5%  -14.02% (p=0.002 n=6)
SyncMeasure/NoView/ExemplarsDisabled/Float64Gauge/Attributes/1                   204.6n ± 23%   173.8n ± 19%        ~ (p=0.069 n=6)
SyncMeasure/NoView/ExemplarsDisabled/Float64Gauge/Attributes/10                  226.6n ± 28%   174.5n ± 10%        ~ (p=0.132 n=6)
SyncMeasure/NoView/ExemplarsDisabled/Int64Histogram/Attributes/0                 132.7n ± 13%   140.7n ± 14%        ~ (p=0.132 n=6)
SyncMeasure/NoView/ExemplarsDisabled/Int64Histogram/Attributes/1                 143.4n ±  9%   162.6n ±  9%  +13.42% (p=0.004 n=6)
SyncMeasure/NoView/ExemplarsDisabled/Int64Histogram/Attributes/10                154.7n ±  7%   172.3n ±  6%  +11.38% (p=0.002 n=6)
SyncMeasure/NoView/ExemplarsDisabled/Float64Histogram/Attributes/0               136.8n ± 10%   145.5n ± 14%        ~ (p=0.240 n=6)
SyncMeasure/NoView/ExemplarsDisabled/Float64Histogram/Attributes/1               148.4n ± 11%   159.7n ±  8%        ~ (p=0.167 n=6)
SyncMeasure/NoView/ExemplarsDisabled/Float64Histogram/Attributes/10              193.0n ± 25%   165.5n ±  9%        ~ (p=0.310 n=6)
SyncMeasure/NoView/ExemplarsDisabled/ExponentialInt64Histogram/Attributes/0      249.8n ± 47%   229.5n ±  7%        ~ (p=0.394 n=6)
SyncMeasure/NoView/ExemplarsDisabled/ExponentialInt64Histogram/Attributes/1      262.1n ± 20%   245.1n ± 12%        ~ (p=0.699 n=6)
SyncMeasure/NoView/ExemplarsDisabled/ExponentialInt64Histogram/Attributes/10     285.4n ± 20%   249.9n ± 17%        ~ (p=0.132 n=6)
SyncMeasure/NoView/ExemplarsDisabled/ExponentialFloat64Histogram/Attributes/0    272.9n ± 20%   216.3n ±  6%  -20.75% (p=0.002 n=6)
SyncMeasure/NoView/ExemplarsDisabled/ExponentialFloat64Histogram/Attributes/1    311.8n ± 29%   234.4n ±  6%        ~ (p=0.132 n=6)
SyncMeasure/NoView/ExemplarsDisabled/ExponentialFloat64Histogram/Attributes/10   228.2n ±  6%   234.2n ±  4%        ~ (p=0.240 n=6)
SyncMeasure/NoView/ExemplarsEnabled/Int64Counter/Attributes/0                    289.2n ± 39%   263.3n ± 10%        ~ (p=1.000 n=6)
SyncMeasure/NoView/ExemplarsEnabled/Int64Counter/Attributes/1                    271.9n ± 18%   280.6n ±  8%        ~ (p=0.589 n=6)
SyncMeasure/NoView/ExemplarsEnabled/Int64Counter/Attributes/10                   272.1n ±  6%   303.7n ± 14%        ~ (p=0.310 n=6)
SyncMeasure/NoView/ExemplarsEnabled/Float64Counter/Attributes/0                  280.1n ±  8%   268.8n ±  5%        ~ (p=0.240 n=6)
SyncMeasure/NoView/ExemplarsEnabled/Float64Counter/Attributes/1                  291.6n ± 81%   268.8n ±  7%        ~ (p=0.180 n=6)
SyncMeasure/NoView/ExemplarsEnabled/Float64Counter/Attributes/10                 276.3n ± 13%   278.1n ±  6%        ~ (p=0.784 n=6)
SyncMeasure/NoView/ExemplarsEnabled/Int64UpDownCounter/Attributes/0              254.7n ±  7%   282.4n ±  5%  +10.85% (p=0.026 n=6)
SyncMeasure/NoView/ExemplarsEnabled/Int64UpDownCounter/Attributes/1              277.5n ± 11%   285.2n ± 16%        ~ (p=0.937 n=6)
SyncMeasure/NoView/ExemplarsEnabled/Int64UpDownCounter/Attributes/10             267.0n ± 10%   275.9n ±  5%        ~ (p=0.240 n=6)
SyncMeasure/NoView/ExemplarsEnabled/Float64UpDownCounter/Attributes/0            256.9n ±  3%   286.4n ±  8%  +11.46% (p=0.002 n=6)
SyncMeasure/NoView/ExemplarsEnabled/Float64UpDownCounter/Attributes/1            267.9n ± 16%   278.0n ± 12%        ~ (p=0.180 n=6)
SyncMeasure/NoView/ExemplarsEnabled/Float64UpDownCounter/Attributes/10           272.5n ±  4%   267.4n ±  6%        ~ (p=0.310 n=6)
SyncMeasure/NoView/ExemplarsEnabled/Int64Gauge/Attributes/0                      272.5n ± 22%   266.2n ± 14%        ~ (p=0.589 n=6)
SyncMeasure/NoView/ExemplarsEnabled/Int64Gauge/Attributes/1                      355.2n ± 11%   275.2n ±  7%  -22.52% (p=0.002 n=6)
SyncMeasure/NoView/ExemplarsEnabled/Int64Gauge/Attributes/10                     281.3n ±  7%   268.9n ±  4%        ~ (p=0.093 n=6)
SyncMeasure/NoView/ExemplarsEnabled/Float64Gauge/Attributes/0                    257.0n ±  9%   308.9n ±  7%  +20.20% (p=0.002 n=6)
SyncMeasure/NoView/ExemplarsEnabled/Float64Gauge/Attributes/1                    265.9n ±  9%   319.6n ±  7%  +20.18% (p=0.002 n=6)
SyncMeasure/NoView/ExemplarsEnabled/Float64Gauge/Attributes/10                   279.9n ±  3%   332.9n ±  7%  +18.92% (p=0.002 n=6)
SyncMeasure/NoView/ExemplarsEnabled/Int64Histogram/Attributes/0                  313.9n ± 11%   345.1n ± 10%   +9.91% (p=0.002 n=6)
SyncMeasure/NoView/ExemplarsEnabled/Int64Histogram/Attributes/1                  332.1n ±  7%   359.9n ±  9%   +8.37% (p=0.009 n=6)
SyncMeasure/NoView/ExemplarsEnabled/Int64Histogram/Attributes/10                 366.4n ± 55%   380.1n ±  4%        ~ (p=0.240 n=6)
SyncMeasure/NoView/ExemplarsEnabled/Float64Histogram/Attributes/0                336.8n ± 12%   346.3n ±  7%        ~ (p=0.589 n=6)
SyncMeasure/NoView/ExemplarsEnabled/Float64Histogram/Attributes/1                361.9n ± 18%   375.0n ±  8%   +3.62% (p=0.004 n=6)
SyncMeasure/NoView/ExemplarsEnabled/Float64Histogram/Attributes/10               351.8n ±  6%   392.1n ±  4%  +11.46% (p=0.002 n=6)
SyncMeasure/NoView/ExemplarsEnabled/ExponentialInt64Histogram/Attributes/0       358.8n ±  9%   344.3n ±  5%        ~ (p=0.310 n=6)
SyncMeasure/NoView/ExemplarsEnabled/ExponentialInt64Histogram/Attributes/1       352.0n ±  7%   331.5n ±  5%   -5.84% (p=0.041 n=6)
SyncMeasure/NoView/ExemplarsEnabled/ExponentialInt64Histogram/Attributes/10      373.5n ± 10%   353.7n ±  9%        ~ (p=0.394 n=6)
SyncMeasure/NoView/ExemplarsEnabled/ExponentialFloat64Histogram/Attributes/0     328.5n ±  9%   345.4n ±  5%   +5.14% (p=0.015 n=6)
SyncMeasure/NoView/ExemplarsEnabled/ExponentialFloat64Histogram/Attributes/1     349.1n ± 28%   337.8n ±  9%        ~ (p=0.240 n=6)
SyncMeasure/NoView/ExemplarsEnabled/ExponentialFloat64Histogram/Attributes/10    347.5n ± 10%   344.2n ± 10%        ~ (p=1.000 n=6)
geomean                                                                          235.3n         234.4n         -0.38%
@codecov

codecov Bot commented Sep 26, 2025

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 85.5%. Comparing base (6c54ef6) to head (d5f8573).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##            main   #7423     +/-   ##
=======================================
- Coverage   85.5%   85.5%   -0.1%     
=======================================
  Files        279     279             
  Lines      24709   24725     +16     
=======================================
+ Hits       21142   21154     +12     
- Misses      3188    3192      +4     
  Partials     379     379             
Files with missing lines Coverage Δ
sdk/metric/exemplar/fixed_size_reservoir.go 97.6% <100.0%> (ø)
sdk/metric/exemplar/histogram_reservoir.go 90.4% <100.0%> (ø)
sdk/metric/exemplar/storage.go 100.0% <100.0%> (ø)
...dk/metric/internal/aggregate/filtered_reservoir.go 100.0% <100.0%> (ø)

... and 3 files with indirect coverage changes

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

Copy link
Copy Markdown
Collaborator Author

I think we can ignore the link checker failure. the link works, but the website seems to reject link checkers :)

@pellared

pellared commented Sep 29, 2025

Copy link
Copy Markdown
Member

Can you add some benchstat results?

Comment thread sdk/metric/exemplar/reservoir.go Outdated
@dashpole
dashpole force-pushed the change_exemplar_locking branch 3 times, most recently from 076cd9b to b8d394b Compare September 30, 2025 16:18
@dashpole dashpole added the Skip Changelog PRs that do not require a CHANGELOG.md entry label Sep 30, 2025
@dashpole dashpole changed the title Exemplar reservoir must be concurrent-safe Sep 30, 2025
@dashpole
dashpole force-pushed the change_exemplar_locking branch 5 times, most recently from c925a5d to f7b1dab Compare September 30, 2025 16:56
Comment thread sdk/metric/exemplar/storage.go Outdated
Comment thread sdk/metric/exemplar1.txt Outdated
Comment thread sdk/metric/exemplar24.txt Outdated
Comment thread sdk/metric/main1.txt Outdated
Comment thread sdk/metric/main24.txt Outdated
Comment thread sdk/metric/internal/x/concurrent_safe_reservoir.go Outdated
@dashpole
dashpole force-pushed the change_exemplar_locking branch from f7b1dab to 7b787f8 Compare October 1, 2025 14:27
@dashpole
dashpole force-pushed the change_exemplar_locking branch from 7b787f8 to d0bf24b Compare October 1, 2025 14:28

@MrAlias MrAlias left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like the linter is failing for a missing package name. But other than that this looks good. 🚀

@dashpole
dashpole merged commit ea38204 into open-telemetry:main Oct 1, 2025
30 of 31 checks passed
@dashpole
dashpole deleted the change_exemplar_locking branch October 1, 2025 19:51
pellared pushed a commit that referenced this pull request Oct 3, 2025
This also fixes a bug introduced in
#7423, where we
were only locking around storage and not around other shared fields
(e.g. count). Fixing the bug is required for benchmarks to run properly,
but wasn't caught by concurrent safe tests because the SDK does not
currently call exemplar methods concurrently.

```
goos: linux
goarch: amd64
pkg: go.opentelemetry.io/otel/sdk/metric/exemplar
cpu: Intel(R) Xeon(R) CPU @ 2.20GHz
BenchmarkFixedSizeReservoirOffer-24    	  498955	       248.4 ns/op	       0 B/op	       0 allocs/op
BenchmarkHistogramReservoirOffer-24    	  478068	       250.1 ns/op	       0 B/op	       0 allocs/op
```
@MrAlias MrAlias added this to the v1.39.0 milestone Oct 14, 2025
@MrAlias MrAlias mentioned this pull request Jan 16, 2026
42 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Skip Changelog PRs that do not require a CHANGELOG.md entry

4 participants