Skip to content

Add WithUnsafeAttributes to support no-copy dynamic metric API calls#8251

Open
dashpole wants to merge 4 commits intoopen-telemetry:mainfrom
dashpole:WithUnsafeAttributes
Open

Add WithUnsafeAttributes to support no-copy dynamic metric API calls#8251
dashpole wants to merge 4 commits intoopen-telemetry:mainfrom
dashpole:WithUnsafeAttributes

Conversation

@dashpole
Copy link
Copy Markdown
Contributor

Split from #8179

Part of #7743

This just defines the new WithUnsafeAttributes option, but converts it to a set, and leaves the optimization of that path for a follow-up.

Benchmarks

goos: linux
goarch: amd64
pkg: go.opentelemetry.io/otel/sdk/metric
cpu: Intel(R) Xeon(R) CPU @ 2.20GHz
                                                                              │   out.txt    │
                                                                              │    sec/op    │
EndToEndCounterAdd/NoFilter/Attributes/1/Precomputed/WithAttributeSet-24        65.18n ± 25%
EndToEndCounterAdd/NoFilter/Attributes/1/Precomputed/WithAttributes-24          61.96n ± 19%
EndToEndCounterAdd/NoFilter/Attributes/1/Precomputed/WithUnsafeAttributes-24    199.9n ± 22%
EndToEndCounterAdd/NoFilter/Attributes/1/Dynamic/WithAttributeSet-24            231.6n ±  9%
EndToEndCounterAdd/NoFilter/Attributes/1/Dynamic/WithAttributes-24              288.0n ± 14%
EndToEndCounterAdd/NoFilter/Attributes/1/Dynamic/WithUnsafeAttributes-24        271.9n ±  6%
EndToEndCounterAdd/NoFilter/Attributes/1/Naive/WithAttributes-24                352.7n ± 14%
EndToEndCounterAdd/NoFilter/Attributes/5/Precomputed/WithAttributeSet-24        68.73n ± 22%
EndToEndCounterAdd/NoFilter/Attributes/5/Precomputed/WithAttributes-24          61.04n ± 22%
EndToEndCounterAdd/NoFilter/Attributes/5/Precomputed/WithUnsafeAttributes-24    754.0n ± 25%
EndToEndCounterAdd/NoFilter/Attributes/5/Dynamic/WithAttributeSet-24            637.3n ± 21%
EndToEndCounterAdd/NoFilter/Attributes/5/Dynamic/WithAttributes-24              908.2n ± 28%
EndToEndCounterAdd/NoFilter/Attributes/5/Dynamic/WithUnsafeAttributes-24        901.7n ± 14%
EndToEndCounterAdd/NoFilter/Attributes/5/Naive/WithAttributes-24                1.062µ ± 15%
EndToEndCounterAdd/NoFilter/Attributes/10/Precomputed/WithAttributeSet-24       53.82n ± 28%
EndToEndCounterAdd/NoFilter/Attributes/10/Precomputed/WithAttributes-24         65.82n ±  5%
EndToEndCounterAdd/NoFilter/Attributes/10/Precomputed/WithUnsafeAttributes-24   1.717µ ± 14%
EndToEndCounterAdd/NoFilter/Attributes/10/Dynamic/WithAttributeSet-24           1.183µ ± 13%
EndToEndCounterAdd/NoFilter/Attributes/10/Dynamic/WithAttributes-24             1.803µ ± 20%
EndToEndCounterAdd/NoFilter/Attributes/10/Dynamic/WithUnsafeAttributes-24       2.050µ ± 15%
EndToEndCounterAdd/NoFilter/Attributes/10/Naive/WithAttributes-24               2.082µ ± 33%
EndToEndCounterAdd/Filtered/Attributes/1/Precomputed/WithAttributeSet-24        204.1n ± 14%
EndToEndCounterAdd/Filtered/Attributes/1/Precomputed/WithAttributes-24          214.5n ± 28%
EndToEndCounterAdd/Filtered/Attributes/1/Precomputed/WithUnsafeAttributes-24    433.9n ± 18%
EndToEndCounterAdd/Filtered/Attributes/1/Dynamic/WithAttributeSet-24            412.6n ± 10%
EndToEndCounterAdd/Filtered/Attributes/1/Dynamic/WithAttributes-24              464.1n ± 18%
EndToEndCounterAdd/Filtered/Attributes/1/Dynamic/WithUnsafeAttributes-24        471.4n ± 13%
EndToEndCounterAdd/Filtered/Attributes/1/Naive/WithAttributes-24                558.5n ± 19%
EndToEndCounterAdd/Filtered/Attributes/5/Precomputed/WithAttributeSet-24        772.4n ± 14%
EndToEndCounterAdd/Filtered/Attributes/5/Precomputed/WithAttributes-24          748.7n ±  9%
EndToEndCounterAdd/Filtered/Attributes/5/Precomputed/WithUnsafeAttributes-24    1.453µ ± 17%
EndToEndCounterAdd/Filtered/Attributes/5/Dynamic/WithAttributeSet-24            1.501µ ± 19%
EndToEndCounterAdd/Filtered/Attributes/5/Dynamic/WithAttributes-24              1.489µ ±  9%
EndToEndCounterAdd/Filtered/Attributes/5/Dynamic/WithUnsafeAttributes-24        1.608µ ± 24%
EndToEndCounterAdd/Filtered/Attributes/5/Naive/WithAttributes-24                1.671µ ± 14%
EndToEndCounterAdd/Filtered/Attributes/10/Precomputed/WithAttributeSet-24       1.324µ ± 18%
EndToEndCounterAdd/Filtered/Attributes/10/Precomputed/WithAttributes-24         1.463µ ± 17%
EndToEndCounterAdd/Filtered/Attributes/10/Precomputed/WithUnsafeAttributes-24   2.833µ ± 33%
EndToEndCounterAdd/Filtered/Attributes/10/Dynamic/WithAttributeSet-24           2.635µ ±  9%
EndToEndCounterAdd/Filtered/Attributes/10/Dynamic/WithAttributes-24             3.125µ ± 14%
EndToEndCounterAdd/Filtered/Attributes/10/Dynamic/WithUnsafeAttributes-24       2.685µ ± 24%
EndToEndCounterAdd/Filtered/Attributes/10/Naive/WithAttributes-24               3.404µ ±  8%
geomean                                                                         610.5n

                                                                              │    out.txt     │
                                                                              │      B/op      │
EndToEndCounterAdd/NoFilter/Attributes/1/Precomputed/WithAttributeSet-24          0.000 ± 0%
EndToEndCounterAdd/NoFilter/Attributes/1/Precomputed/WithAttributes-24            0.000 ± 0%
EndToEndCounterAdd/NoFilter/Attributes/1/Precomputed/WithUnsafeAttributes-24      128.0 ± 0%
EndToEndCounterAdd/NoFilter/Attributes/1/Dynamic/WithAttributeSet-24              88.00 ± 0%
EndToEndCounterAdd/NoFilter/Attributes/1/Dynamic/WithAttributes-24                152.0 ± 0%
EndToEndCounterAdd/NoFilter/Attributes/1/Dynamic/WithUnsafeAttributes-24          128.0 ± 0%
EndToEndCounterAdd/NoFilter/Attributes/1/Naive/WithAttributes-24                  232.0 ± 0%
EndToEndCounterAdd/NoFilter/Attributes/5/Precomputed/WithAttributeSet-24          0.000 ± 0%
EndToEndCounterAdd/NoFilter/Attributes/5/Precomputed/WithAttributes-24            0.000 ± 0%
EndToEndCounterAdd/NoFilter/Attributes/5/Precomputed/WithUnsafeAttributes-24      640.0 ± 0%
EndToEndCounterAdd/NoFilter/Attributes/5/Dynamic/WithAttributeSet-24              344.0 ± 0%
EndToEndCounterAdd/NoFilter/Attributes/5/Dynamic/WithAttributes-24                664.0 ± 0%
EndToEndCounterAdd/NoFilter/Attributes/5/Dynamic/WithUnsafeAttributes-24          640.0 ± 0%
EndToEndCounterAdd/NoFilter/Attributes/5/Naive/WithAttributes-24                 1000.0 ± 0%
EndToEndCounterAdd/NoFilter/Attributes/10/Precomputed/WithAttributeSet-24         0.000 ± 0%
EndToEndCounterAdd/NoFilter/Attributes/10/Precomputed/WithAttributes-24           0.000 ± 0%
EndToEndCounterAdd/NoFilter/Attributes/10/Precomputed/WithUnsafeAttributes-24   1.375Ki ± 0%
EndToEndCounterAdd/NoFilter/Attributes/10/Dynamic/WithAttributeSet-24             729.0 ± 0%
EndToEndCounterAdd/NoFilter/Attributes/10/Dynamic/WithAttributes-24             1.399Ki ± 0%
EndToEndCounterAdd/NoFilter/Attributes/10/Dynamic/WithUnsafeAttributes-24       1.376Ki ± 0%
EndToEndCounterAdd/NoFilter/Attributes/10/Naive/WithAttributes-24               2.102Ki ± 0%
EndToEndCounterAdd/Filtered/Attributes/1/Precomputed/WithAttributeSet-24          64.00 ± 0%
EndToEndCounterAdd/Filtered/Attributes/1/Precomputed/WithAttributes-24            64.00 ± 0%
EndToEndCounterAdd/Filtered/Attributes/1/Precomputed/WithUnsafeAttributes-24      192.0 ± 0%
EndToEndCounterAdd/Filtered/Attributes/1/Dynamic/WithAttributeSet-24              152.0 ± 0%
EndToEndCounterAdd/Filtered/Attributes/1/Dynamic/WithAttributes-24                216.0 ± 0%
EndToEndCounterAdd/Filtered/Attributes/1/Dynamic/WithUnsafeAttributes-24          192.0 ± 0%
EndToEndCounterAdd/Filtered/Attributes/1/Naive/WithAttributes-24                  296.0 ± 0%
EndToEndCounterAdd/Filtered/Attributes/5/Precomputed/WithAttributeSet-24          576.0 ± 0%
EndToEndCounterAdd/Filtered/Attributes/5/Precomputed/WithAttributes-24            576.0 ± 0%
EndToEndCounterAdd/Filtered/Attributes/5/Precomputed/WithUnsafeAttributes-24    1.188Ki ± 0%
EndToEndCounterAdd/Filtered/Attributes/5/Dynamic/WithAttributeSet-24              921.0 ± 0%
EndToEndCounterAdd/Filtered/Attributes/5/Dynamic/WithAttributes-24              1.212Ki ± 0%
EndToEndCounterAdd/Filtered/Attributes/5/Dynamic/WithUnsafeAttributes-24        1.188Ki ± 0%
EndToEndCounterAdd/Filtered/Attributes/5/Naive/WithAttributes-24                1.539Ki ± 0%
EndToEndCounterAdd/Filtered/Attributes/10/Precomputed/WithAttributeSet-24       1.312Ki ± 0%
EndToEndCounterAdd/Filtered/Attributes/10/Precomputed/WithAttributes-24         1.312Ki ± 0%
EndToEndCounterAdd/Filtered/Attributes/10/Precomputed/WithUnsafeAttributes-24   2.688Ki ± 0%
EndToEndCounterAdd/Filtered/Attributes/10/Dynamic/WithAttributeSet-24           2.025Ki ± 0%
EndToEndCounterAdd/Filtered/Attributes/10/Dynamic/WithAttributes-24             2.713Ki ± 0%
EndToEndCounterAdd/Filtered/Attributes/10/Dynamic/WithUnsafeAttributes-24       2.689Ki ± 0%
EndToEndCounterAdd/Filtered/Attributes/10/Naive/WithAttributes-24               3.414Ki ± 0%
geomean                                                                                      ¹
¹ summaries must be >0 to compute geomean

                                                                              │   out.txt    │
                                                                              │  allocs/op   │
EndToEndCounterAdd/NoFilter/Attributes/1/Precomputed/WithAttributeSet-24        0.000 ± 0%
EndToEndCounterAdd/NoFilter/Attributes/1/Precomputed/WithAttributes-24          0.000 ± 0%
EndToEndCounterAdd/NoFilter/Attributes/1/Precomputed/WithUnsafeAttributes-24    2.000 ± 0%
EndToEndCounterAdd/NoFilter/Attributes/1/Dynamic/WithAttributeSet-24            2.000 ± 0%
EndToEndCounterAdd/NoFilter/Attributes/1/Dynamic/WithAttributes-24              3.000 ± 0%
EndToEndCounterAdd/NoFilter/Attributes/1/Dynamic/WithUnsafeAttributes-24        2.000 ± 0%
EndToEndCounterAdd/NoFilter/Attributes/1/Naive/WithAttributes-24                5.000 ± 0%
EndToEndCounterAdd/NoFilter/Attributes/5/Precomputed/WithAttributeSet-24        0.000 ± 0%
EndToEndCounterAdd/NoFilter/Attributes/5/Precomputed/WithAttributes-24          0.000 ± 0%
EndToEndCounterAdd/NoFilter/Attributes/5/Precomputed/WithUnsafeAttributes-24    2.000 ± 0%
EndToEndCounterAdd/NoFilter/Attributes/5/Dynamic/WithAttributeSet-24            2.000 ± 0%
EndToEndCounterAdd/NoFilter/Attributes/5/Dynamic/WithAttributes-24              3.000 ± 0%
EndToEndCounterAdd/NoFilter/Attributes/5/Dynamic/WithUnsafeAttributes-24        2.000 ± 0%
EndToEndCounterAdd/NoFilter/Attributes/5/Naive/WithAttributes-24                5.000 ± 0%
EndToEndCounterAdd/NoFilter/Attributes/10/Precomputed/WithAttributeSet-24       0.000 ± 0%
EndToEndCounterAdd/NoFilter/Attributes/10/Precomputed/WithAttributes-24         0.000 ± 0%
EndToEndCounterAdd/NoFilter/Attributes/10/Precomputed/WithUnsafeAttributes-24   2.000 ± 0%
EndToEndCounterAdd/NoFilter/Attributes/10/Dynamic/WithAttributeSet-24           2.000 ± 0%
EndToEndCounterAdd/NoFilter/Attributes/10/Dynamic/WithAttributes-24             3.000 ± 0%
EndToEndCounterAdd/NoFilter/Attributes/10/Dynamic/WithUnsafeAttributes-24       2.000 ± 0%
EndToEndCounterAdd/NoFilter/Attributes/10/Naive/WithAttributes-24               5.000 ± 0%
EndToEndCounterAdd/Filtered/Attributes/1/Precomputed/WithAttributeSet-24        1.000 ± 0%
EndToEndCounterAdd/Filtered/Attributes/1/Precomputed/WithAttributes-24          1.000 ± 0%
EndToEndCounterAdd/Filtered/Attributes/1/Precomputed/WithUnsafeAttributes-24    3.000 ± 0%
EndToEndCounterAdd/Filtered/Attributes/1/Dynamic/WithAttributeSet-24            3.000 ± 0%
EndToEndCounterAdd/Filtered/Attributes/1/Dynamic/WithAttributes-24              4.000 ± 0%
EndToEndCounterAdd/Filtered/Attributes/1/Dynamic/WithUnsafeAttributes-24        3.000 ± 0%
EndToEndCounterAdd/Filtered/Attributes/1/Naive/WithAttributes-24                6.000 ± 0%
EndToEndCounterAdd/Filtered/Attributes/5/Precomputed/WithAttributeSet-24        2.000 ± 0%
EndToEndCounterAdd/Filtered/Attributes/5/Precomputed/WithAttributes-24          2.000 ± 0%
EndToEndCounterAdd/Filtered/Attributes/5/Precomputed/WithUnsafeAttributes-24    4.000 ± 0%
EndToEndCounterAdd/Filtered/Attributes/5/Dynamic/WithAttributeSet-24            4.000 ± 0%
EndToEndCounterAdd/Filtered/Attributes/5/Dynamic/WithAttributes-24              5.000 ± 0%
EndToEndCounterAdd/Filtered/Attributes/5/Dynamic/WithUnsafeAttributes-24        4.000 ± 0%
EndToEndCounterAdd/Filtered/Attributes/5/Naive/WithAttributes-24                7.000 ± 0%
EndToEndCounterAdd/Filtered/Attributes/10/Precomputed/WithAttributeSet-24       2.000 ± 0%
EndToEndCounterAdd/Filtered/Attributes/10/Precomputed/WithAttributes-24         2.000 ± 0%
EndToEndCounterAdd/Filtered/Attributes/10/Precomputed/WithUnsafeAttributes-24   4.000 ± 0%
EndToEndCounterAdd/Filtered/Attributes/10/Dynamic/WithAttributeSet-24           4.000 ± 0%
EndToEndCounterAdd/Filtered/Attributes/10/Dynamic/WithAttributes-24             5.000 ± 0%
EndToEndCounterAdd/Filtered/Attributes/10/Dynamic/WithUnsafeAttributes-24       4.000 ± 0%
EndToEndCounterAdd/Filtered/Attributes/10/Naive/WithAttributes-24               7.000 ± 0%
geomean                                                                                    ¹
¹ summaries must be >0 to compute geomean

Comment thread CHANGELOG.md Outdated
@dashpole dashpole requested a review from Copilot April 22, 2026 13:48
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 22, 2026

Codecov Report

❌ Patch coverage is 97.77778% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 82.9%. Comparing base (4086701) to head (ca4fd7d).

Files with missing lines Patch % Lines
metric/x/options.go 85.7% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@          Coverage Diff          @@
##            main   #8251   +/-   ##
=====================================
  Coverage   82.9%   82.9%           
=====================================
  Files        314     314           
  Lines      24985   25022   +37     
=====================================
+ Hits       20730   20767   +37     
  Misses      3882    3882           
  Partials     373     373           
Files with missing lines Coverage Δ
sdk/metric/instrument.go 98.1% <100.0%> (+0.5%) ⬆️
sdk/metric/meter.go 92.4% <100.0%> (+0.1%) ⬆️
metric/x/options.go 50.0% <85.7%> (+50.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.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds an experimental WithUnsafeAttributes measurement option (in go.opentelemetry.io/otel/metric/x) and wires the SDK metric recording paths to recognize and merge these raw key-values into the effective attribute.Set used for aggregation.

Changes:

  • Introduce metric/x.WithUnsafeAttributes (and Settable support) to pass a raw []attribute.KeyValue without copying at option construction time.
  • Update sync and async metric recording paths in sdk/metric to extract raw attributes from options and resolve them into a final attribute.Set.
  • Add unit tests and benchmark coverage for the new option; add a changelog entry.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
sdk/metric/meter.go Observable Observe* paths now extract raw attributes and pass a resolved attribute.Set downstream.
sdk/metric/instrument.go Adds raw attribute extraction + merging logic; sync instruments now resolve attributes before aggregation.
sdk/metric/instrument_test.go Adds tests for raw extraction, merging semantics, and end-to-end recording across instrument types.
sdk/metric/benchmark_test.go Adds benchmark cases for WithUnsafeAttributes in precomputed and dynamic scenarios.
metric/x/options.go Adds WithUnsafeAttributes experimental option type + Set support.
metric/x/options_test.go Adds basic test validating raw attribute storage behavior.
CHANGELOG.md Documents the new experimental option.

Comment thread sdk/metric/instrument.go
Comment thread sdk/metric/instrument.go
Comment thread CHANGELOG.md Outdated
Comment thread metric/x/options.go
Comment thread sdk/metric/meter.go
@dashpole dashpole force-pushed the WithUnsafeAttributes branch from 3adf683 to 8619a8f Compare April 22, 2026 18:09
@dashpole dashpole marked this pull request as ready for review April 22, 2026 18:18
dashpole added a commit that referenced this pull request Apr 23, 2026
I had avoided using Settable in our benchmarks in
#8178 because I
thought it would introduce a dependency on the x package in our go.mod
file. But it turns out it doesn't (based on
#8251).

This will make it easier to compare WithAttributeSet to
WithUnsafeAttributes.

```
                                                                          │ before_bench.txt │           after_bench.txt            │
                                                                          │      sec/op      │    sec/op      vs base               │
EndToEndCounterAdd/NoFilter/Attributes/1/Precomputed/WithAttributeSet-24       60.48n ±   7%    61.83n ± 20%        ~ (p=1.000 n=6)
EndToEndCounterAdd/NoFilter/Attributes/1/Precomputed/WithAttributes-24         60.18n ±   9%    65.46n ±  8%        ~ (p=0.065 n=6)
EndToEndCounterAdd/NoFilter/Attributes/1/Dynamic/WithAttributeSet-24           256.2n ±   6%    272.4n ± 18%   +6.34% (p=0.041 n=6)
EndToEndCounterAdd/NoFilter/Attributes/1/Dynamic/WithAttributes-24             311.4n ±  18%    282.4n ± 26%        ~ (p=0.132 n=6)
EndToEndCounterAdd/NoFilter/Attributes/1/Naive/WithAttributes-24               350.4n ±  13%    331.2n ± 45%        ~ (p=0.818 n=6)
EndToEndCounterAdd/NoFilter/Attributes/5/Precomputed/WithAttributeSet-24       64.50n ±  10%    71.22n ± 11%        ~ (p=0.093 n=6)
EndToEndCounterAdd/NoFilter/Attributes/5/Precomputed/WithAttributes-24         61.45n ±  15%    69.04n ± 18%        ~ (p=0.180 n=6)
EndToEndCounterAdd/NoFilter/Attributes/5/Dynamic/WithAttributeSet-24           700.1n ±  36%    776.0n ± 22%        ~ (p=0.394 n=6)
EndToEndCounterAdd/NoFilter/Attributes/5/Dynamic/WithAttributes-24             868.4n ±  14%    738.2n ±  8%  -14.99% (p=0.015 n=6)
EndToEndCounterAdd/NoFilter/Attributes/5/Naive/WithAttributes-24               974.8n ±  19%   1083.5n ± 10%        ~ (p=0.180 n=6)
EndToEndCounterAdd/NoFilter/Attributes/10/Precomputed/WithAttributeSet-24      67.68n ±  15%    64.42n ± 20%        ~ (p=1.000 n=6)
EndToEndCounterAdd/NoFilter/Attributes/10/Precomputed/WithAttributes-24        67.59n ±   7%    63.41n ± 21%        ~ (p=0.937 n=6)
EndToEndCounterAdd/NoFilter/Attributes/10/Dynamic/WithAttributeSet-24          1.310µ ±  27%    1.323µ ± 20%        ~ (p=0.589 n=6)
EndToEndCounterAdd/NoFilter/Attributes/10/Dynamic/WithAttributes-24            2.077µ ±  34%    1.492µ ± 19%  -28.15% (p=0.002 n=6)
EndToEndCounterAdd/NoFilter/Attributes/10/Naive/WithAttributes-24              2.041µ ±  35%    1.977µ ± 43%        ~ (p=0.485 n=6)
EndToEndCounterAdd/Filtered/Attributes/1/Precomputed/WithAttributeSet-24       208.9n ±   7%    214.3n ± 12%        ~ (p=0.784 n=6)
EndToEndCounterAdd/Filtered/Attributes/1/Precomputed/WithAttributes-24         202.5n ±   6%    201.7n ± 19%        ~ (p=0.937 n=6)
EndToEndCounterAdd/Filtered/Attributes/1/Dynamic/WithAttributeSet-24           417.5n ±   7%    403.9n ± 16%        ~ (p=0.394 n=6)
EndToEndCounterAdd/Filtered/Attributes/1/Dynamic/WithAttributes-24             496.8n ±  13%    383.1n ±  8%  -22.89% (p=0.002 n=6)
EndToEndCounterAdd/Filtered/Attributes/1/Naive/WithAttributes-24               542.8n ±  54%    521.7n ± 18%        ~ (p=0.589 n=6)
EndToEndCounterAdd/Filtered/Attributes/5/Precomputed/WithAttributeSet-24       732.6n ±  15%    822.3n ± 23%        ~ (p=0.065 n=6)
EndToEndCounterAdd/Filtered/Attributes/5/Precomputed/WithAttributes-24         803.0n ±  12%    813.9n ± 27%        ~ (p=0.818 n=6)
EndToEndCounterAdd/Filtered/Attributes/5/Dynamic/WithAttributeSet-24           1.389µ ±  28%    1.546µ ± 16%        ~ (p=0.699 n=6)
EndToEndCounterAdd/Filtered/Attributes/5/Dynamic/WithAttributes-24             1.756µ ±  12%    1.399µ ± 12%  -20.36% (p=0.002 n=6)
EndToEndCounterAdd/Filtered/Attributes/5/Naive/WithAttributes-24               1.730µ ±  21%    1.824µ ± 20%        ~ (p=0.818 n=6)
EndToEndCounterAdd/Filtered/Attributes/10/Precomputed/WithAttributeSet-24      5.500µ ± 155%    1.433µ ± 22%  -73.94% (p=0.002 n=6)
EndToEndCounterAdd/Filtered/Attributes/10/Precomputed/WithAttributes-24        2.566µ ±  65%    1.365µ ± 23%  -46.82% (p=0.002 n=6)
EndToEndCounterAdd/Filtered/Attributes/10/Dynamic/WithAttributeSet-24          6.198µ ±  78%    3.188µ ± 14%  -48.57% (p=0.002 n=6)
EndToEndCounterAdd/Filtered/Attributes/10/Dynamic/WithAttributes-24            5.343µ ±  63%    2.963µ ± 10%  -44.55% (p=0.002 n=6)
EndToEndCounterAdd/Filtered/Attributes/10/Naive/WithAttributes-24              4.293µ ± 279%    3.213µ ± 30%        ~ (p=0.065 n=6)
geomean                                                                        591.5n           518.3n        -12.37%

                                                                          │ before_bench.txt │            after_bench.txt            │
                                                                          │       B/op       │     B/op      vs base                 │
EndToEndCounterAdd/NoFilter/Attributes/1/Precomputed/WithAttributeSet-24        0.000 ± 0%       0.000 ± 0%        ~ (p=1.000 n=6) ¹
EndToEndCounterAdd/NoFilter/Attributes/1/Precomputed/WithAttributes-24          0.000 ± 0%       0.000 ± 0%        ~ (p=1.000 n=6) ¹
EndToEndCounterAdd/NoFilter/Attributes/1/Dynamic/WithAttributeSet-24            88.00 ± 0%       64.00 ± 0%  -27.27% (p=0.002 n=6)
EndToEndCounterAdd/NoFilter/Attributes/1/Dynamic/WithAttributes-24             152.00 ± 0%       64.00 ± 0%  -57.89% (p=0.002 n=6)
EndToEndCounterAdd/NoFilter/Attributes/1/Naive/WithAttributes-24                232.0 ± 0%       232.0 ± 0%        ~ (p=1.000 n=6) ¹
EndToEndCounterAdd/NoFilter/Attributes/5/Precomputed/WithAttributeSet-24        0.000 ± 0%       0.000 ± 0%        ~ (p=1.000 n=6) ¹
EndToEndCounterAdd/NoFilter/Attributes/5/Precomputed/WithAttributes-24          0.000 ± 0%       0.000 ± 0%        ~ (p=1.000 n=6) ¹
EndToEndCounterAdd/NoFilter/Attributes/5/Dynamic/WithAttributeSet-24            344.0 ± 0%       320.0 ± 0%   -6.98% (p=0.002 n=6)
EndToEndCounterAdd/NoFilter/Attributes/5/Dynamic/WithAttributes-24              664.0 ± 0%       320.0 ± 0%  -51.81% (p=0.002 n=6)
EndToEndCounterAdd/NoFilter/Attributes/5/Naive/WithAttributes-24               1000.0 ± 0%      1000.0 ± 0%        ~ (p=1.000 n=6) ¹
EndToEndCounterAdd/NoFilter/Attributes/10/Precomputed/WithAttributeSet-24       0.000 ± 0%       0.000 ± 0%        ~ (p=1.000 n=6) ¹
EndToEndCounterAdd/NoFilter/Attributes/10/Precomputed/WithAttributes-24         0.000 ± 0%       0.000 ± 0%        ~ (p=1.000 n=6) ¹
EndToEndCounterAdd/NoFilter/Attributes/10/Dynamic/WithAttributeSet-24           729.0 ± 0%       705.0 ± 0%   -3.29% (p=0.002 n=6)
EndToEndCounterAdd/NoFilter/Attributes/10/Dynamic/WithAttributes-24            1434.0 ± 0%       705.0 ± 0%  -50.84% (p=0.002 n=6)
EndToEndCounterAdd/NoFilter/Attributes/10/Naive/WithAttributes-24             2.102Ki ± 0%     2.102Ki ± 0%        ~ (p=1.000 n=6) ¹
EndToEndCounterAdd/Filtered/Attributes/1/Precomputed/WithAttributeSet-24        64.00 ± 0%       64.00 ± 0%        ~ (p=1.000 n=6) ¹
EndToEndCounterAdd/Filtered/Attributes/1/Precomputed/WithAttributes-24          64.00 ± 0%       64.00 ± 0%        ~ (p=1.000 n=6) ¹
EndToEndCounterAdd/Filtered/Attributes/1/Dynamic/WithAttributeSet-24            152.0 ± 0%       128.0 ± 0%  -15.79% (p=0.002 n=6)
EndToEndCounterAdd/Filtered/Attributes/1/Dynamic/WithAttributes-24              216.0 ± 0%       128.0 ± 0%  -40.74% (p=0.002 n=6)
EndToEndCounterAdd/Filtered/Attributes/1/Naive/WithAttributes-24                296.0 ± 0%       296.0 ± 0%        ~ (p=1.000 n=6) ¹
EndToEndCounterAdd/Filtered/Attributes/5/Precomputed/WithAttributeSet-24        576.0 ± 0%       576.0 ± 0%        ~ (p=1.000 n=6) ¹
EndToEndCounterAdd/Filtered/Attributes/5/Precomputed/WithAttributes-24          576.0 ± 0%       576.0 ± 0%        ~ (p=1.000 n=6) ¹
EndToEndCounterAdd/Filtered/Attributes/5/Dynamic/WithAttributeSet-24            921.0 ± 0%       898.0 ± 0%   -2.50% (p=0.002 n=6)
EndToEndCounterAdd/Filtered/Attributes/5/Dynamic/WithAttributes-24             1241.0 ± 0%       897.0 ± 0%  -27.72% (p=0.002 n=6)
EndToEndCounterAdd/Filtered/Attributes/5/Naive/WithAttributes-24              1.539Ki ± 0%     1.539Ki ± 0%        ~ (p=1.000 n=6) ¹
EndToEndCounterAdd/Filtered/Attributes/10/Precomputed/WithAttributeSet-24     1.312Ki ± 0%     1.312Ki ± 0%        ~ (p=1.000 n=6)
EndToEndCounterAdd/Filtered/Attributes/10/Precomputed/WithAttributes-24       1.312Ki ± 0%     1.312Ki ± 0%        ~ (p=1.000 n=6) ¹
EndToEndCounterAdd/Filtered/Attributes/10/Dynamic/WithAttributeSet-24         2.025Ki ± 0%     2.004Ki ± 0%   -1.06% (p=0.002 n=6)
EndToEndCounterAdd/Filtered/Attributes/10/Dynamic/WithAttributes-24           2.713Ki ± 0%     2.002Ki ± 0%  -26.19% (p=0.002 n=6)
EndToEndCounterAdd/Filtered/Attributes/10/Naive/WithAttributes-24             3.414Ki ± 0%     3.414Ki ± 0%        ~ (p=1.000 n=6)
geomean                                                                                    ²                 -12.74%               ²
¹ all samples are equal
² summaries must be >0 to compute geomean

                                                                          │ before_bench.txt │           after_bench.txt           │
                                                                          │    allocs/op     │ allocs/op   vs base                 │
EndToEndCounterAdd/NoFilter/Attributes/1/Precomputed/WithAttributeSet-24        0.000 ± 0%     0.000 ± 0%        ~ (p=1.000 n=6) ¹
EndToEndCounterAdd/NoFilter/Attributes/1/Precomputed/WithAttributes-24          0.000 ± 0%     0.000 ± 0%        ~ (p=1.000 n=6) ¹
EndToEndCounterAdd/NoFilter/Attributes/1/Dynamic/WithAttributeSet-24            2.000 ± 0%     1.000 ± 0%  -50.00% (p=0.002 n=6)
EndToEndCounterAdd/NoFilter/Attributes/1/Dynamic/WithAttributes-24              3.000 ± 0%     1.000 ± 0%  -66.67% (p=0.002 n=6)
EndToEndCounterAdd/NoFilter/Attributes/1/Naive/WithAttributes-24                5.000 ± 0%     5.000 ± 0%        ~ (p=1.000 n=6) ¹
EndToEndCounterAdd/NoFilter/Attributes/5/Precomputed/WithAttributeSet-24        0.000 ± 0%     0.000 ± 0%        ~ (p=1.000 n=6) ¹
EndToEndCounterAdd/NoFilter/Attributes/5/Precomputed/WithAttributes-24          0.000 ± 0%     0.000 ± 0%        ~ (p=1.000 n=6) ¹
EndToEndCounterAdd/NoFilter/Attributes/5/Dynamic/WithAttributeSet-24            2.000 ± 0%     1.000 ± 0%  -50.00% (p=0.002 n=6)
EndToEndCounterAdd/NoFilter/Attributes/5/Dynamic/WithAttributes-24              3.000 ± 0%     1.000 ± 0%  -66.67% (p=0.002 n=6)
EndToEndCounterAdd/NoFilter/Attributes/5/Naive/WithAttributes-24                5.000 ± 0%     5.000 ± 0%        ~ (p=1.000 n=6) ¹
EndToEndCounterAdd/NoFilter/Attributes/10/Precomputed/WithAttributeSet-24       0.000 ± 0%     0.000 ± 0%        ~ (p=1.000 n=6) ¹
EndToEndCounterAdd/NoFilter/Attributes/10/Precomputed/WithAttributes-24         0.000 ± 0%     0.000 ± 0%        ~ (p=1.000 n=6) ¹
EndToEndCounterAdd/NoFilter/Attributes/10/Dynamic/WithAttributeSet-24           2.000 ± 0%     1.000 ± 0%  -50.00% (p=0.002 n=6)
EndToEndCounterAdd/NoFilter/Attributes/10/Dynamic/WithAttributes-24             3.000 ± 0%     1.000 ± 0%  -66.67% (p=0.002 n=6)
EndToEndCounterAdd/NoFilter/Attributes/10/Naive/WithAttributes-24               5.000 ± 0%     5.000 ± 0%        ~ (p=1.000 n=6) ¹
EndToEndCounterAdd/Filtered/Attributes/1/Precomputed/WithAttributeSet-24        1.000 ± 0%     1.000 ± 0%        ~ (p=1.000 n=6) ¹
EndToEndCounterAdd/Filtered/Attributes/1/Precomputed/WithAttributes-24          1.000 ± 0%     1.000 ± 0%        ~ (p=1.000 n=6) ¹
EndToEndCounterAdd/Filtered/Attributes/1/Dynamic/WithAttributeSet-24            3.000 ± 0%     2.000 ± 0%  -33.33% (p=0.002 n=6)
EndToEndCounterAdd/Filtered/Attributes/1/Dynamic/WithAttributes-24              4.000 ± 0%     2.000 ± 0%  -50.00% (p=0.002 n=6)
EndToEndCounterAdd/Filtered/Attributes/1/Naive/WithAttributes-24                6.000 ± 0%     6.000 ± 0%        ~ (p=1.000 n=6) ¹
EndToEndCounterAdd/Filtered/Attributes/5/Precomputed/WithAttributeSet-24        2.000 ± 0%     2.000 ± 0%        ~ (p=1.000 n=6) ¹
EndToEndCounterAdd/Filtered/Attributes/5/Precomputed/WithAttributes-24          2.000 ± 0%     2.000 ± 0%        ~ (p=1.000 n=6) ¹
EndToEndCounterAdd/Filtered/Attributes/5/Dynamic/WithAttributeSet-24            4.000 ± 0%     3.000 ± 0%  -25.00% (p=0.002 n=6)
EndToEndCounterAdd/Filtered/Attributes/5/Dynamic/WithAttributes-24              5.000 ± 0%     3.000 ± 0%  -40.00% (p=0.002 n=6)
EndToEndCounterAdd/Filtered/Attributes/5/Naive/WithAttributes-24                7.000 ± 0%     7.000 ± 0%        ~ (p=1.000 n=6) ¹
EndToEndCounterAdd/Filtered/Attributes/10/Precomputed/WithAttributeSet-24       2.000 ± 0%     2.000 ± 0%        ~ (p=1.000 n=6) ¹
EndToEndCounterAdd/Filtered/Attributes/10/Precomputed/WithAttributes-24         2.000 ± 0%     2.000 ± 0%        ~ (p=1.000 n=6) ¹
EndToEndCounterAdd/Filtered/Attributes/10/Dynamic/WithAttributeSet-24           4.000 ± 0%     3.000 ± 0%  -25.00% (p=0.002 n=6)
EndToEndCounterAdd/Filtered/Attributes/10/Dynamic/WithAttributes-24             5.000 ± 0%     3.000 ± 0%  -40.00% (p=0.002 n=6)
EndToEndCounterAdd/Filtered/Attributes/10/Naive/WithAttributes-24               7.000 ± 0%     7.000 ± 0%        ~ (p=1.000 n=6) ¹
geomean                                                                                    ²               -23.59%               ²
¹ all samples are equal
² summaries must be >0 to compute geomean
```
pellared pushed a commit to pellared/opentelemetry-go that referenced this pull request Apr 23, 2026
…lemetry#8252)

I had avoided using Settable in our benchmarks in
open-telemetry#8178 because I
thought it would introduce a dependency on the x package in our go.mod
file. But it turns out it doesn't (based on
open-telemetry#8251).

This will make it easier to compare WithAttributeSet to
WithUnsafeAttributes.

```
                                                                          │ before_bench.txt │           after_bench.txt            │
                                                                          │      sec/op      │    sec/op      vs base               │
EndToEndCounterAdd/NoFilter/Attributes/1/Precomputed/WithAttributeSet-24       60.48n ±   7%    61.83n ± 20%        ~ (p=1.000 n=6)
EndToEndCounterAdd/NoFilter/Attributes/1/Precomputed/WithAttributes-24         60.18n ±   9%    65.46n ±  8%        ~ (p=0.065 n=6)
EndToEndCounterAdd/NoFilter/Attributes/1/Dynamic/WithAttributeSet-24           256.2n ±   6%    272.4n ± 18%   +6.34% (p=0.041 n=6)
EndToEndCounterAdd/NoFilter/Attributes/1/Dynamic/WithAttributes-24             311.4n ±  18%    282.4n ± 26%        ~ (p=0.132 n=6)
EndToEndCounterAdd/NoFilter/Attributes/1/Naive/WithAttributes-24               350.4n ±  13%    331.2n ± 45%        ~ (p=0.818 n=6)
EndToEndCounterAdd/NoFilter/Attributes/5/Precomputed/WithAttributeSet-24       64.50n ±  10%    71.22n ± 11%        ~ (p=0.093 n=6)
EndToEndCounterAdd/NoFilter/Attributes/5/Precomputed/WithAttributes-24         61.45n ±  15%    69.04n ± 18%        ~ (p=0.180 n=6)
EndToEndCounterAdd/NoFilter/Attributes/5/Dynamic/WithAttributeSet-24           700.1n ±  36%    776.0n ± 22%        ~ (p=0.394 n=6)
EndToEndCounterAdd/NoFilter/Attributes/5/Dynamic/WithAttributes-24             868.4n ±  14%    738.2n ±  8%  -14.99% (p=0.015 n=6)
EndToEndCounterAdd/NoFilter/Attributes/5/Naive/WithAttributes-24               974.8n ±  19%   1083.5n ± 10%        ~ (p=0.180 n=6)
EndToEndCounterAdd/NoFilter/Attributes/10/Precomputed/WithAttributeSet-24      67.68n ±  15%    64.42n ± 20%        ~ (p=1.000 n=6)
EndToEndCounterAdd/NoFilter/Attributes/10/Precomputed/WithAttributes-24        67.59n ±   7%    63.41n ± 21%        ~ (p=0.937 n=6)
EndToEndCounterAdd/NoFilter/Attributes/10/Dynamic/WithAttributeSet-24          1.310µ ±  27%    1.323µ ± 20%        ~ (p=0.589 n=6)
EndToEndCounterAdd/NoFilter/Attributes/10/Dynamic/WithAttributes-24            2.077µ ±  34%    1.492µ ± 19%  -28.15% (p=0.002 n=6)
EndToEndCounterAdd/NoFilter/Attributes/10/Naive/WithAttributes-24              2.041µ ±  35%    1.977µ ± 43%        ~ (p=0.485 n=6)
EndToEndCounterAdd/Filtered/Attributes/1/Precomputed/WithAttributeSet-24       208.9n ±   7%    214.3n ± 12%        ~ (p=0.784 n=6)
EndToEndCounterAdd/Filtered/Attributes/1/Precomputed/WithAttributes-24         202.5n ±   6%    201.7n ± 19%        ~ (p=0.937 n=6)
EndToEndCounterAdd/Filtered/Attributes/1/Dynamic/WithAttributeSet-24           417.5n ±   7%    403.9n ± 16%        ~ (p=0.394 n=6)
EndToEndCounterAdd/Filtered/Attributes/1/Dynamic/WithAttributes-24             496.8n ±  13%    383.1n ±  8%  -22.89% (p=0.002 n=6)
EndToEndCounterAdd/Filtered/Attributes/1/Naive/WithAttributes-24               542.8n ±  54%    521.7n ± 18%        ~ (p=0.589 n=6)
EndToEndCounterAdd/Filtered/Attributes/5/Precomputed/WithAttributeSet-24       732.6n ±  15%    822.3n ± 23%        ~ (p=0.065 n=6)
EndToEndCounterAdd/Filtered/Attributes/5/Precomputed/WithAttributes-24         803.0n ±  12%    813.9n ± 27%        ~ (p=0.818 n=6)
EndToEndCounterAdd/Filtered/Attributes/5/Dynamic/WithAttributeSet-24           1.389µ ±  28%    1.546µ ± 16%        ~ (p=0.699 n=6)
EndToEndCounterAdd/Filtered/Attributes/5/Dynamic/WithAttributes-24             1.756µ ±  12%    1.399µ ± 12%  -20.36% (p=0.002 n=6)
EndToEndCounterAdd/Filtered/Attributes/5/Naive/WithAttributes-24               1.730µ ±  21%    1.824µ ± 20%        ~ (p=0.818 n=6)
EndToEndCounterAdd/Filtered/Attributes/10/Precomputed/WithAttributeSet-24      5.500µ ± 155%    1.433µ ± 22%  -73.94% (p=0.002 n=6)
EndToEndCounterAdd/Filtered/Attributes/10/Precomputed/WithAttributes-24        2.566µ ±  65%    1.365µ ± 23%  -46.82% (p=0.002 n=6)
EndToEndCounterAdd/Filtered/Attributes/10/Dynamic/WithAttributeSet-24          6.198µ ±  78%    3.188µ ± 14%  -48.57% (p=0.002 n=6)
EndToEndCounterAdd/Filtered/Attributes/10/Dynamic/WithAttributes-24            5.343µ ±  63%    2.963µ ± 10%  -44.55% (p=0.002 n=6)
EndToEndCounterAdd/Filtered/Attributes/10/Naive/WithAttributes-24              4.293µ ± 279%    3.213µ ± 30%        ~ (p=0.065 n=6)
geomean                                                                        591.5n           518.3n        -12.37%

                                                                          │ before_bench.txt │            after_bench.txt            │
                                                                          │       B/op       │     B/op      vs base                 │
EndToEndCounterAdd/NoFilter/Attributes/1/Precomputed/WithAttributeSet-24        0.000 ± 0%       0.000 ± 0%        ~ (p=1.000 n=6) ¹
EndToEndCounterAdd/NoFilter/Attributes/1/Precomputed/WithAttributes-24          0.000 ± 0%       0.000 ± 0%        ~ (p=1.000 n=6) ¹
EndToEndCounterAdd/NoFilter/Attributes/1/Dynamic/WithAttributeSet-24            88.00 ± 0%       64.00 ± 0%  -27.27% (p=0.002 n=6)
EndToEndCounterAdd/NoFilter/Attributes/1/Dynamic/WithAttributes-24             152.00 ± 0%       64.00 ± 0%  -57.89% (p=0.002 n=6)
EndToEndCounterAdd/NoFilter/Attributes/1/Naive/WithAttributes-24                232.0 ± 0%       232.0 ± 0%        ~ (p=1.000 n=6) ¹
EndToEndCounterAdd/NoFilter/Attributes/5/Precomputed/WithAttributeSet-24        0.000 ± 0%       0.000 ± 0%        ~ (p=1.000 n=6) ¹
EndToEndCounterAdd/NoFilter/Attributes/5/Precomputed/WithAttributes-24          0.000 ± 0%       0.000 ± 0%        ~ (p=1.000 n=6) ¹
EndToEndCounterAdd/NoFilter/Attributes/5/Dynamic/WithAttributeSet-24            344.0 ± 0%       320.0 ± 0%   -6.98% (p=0.002 n=6)
EndToEndCounterAdd/NoFilter/Attributes/5/Dynamic/WithAttributes-24              664.0 ± 0%       320.0 ± 0%  -51.81% (p=0.002 n=6)
EndToEndCounterAdd/NoFilter/Attributes/5/Naive/WithAttributes-24               1000.0 ± 0%      1000.0 ± 0%        ~ (p=1.000 n=6) ¹
EndToEndCounterAdd/NoFilter/Attributes/10/Precomputed/WithAttributeSet-24       0.000 ± 0%       0.000 ± 0%        ~ (p=1.000 n=6) ¹
EndToEndCounterAdd/NoFilter/Attributes/10/Precomputed/WithAttributes-24         0.000 ± 0%       0.000 ± 0%        ~ (p=1.000 n=6) ¹
EndToEndCounterAdd/NoFilter/Attributes/10/Dynamic/WithAttributeSet-24           729.0 ± 0%       705.0 ± 0%   -3.29% (p=0.002 n=6)
EndToEndCounterAdd/NoFilter/Attributes/10/Dynamic/WithAttributes-24            1434.0 ± 0%       705.0 ± 0%  -50.84% (p=0.002 n=6)
EndToEndCounterAdd/NoFilter/Attributes/10/Naive/WithAttributes-24             2.102Ki ± 0%     2.102Ki ± 0%        ~ (p=1.000 n=6) ¹
EndToEndCounterAdd/Filtered/Attributes/1/Precomputed/WithAttributeSet-24        64.00 ± 0%       64.00 ± 0%        ~ (p=1.000 n=6) ¹
EndToEndCounterAdd/Filtered/Attributes/1/Precomputed/WithAttributes-24          64.00 ± 0%       64.00 ± 0%        ~ (p=1.000 n=6) ¹
EndToEndCounterAdd/Filtered/Attributes/1/Dynamic/WithAttributeSet-24            152.0 ± 0%       128.0 ± 0%  -15.79% (p=0.002 n=6)
EndToEndCounterAdd/Filtered/Attributes/1/Dynamic/WithAttributes-24              216.0 ± 0%       128.0 ± 0%  -40.74% (p=0.002 n=6)
EndToEndCounterAdd/Filtered/Attributes/1/Naive/WithAttributes-24                296.0 ± 0%       296.0 ± 0%        ~ (p=1.000 n=6) ¹
EndToEndCounterAdd/Filtered/Attributes/5/Precomputed/WithAttributeSet-24        576.0 ± 0%       576.0 ± 0%        ~ (p=1.000 n=6) ¹
EndToEndCounterAdd/Filtered/Attributes/5/Precomputed/WithAttributes-24          576.0 ± 0%       576.0 ± 0%        ~ (p=1.000 n=6) ¹
EndToEndCounterAdd/Filtered/Attributes/5/Dynamic/WithAttributeSet-24            921.0 ± 0%       898.0 ± 0%   -2.50% (p=0.002 n=6)
EndToEndCounterAdd/Filtered/Attributes/5/Dynamic/WithAttributes-24             1241.0 ± 0%       897.0 ± 0%  -27.72% (p=0.002 n=6)
EndToEndCounterAdd/Filtered/Attributes/5/Naive/WithAttributes-24              1.539Ki ± 0%     1.539Ki ± 0%        ~ (p=1.000 n=6) ¹
EndToEndCounterAdd/Filtered/Attributes/10/Precomputed/WithAttributeSet-24     1.312Ki ± 0%     1.312Ki ± 0%        ~ (p=1.000 n=6)
EndToEndCounterAdd/Filtered/Attributes/10/Precomputed/WithAttributes-24       1.312Ki ± 0%     1.312Ki ± 0%        ~ (p=1.000 n=6) ¹
EndToEndCounterAdd/Filtered/Attributes/10/Dynamic/WithAttributeSet-24         2.025Ki ± 0%     2.004Ki ± 0%   -1.06% (p=0.002 n=6)
EndToEndCounterAdd/Filtered/Attributes/10/Dynamic/WithAttributes-24           2.713Ki ± 0%     2.002Ki ± 0%  -26.19% (p=0.002 n=6)
EndToEndCounterAdd/Filtered/Attributes/10/Naive/WithAttributes-24             3.414Ki ± 0%     3.414Ki ± 0%        ~ (p=1.000 n=6)
geomean                                                                                    ²                 -12.74%               ²
¹ all samples are equal
² summaries must be >0 to compute geomean

                                                                          │ before_bench.txt │           after_bench.txt           │
                                                                          │    allocs/op     │ allocs/op   vs base                 │
EndToEndCounterAdd/NoFilter/Attributes/1/Precomputed/WithAttributeSet-24        0.000 ± 0%     0.000 ± 0%        ~ (p=1.000 n=6) ¹
EndToEndCounterAdd/NoFilter/Attributes/1/Precomputed/WithAttributes-24          0.000 ± 0%     0.000 ± 0%        ~ (p=1.000 n=6) ¹
EndToEndCounterAdd/NoFilter/Attributes/1/Dynamic/WithAttributeSet-24            2.000 ± 0%     1.000 ± 0%  -50.00% (p=0.002 n=6)
EndToEndCounterAdd/NoFilter/Attributes/1/Dynamic/WithAttributes-24              3.000 ± 0%     1.000 ± 0%  -66.67% (p=0.002 n=6)
EndToEndCounterAdd/NoFilter/Attributes/1/Naive/WithAttributes-24                5.000 ± 0%     5.000 ± 0%        ~ (p=1.000 n=6) ¹
EndToEndCounterAdd/NoFilter/Attributes/5/Precomputed/WithAttributeSet-24        0.000 ± 0%     0.000 ± 0%        ~ (p=1.000 n=6) ¹
EndToEndCounterAdd/NoFilter/Attributes/5/Precomputed/WithAttributes-24          0.000 ± 0%     0.000 ± 0%        ~ (p=1.000 n=6) ¹
EndToEndCounterAdd/NoFilter/Attributes/5/Dynamic/WithAttributeSet-24            2.000 ± 0%     1.000 ± 0%  -50.00% (p=0.002 n=6)
EndToEndCounterAdd/NoFilter/Attributes/5/Dynamic/WithAttributes-24              3.000 ± 0%     1.000 ± 0%  -66.67% (p=0.002 n=6)
EndToEndCounterAdd/NoFilter/Attributes/5/Naive/WithAttributes-24                5.000 ± 0%     5.000 ± 0%        ~ (p=1.000 n=6) ¹
EndToEndCounterAdd/NoFilter/Attributes/10/Precomputed/WithAttributeSet-24       0.000 ± 0%     0.000 ± 0%        ~ (p=1.000 n=6) ¹
EndToEndCounterAdd/NoFilter/Attributes/10/Precomputed/WithAttributes-24         0.000 ± 0%     0.000 ± 0%        ~ (p=1.000 n=6) ¹
EndToEndCounterAdd/NoFilter/Attributes/10/Dynamic/WithAttributeSet-24           2.000 ± 0%     1.000 ± 0%  -50.00% (p=0.002 n=6)
EndToEndCounterAdd/NoFilter/Attributes/10/Dynamic/WithAttributes-24             3.000 ± 0%     1.000 ± 0%  -66.67% (p=0.002 n=6)
EndToEndCounterAdd/NoFilter/Attributes/10/Naive/WithAttributes-24               5.000 ± 0%     5.000 ± 0%        ~ (p=1.000 n=6) ¹
EndToEndCounterAdd/Filtered/Attributes/1/Precomputed/WithAttributeSet-24        1.000 ± 0%     1.000 ± 0%        ~ (p=1.000 n=6) ¹
EndToEndCounterAdd/Filtered/Attributes/1/Precomputed/WithAttributes-24          1.000 ± 0%     1.000 ± 0%        ~ (p=1.000 n=6) ¹
EndToEndCounterAdd/Filtered/Attributes/1/Dynamic/WithAttributeSet-24            3.000 ± 0%     2.000 ± 0%  -33.33% (p=0.002 n=6)
EndToEndCounterAdd/Filtered/Attributes/1/Dynamic/WithAttributes-24              4.000 ± 0%     2.000 ± 0%  -50.00% (p=0.002 n=6)
EndToEndCounterAdd/Filtered/Attributes/1/Naive/WithAttributes-24                6.000 ± 0%     6.000 ± 0%        ~ (p=1.000 n=6) ¹
EndToEndCounterAdd/Filtered/Attributes/5/Precomputed/WithAttributeSet-24        2.000 ± 0%     2.000 ± 0%        ~ (p=1.000 n=6) ¹
EndToEndCounterAdd/Filtered/Attributes/5/Precomputed/WithAttributes-24          2.000 ± 0%     2.000 ± 0%        ~ (p=1.000 n=6) ¹
EndToEndCounterAdd/Filtered/Attributes/5/Dynamic/WithAttributeSet-24            4.000 ± 0%     3.000 ± 0%  -25.00% (p=0.002 n=6)
EndToEndCounterAdd/Filtered/Attributes/5/Dynamic/WithAttributes-24              5.000 ± 0%     3.000 ± 0%  -40.00% (p=0.002 n=6)
EndToEndCounterAdd/Filtered/Attributes/5/Naive/WithAttributes-24                7.000 ± 0%     7.000 ± 0%        ~ (p=1.000 n=6) ¹
EndToEndCounterAdd/Filtered/Attributes/10/Precomputed/WithAttributeSet-24       2.000 ± 0%     2.000 ± 0%        ~ (p=1.000 n=6) ¹
EndToEndCounterAdd/Filtered/Attributes/10/Precomputed/WithAttributes-24         2.000 ± 0%     2.000 ± 0%        ~ (p=1.000 n=6) ¹
EndToEndCounterAdd/Filtered/Attributes/10/Dynamic/WithAttributeSet-24           4.000 ± 0%     3.000 ± 0%  -25.00% (p=0.002 n=6)
EndToEndCounterAdd/Filtered/Attributes/10/Dynamic/WithAttributes-24             5.000 ± 0%     3.000 ± 0%  -40.00% (p=0.002 n=6)
EndToEndCounterAdd/Filtered/Attributes/10/Naive/WithAttributes-24               7.000 ± 0%     7.000 ± 0%        ~ (p=1.000 n=6) ¹
geomean                                                                                    ²               -23.59%               ²
¹ all samples are equal
² summaries must be >0 to compute geomean
```
Comment thread sdk/metric/instrument.go
@dashpole dashpole force-pushed the WithUnsafeAttributes branch from 794cd9a to a9fdc3c Compare May 1, 2026 17:46
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.

3 participants