← Back to Pull requests

sdk/metric: add metric.WithAllowKeyDuplication #8709

Closed
Mujib-Ahasan closed this pull request without merging on Oct 19, 2026 21:48 UTC
View on GitHub
Mujib-Ahasan Mujib-Ahasan commented on Aug 06, 2026 19:39 UTC
Author

Adds WithAllowKeyDuplication() to sdk/metric as a MeterProvider to opt out of the attribute map key deduplication( introduced: https://github.com/open-telemetry/opentelemetry-go/pull/8471)

fixes: #8479

Benchmarks


goos: darwin
goarch: arm64
pkg: go.opentelemetry.io/otel/sdk/metric
cpu: Apple M4
                                                    │   enabled    │              disabled               │
                                                   │    sec/op    │   sec/op     vs base                │
MeasureKeyDuplication/op=Add/dupMapKeys=no-10        163.05n ± 1%   48.68n ± 0%  -70.15% (p=0.000 n=10)
MeasureKeyDuplication/op=Add/dupMapKeys=yes-10       346.00n ± 1%   48.77n ± 0%  -85.90% (p=0.000 n=10)
MeasureKeyDuplication/op=Record/dupMapKeys=no-10     170.40n ± 0%   54.61n ± 0%  -67.95% (p=0.000 n=10)
MeasureKeyDuplication/op=Record/dupMapKeys=yes-10    358.20n ± 0%   54.49n ± 1%  -84.79% (p=0.000 n=10)
MeasureKeyDuplication/op=Observe/dupMapKeys=no-10     436.9n ± 0%   317.2n ± 1%  -27.40% (p=0.000 n=10)
MeasureKeyDuplication/op=Observe/dupMapKeys=yes-10    632.2n ± 0%   317.5n ± 0%  -49.78% (p=0.000 n=10)
geomean                                               313.6n        94.48n       -69.87%

                                                   │   enabled    │                disabled                 │
                                                   │     B/op     │    B/op     vs base                     │
MeasureKeyDuplication/op=Add/dupMapKeys=no-10        0.000 ± 0%     0.000 ± 0%         ~ (p=1.000 n=10) ¹
MeasureKeyDuplication/op=Add/dupMapKeys=yes-10       576.0 ± 0%       0.0 ± 0%  -100.00% (p=0.000 n=10)
MeasureKeyDuplication/op=Record/dupMapKeys=no-10     0.000 ± 0%     0.000 ± 0%         ~ (p=1.000 n=10) ¹
MeasureKeyDuplication/op=Record/dupMapKeys=yes-10    576.0 ± 0%       0.0 ± 0%  -100.00% (p=0.000 n=10)
MeasureKeyDuplication/op=Observe/dupMapKeys=no-10    416.0 ± 0%     416.0 ± 0%         ~ (p=1.000 n=10) ¹
MeasureKeyDuplication/op=Observe/dupMapKeys=yes-10   992.0 ± 0%     416.0 ± 0%   -58.06% (p=0.000 n=10)
geomean                                                         ²               ?                       ² ³
¹ all samples are equal
² summaries must be >0 to compute geomean
³ ratios must be >0 to compute geomean

                                                   │    enabled    │                disabled                 │
                                                   │   allocs/op   │ allocs/op   vs base                     │
MeasureKeyDuplication/op=Add/dupMapKeys=no-10         0.000 ± 0%     0.000 ± 0%         ~ (p=1.000 n=10) ¹
MeasureKeyDuplication/op=Add/dupMapKeys=yes-10        4.000 ± 0%     0.000 ± 0%  -100.00% (p=0.000 n=10)
MeasureKeyDuplication/op=Record/dupMapKeys=no-10      0.000 ± 0%     0.000 ± 0%         ~ (p=1.000 n=10) ¹
MeasureKeyDuplication/op=Record/dupMapKeys=yes-10     4.000 ± 0%     0.000 ± 0%  -100.00% (p=0.000 n=10)
MeasureKeyDuplication/op=Observe/dupMapKeys=no-10     8.000 ± 0%     8.000 ± 0%         ~ (p=1.000 n=10) ¹
MeasureKeyDuplication/op=Observe/dupMapKeys=yes-10   12.000 ± 0%     8.000 ± 0%   -33.33% (p=0.000 n=10)
geomean                                                          ²               ?                       ² ³

| Operation | Deduplication | Keys | ns/op | B/op | allocs/op |
|-----------|---------------|----------------------|------:|-----:|----------:|
| Add | Enabled | With Duplicates | 533.9 | 1000 | 8 |
| Add | Disabled | With Duplicates | 234.2 | 424 | 4 |
| Add | Enabled | Without Duplicates | 353.1 | 424 | 4 |
| Add | Disabled | Without Duplicates | 233.3 | 424 | 4 |
| Record | Enabled | With Duplicates | 543.0 | 1000 | 8 |
| Record | Disabled | With Duplicates | 245.4 | 424 | 4 |
| Record | Enabled | Without Duplicates | 365.0 | 424 | 4 |
| Record | Disabled | Without Duplicates | 244.5 | 424 | 4 |
| Observe | Enabled | With Duplicates | 619.1 | 1000 | 8 |
| Observe | Disabled | With Duplicates | 308.1 | 424 | 4 |
| Observe | Enabled | Without Duplicates | 440.2 | 424 | 4 |
| Observe | Disabled | Without Duplicates | 307.2 | 424 | 4 |

With duplicate map keys (opt-in benefit):

  • ns/op: −56% (Add), −55% (Record), −50% (Observe)

  • B/op: −57.6% (all operations)

  • allocs/op: −50% (all operations)
  • Without duplicate map keys:

  • ns/op: −34% (Add), −33% (Record), −30% (Observe)

  • B/op and allocs/op: no change.
  • main vs head benchstat


    goos: darwin
    goarch: arm64
    pkg: go.opentelemetry.io/otel/sdk/metric
    cpu: Apple M4
                                                                                            │ /tmp/main.txt │           /tmp/branch.txt           │
                                                                                            │    sec/op     │    sec/op     vs base               │
    SyncMeasure/NoView/ExemplarsDisabled/Int64Counter/Attributes/0-10                          54.05n ±  2%   53.16n ±  0%  -1.65% (p=0.000 n=10)
    SyncMeasure/NoView/ExemplarsDisabled/Int64Counter/Attributes/10-10                         66.39n ±  1%   65.98n ±  0%  -0.63% (p=0.011 n=10)
    SyncMeasure/NoView/ExemplarsDisabled/Int64Gauge/Attributes/0-10                            55.31n ±  0%   54.57n ±  1%  -1.36% (p=0.000 n=10)
    SyncMeasure/NoView/ExemplarsDisabled/Int64Gauge/Attributes/10-10                           53.14n ±  1%   53.22n ±  1%       ~ (p=0.217 n=10)
    SyncMeasure/NoView/ExemplarsDisabled/Int64Histogram/Attributes/0-10                        175.7n ±  0%   175.9n ±  0%  +0.14% (p=0.002 n=10)
    SyncMeasure/NoView/ExemplarsDisabled/Int64Histogram/Attributes/10-10                       113.1n ±  1%   112.6n ±  0%  -0.44% (p=0.000 n=10)
    SyncMeasure/NoView/ExemplarsDisabled/ExponentialInt64Histogram/Attributes/0-10             166.1n ±  1%   164.2n ±  0%  -1.14% (p=0.001 n=10)
    SyncMeasure/NoView/ExemplarsDisabled/ExponentialInt64Histogram/Attributes/10-10            243.2n ±  1%   243.2n ±  1%       ~ (p=0.616 n=10)
    SyncMeasure/NoView/ExemplarsEnabled/Int64Counter/Attributes/0-10                           156.7n ±  1%   158.5n ±  1%  +1.15% (p=0.027 n=10)
    SyncMeasure/NoView/ExemplarsEnabled/Int64Counter/Attributes/10-10                          229.4n ±  4%   229.6n ±  4%       ~ (p=0.739 n=10)
    SyncMeasure/NoView/ExemplarsEnabled/Int64Gauge/Attributes/0-10                             123.9n ±  2%   125.2n ±  1%  +1.09% (p=0.001 n=10)
    SyncMeasure/NoView/ExemplarsEnabled/Int64Gauge/Attributes/10-10                            154.2n ±  1%   155.8n ±  1%  +1.04% (p=0.008 n=10)
    SyncMeasure/NoView/ExemplarsEnabled/Int64Histogram/Attributes/0-10                         180.8n ±  1%   181.2n ±  0%  +0.22% (p=0.000 n=10)
    SyncMeasure/NoView/ExemplarsEnabled/Int64Histogram/Attributes/10-10                        124.2n ±  4%   120.1n ±  2%  -3.30% (p=0.037 n=10)
    SyncMeasure/NoView/ExemplarsEnabled/ExponentialInt64Histogram/Attributes/0-10              247.8n ±  3%   265.1n ±  9%  +7.00% (p=0.015 n=10)
    SyncMeasure/NoView/ExemplarsEnabled/ExponentialInt64Histogram/Attributes/10-10             365.7n ±  1%   386.9n ±  2%  +5.83% (p=0.000 n=10)
    SyncMeasure/DropView/ExemplarsDisabled/Int64Counter/Attributes/0-10                        2.882n ±  1%   3.135n ±  2%  +8.78% (p=0.000 n=10)
    SyncMeasure/DropView/ExemplarsDisabled/Int64Counter/Attributes/10-10                       35.13n ±  2%   35.52n ±  1%       ~ (p=0.165 n=10)
    SyncMeasure/DropView/ExemplarsDisabled/Int64Gauge/Attributes/0-10                          2.941n ±  2%   3.223n ±  1%  +9.59% (p=0.000 n=10)
    SyncMeasure/DropView/ExemplarsDisabled/Int64Gauge/Attributes/10-10                         34.98n ±  1%   35.03n ±  1%       ~ (p=0.684 n=10)
    SyncMeasure/DropView/ExemplarsDisabled/Int64Histogram/Attributes/0-10                      3.050n ±  1%   3.253n ±  1%  +6.67% (p=0.000 n=10)
    SyncMeasure/DropView/ExemplarsDisabled/Int64Histogram/Attributes/10-10                     37.50n ± 10%   34.51n ±  1%  -7.97% (p=0.000 n=10)
    SyncMeasure/DropView/ExemplarsDisabled/ExponentialInt64Histogram/Attributes/0-10           2.892n ±  1%   3.068n ±  1%  +6.09% (p=0.000 n=10)
    SyncMeasure/DropView/ExemplarsDisabled/ExponentialInt64Histogram/Attributes/10-10          34.22n ±  2%   34.27n ±  1%       ~ (p=0.912 n=10)
    SyncMeasure/DropView/ExemplarsEnabled/Int64Counter/Attributes/0-10                         2.832n ±  1%   3.023n ±  2%  +6.76% (p=0.000 n=10)
    SyncMeasure/DropView/ExemplarsEnabled/Int64Counter/Attributes/10-10                        34.01n ±  1%   34.16n ±  1%       ~ (p=0.247 n=10)
    SyncMeasure/DropView/ExemplarsEnabled/Int64Gauge/Attributes/0-10                           2.865n ±  2%   3.075n ±  1%  +7.33% (p=0.000 n=10)
    SyncMeasure/DropView/ExemplarsEnabled/Int64Gauge/Attributes/10-10                          34.06n ±  1%   34.09n ±  1%       ~ (p=0.699 n=10)
    SyncMeasure/DropView/ExemplarsEnabled/Int64Histogram/Attributes/0-10                       3.030n ±  2%   3.176n ±  1%  +4.80% (p=0.000 n=10)
    SyncMeasure/DropView/ExemplarsEnabled/Int64Histogram/Attributes/10-10                      34.61n ±  2%   33.66n ±  1%  -2.72% (p=0.000 n=10)
    SyncMeasure/DropView/ExemplarsEnabled/ExponentialInt64Histogram/Attributes/0-10            2.973n ±  2%   3.094n ±  1%  +4.07% (p=0.000 n=10)
    SyncMeasure/DropView/ExemplarsEnabled/ExponentialInt64Histogram/Attributes/10-10           34.45n ±  1%   34.16n ±  2%       ~ (p=0.052 n=10)
    SyncMeasure/AttrFilterView/ExemplarsDisabled/Int64Counter/Attributes/0-10                  53.84n ±  0%   53.11n ±  0%  -1.37% (p=0.000 n=10)
    SyncMeasure/AttrFilterView/ExemplarsDisabled/Int64Counter/Attributes/10-10                 117.7n ±  4%   109.1n ±  2%  -7.35% (p=0.000 n=10)
    SyncMeasure/AttrFilterView/ExemplarsDisabled/Int64Gauge/Attributes/0-10                    63.99n ±  6%   61.76n ±  3%  -3.49% (p=0.000 n=10)
    SyncMeasure/AttrFilterView/ExemplarsDisabled/Int64Gauge/Attributes/10-10                   110.9n ±  2%   104.4n ±  1%  -5.82% (p=0.000 n=10)
    SyncMeasure/AttrFilterView/ExemplarsDisabled/Int64Histogram/Attributes/0-10                175.8n ±  1%   176.1n ±  0%  +0.20% (p=0.002 n=10)
    SyncMeasure/AttrFilterView/ExemplarsDisabled/Int64Histogram/Attributes/10-10               148.6n ± 11%   144.8n ± 14%       ~ (p=0.089 n=10)
    SyncMeasure/AttrFilterView/ExemplarsDisabled/ExponentialInt64Histogram/Attributes/0-10     225.5n ±  2%   218.5n ±  1%  -3.08% (p=0.000 n=10)
    SyncMeasure/AttrFilterView/ExemplarsDisabled/ExponentialInt64Histogram/Attributes/10-10    400.8n ±  2%   387.3n ±  1%  -3.36% (p=0.000 n=10)
    SyncMeasure/AttrFilterView/ExemplarsEnabled/Int64Counter/Attributes/0-10                   197.2n ±  2%   193.9n ±  1%  -1.67% (p=0.015 n=10)
    SyncMeasure/AttrFilterView/ExemplarsEnabled/Int64Counter/Attributes/10-10                  436.9n ±  1%   431.9n ±  0%  -1.16% (p=0.000 n=10)
    SyncMeasure/AttrFilterView/ExemplarsEnabled/Int64Gauge/Attributes/0-10                     187.7n ±  1%   187.5n ±  1%       ~ (p=0.239 n=10)
    SyncMeasure/AttrFilterView/ExemplarsEnabled/Int64Gauge/Attributes/10-10                    325.2n ±  4%   313.5n ±  1%  -3.61% (p=0.000 n=10)
    SyncMeasure/AttrFilterView/ExemplarsEnabled/Int64Histogram/Attributes/0-10                 181.1n ±  0%   181.3n ±  0%  +0.11% (p=0.002 n=10)
    SyncMeasure/AttrFilterView/ExemplarsEnabled/Int64Histogram/Attributes/10-10                356.1n ±  3%   337.1n ±  3%  -5.31% (p=0.001 n=10)
    SyncMeasure/AttrFilterView/ExemplarsEnabled/ExponentialInt64Histogram/Attributes/0-10      289.7n ±  4%   271.9n ±  1%  -6.13% (p=0.000 n=10)
    SyncMeasure/AttrFilterView/ExemplarsEnabled/ExponentialInt64Histogram/Attributes/10-10     677.9n ±  1%   662.1n ±  1%  -2.33% (p=0.000 n=10)
    EndToEndCounterAdd/NoFilter/Precomputed/WithAttributeSet-10                                76.42n ±  0%   77.05n ±  3%       ~ (p=0.565 n=10)
    EndToEndCounterAdd/NoFilter/Precomputed/WithAttributes-10                                  76.00n ±  0%   75.69n ±  2%       ~ (p=0.684 n=10)
    EndToEndCounterAdd/NoFilter/Precomputed/WithUnsafeAttributes-10                            474.4n ±  1%   462.7n ±  1%  -2.46% (p=0.000 n=10)
    EndToEndCounterAdd/NoFilter/Dynamic/WithAttributeSet-10                                    400.4n ±  1%   396.0n ±  1%  -1.12% (p=0.001 n=10)
    EndToEndCounterAdd/NoFilter/Dynamic/WithAttributes-10                                      398.3n ±  1%   394.8n ±  1%       ~ (p=0.060 n=10)
    EndToEndCounterAdd/NoFilter/Dynamic/WithUnsafeAttributes-10                                527.2n ±  0%   524.8n ±  0%  -0.45% (p=0.004 n=10)
    EndToEndCounterAdd/NoFilter/Naive/WithAttributes-10                                        529.7n ±  0%   529.6n ±  1%       ~ (p=0.896 n=10)
    EndToEndCounterAdd/Filtered/Precomputed/WithAttributeSet-10                                134.7n ±  2%   136.4n ±  1%  +1.22% (p=0.002 n=10)
    EndToEndCounterAdd/Filtered/Dynamic/WithAttributeSet-10                                    460.1n ±  1%   469.3n ±  1%  +2.01% (p=0.000 n=10)
    MeasureNewAttributeSet/AlwaysOn/Int64Counter-10                                            315.4n ±  0%   315.9n ±  0%       ~ (p=0.196 n=10)
    MeasureNewAttributeSet/AlwaysOn/Int64Histogram-10                                          548.4n ±  1%   549.8n ±  0%       ~ (p=0.325 n=10)
    MeasureNewAttributeSet/AlwaysOff/Int64Counter-10                                           194.1n ±  0%   195.8n ±  0%  +0.90% (p=0.000 n=10)
    MeasureNewAttributeSet/AlwaysOff/Int64Histogram-10                                         214.6n ±  0%   215.2n ±  0%  +0.28% (p=0.002 n=10)
    AsyncMeasureNewAttributeSet/AlwaysOn-10                                                    866.3n ±  0%   862.7n ±  0%  -0.42% (p=0.004 n=10)
    AsyncMeasureNewAttributeSet/TraceBased-10                                                  451.1n ±  1%   451.2n ±  0%       ~ (p=0.985 n=10)
    geomean                                                                                    94.07n         94.10n        +0.03%
    
                                                                                            │ /tmp/main.txt  │            /tmp/branch.txt            │
                                                                                            │      B/op      │     B/op      vs base                 │
    SyncMeasure/NoView/ExemplarsDisabled/Int64Counter/Attributes/0-10                           0.000 ± 0%       0.000 ± 0%       ~ (p=1.000 n=10) ¹
    SyncMeasure/NoView/ExemplarsDisabled/Int64Counter/Attributes/10-10                          0.000 ± 0%       0.000 ± 0%       ~ (p=1.000 n=10) ¹
    SyncMeasure/NoView/ExemplarsDisabled/Int64Gauge/Attributes/0-10                             0.000 ± 0%       0.000 ± 0%       ~ (p=1.000 n=10) ¹
    SyncMeasure/NoView/ExemplarsDisabled/Int64Gauge/Attributes/10-10                            0.000 ± 0%       0.000 ± 0%       ~ (p=1.000 n=10) ¹
    SyncMeasure/NoView/ExemplarsDisabled/Int64Histogram/Attributes/0-10                         0.000 ± 0%       0.000 ± 0%       ~ (p=1.000 n=10) ¹
    SyncMeasure/NoView/ExemplarsDisabled/Int64Histogram/Attributes/10-10                        0.000 ± 0%       0.000 ± 0%       ~ (p=1.000 n=10) ¹
    SyncMeasure/NoView/ExemplarsDisabled/ExponentialInt64Histogram/Attributes/0-10              0.000 ± 0%       0.000 ± 0%       ~ (p=1.000 n=10) ¹
    SyncMeasure/NoView/ExemplarsDisabled/ExponentialInt64Histogram/Attributes/10-10             0.000 ± 0%       0.000 ± 0%       ~ (p=1.000 n=10) ¹
    SyncMeasure/NoView/ExemplarsEnabled/Int64Counter/Attributes/0-10                            0.000 ± 0%       0.000 ± 0%       ~ (p=1.000 n=10) ¹
    SyncMeasure/NoView/ExemplarsEnabled/Int64Counter/Attributes/10-10                           0.000 ± 0%       0.000 ± 0%       ~ (p=1.000 n=10) ¹
    SyncMeasure/NoView/ExemplarsEnabled/Int64Gauge/Attributes/0-10                              0.000 ± 0%       0.000 ± 0%       ~ (p=1.000 n=10) ¹
    SyncMeasure/NoView/ExemplarsEnabled/Int64Gauge/Attributes/10-10                             0.000 ± 0%       0.000 ± 0%       ~ (p=1.000 n=10) ¹
    SyncMeasure/NoView/ExemplarsEnabled/Int64Histogram/Attributes/0-10                          0.000 ± 0%       0.000 ± 0%       ~ (p=1.000 n=10) ¹
    SyncMeasure/NoView/ExemplarsEnabled/Int64Histogram/Attributes/10-10                         0.000 ± 0%       0.000 ± 0%       ~ (p=1.000 n=10) ¹
    SyncMeasure/NoView/ExemplarsEnabled/ExponentialInt64Histogram/Attributes/0-10               0.000 ± 0%       0.000 ± 0%       ~ (p=1.000 n=10) ¹
    SyncMeasure/NoView/ExemplarsEnabled/ExponentialInt64Histogram/Attributes/10-10              0.000 ± 0%       0.000 ± 0%       ~ (p=1.000 n=10) ¹
    SyncMeasure/DropView/ExemplarsDisabled/Int64Counter/Attributes/0-10                         0.000 ± 0%       0.000 ± 0%       ~ (p=1.000 n=10) ¹
    SyncMeasure/DropView/ExemplarsDisabled/Int64Counter/Attributes/10-10                        0.000 ± 0%       0.000 ± 0%       ~ (p=1.000 n=10) ¹
    SyncMeasure/DropView/ExemplarsDisabled/Int64Gauge/Attributes/0-10                           0.000 ± 0%       0.000 ± 0%       ~ (p=1.000 n=10) ¹
    SyncMeasure/DropView/ExemplarsDisabled/Int64Gauge/Attributes/10-10                          0.000 ± 0%       0.000 ± 0%       ~ (p=1.000 n=10) ¹
    SyncMeasure/DropView/ExemplarsDisabled/Int64Histogram/Attributes/0-10                       0.000 ± 0%       0.000 ± 0%       ~ (p=1.000 n=10) ¹
    SyncMeasure/DropView/ExemplarsDisabled/Int64Histogram/Attributes/10-10                      0.000 ± 0%       0.000 ± 0%       ~ (p=1.000 n=10) ¹
    SyncMeasure/DropView/ExemplarsDisabled/ExponentialInt64Histogram/Attributes/0-10            0.000 ± 0%       0.000 ± 0%       ~ (p=1.000 n=10) ¹
    SyncMeasure/DropView/ExemplarsDisabled/ExponentialInt64Histogram/Attributes/10-10           0.000 ± 0%       0.000 ± 0%       ~ (p=1.000 n=10) ¹
    SyncMeasure/DropView/ExemplarsEnabled/Int64Counter/Attributes/0-10                          0.000 ± 0%       0.000 ± 0%       ~ (p=1.000 n=10) ¹
    SyncMeasure/DropView/ExemplarsEnabled/Int64Counter/Attributes/10-10                         0.000 ± 0%       0.000 ± 0%       ~ (p=1.000 n=10) ¹
    SyncMeasure/DropView/ExemplarsEnabled/Int64Gauge/Attributes/0-10                            0.000 ± 0%       0.000 ± 0%       ~ (p=1.000 n=10) ¹
    SyncMeasure/DropView/ExemplarsEnabled/Int64Gauge/Attributes/10-10                           0.000 ± 0%       0.000 ± 0%       ~ (p=1.000 n=10) ¹
    SyncMeasure/DropView/ExemplarsEnabled/Int64Histogram/Attributes/0-10                        0.000 ± 0%       0.000 ± 0%       ~ (p=1.000 n=10) ¹
    SyncMeasure/DropView/ExemplarsEnabled/Int64Histogram/Attributes/10-10                       0.000 ± 0%       0.000 ± 0%       ~ (p=1.000 n=10) ¹
    SyncMeasure/DropView/ExemplarsEnabled/ExponentialInt64Histogram/Attributes/0-10             0.000 ± 0%       0.000 ± 0%       ~ (p=1.000 n=10) ¹
    SyncMeasure/DropView/ExemplarsEnabled/ExponentialInt64Histogram/Attributes/10-10            0.000 ± 0%       0.000 ± 0%       ~ (p=1.000 n=10) ¹
    SyncMeasure/AttrFilterView/ExemplarsDisabled/Int64Counter/Attributes/0-10                   0.000 ± 0%       0.000 ± 0%       ~ (p=1.000 n=10) ¹
    SyncMeasure/AttrFilterView/ExemplarsDisabled/Int64Counter/Attributes/10-10                  0.000 ± 0%       0.000 ± 0%       ~ (p=1.000 n=10) ¹
    SyncMeasure/AttrFilterView/ExemplarsDisabled/Int64Gauge/Attributes/0-10                     0.000 ± 0%       0.000 ± 0%       ~ (p=1.000 n=10) ¹
    SyncMeasure/AttrFilterView/ExemplarsDisabled/Int64Gauge/Attributes/10-10                    0.000 ± 0%       0.000 ± 0%       ~ (p=1.000 n=10) ¹
    SyncMeasure/AttrFilterView/ExemplarsDisabled/Int64Histogram/Attributes/0-10                 0.000 ± 0%       0.000 ± 0%       ~ (p=1.000 n=10) ¹
    SyncMeasure/AttrFilterView/ExemplarsDisabled/Int64Histogram/Attributes/10-10                0.000 ± 0%       0.000 ± 0%       ~ (p=1.000 n=10) ¹
    SyncMeasure/AttrFilterView/ExemplarsDisabled/ExponentialInt64Histogram/Attributes/0-10      0.000 ± 0%       0.000 ± 0%       ~ (p=1.000 n=10) ¹
    SyncMeasure/AttrFilterView/ExemplarsDisabled/ExponentialInt64Histogram/Attributes/10-10     0.000 ± 0%       0.000 ± 0%       ~ (p=1.000 n=10) ¹
    SyncMeasure/AttrFilterView/ExemplarsEnabled/Int64Counter/Attributes/0-10                    0.000 ± 0%       0.000 ± 0%       ~ (p=1.000 n=10) ¹
    SyncMeasure/AttrFilterView/ExemplarsEnabled/Int64Counter/Attributes/10-10                   640.0 ± 0%       640.0 ± 0%       ~ (p=1.000 n=10) ¹
    SyncMeasure/AttrFilterView/ExemplarsEnabled/Int64Gauge/Attributes/0-10                      0.000 ± 0%       0.000 ± 0%       ~ (p=1.000 n=10) ¹
    SyncMeasure/AttrFilterView/ExemplarsEnabled/Int64Gauge/Attributes/10-10                     640.0 ± 0%       640.0 ± 0%       ~ (p=1.000 n=10) ¹
    SyncMeasure/AttrFilterView/ExemplarsEnabled/Int64Histogram/Attributes/0-10                  0.000 ± 0%       0.000 ± 0%       ~ (p=1.000 n=10) ¹
    SyncMeasure/AttrFilterView/ExemplarsEnabled/Int64Histogram/Attributes/10-10                 640.0 ± 0%       640.0 ± 0%       ~ (p=1.000 n=10) ¹
    SyncMeasure/AttrFilterView/ExemplarsEnabled/ExponentialInt64Histogram/Attributes/0-10       0.000 ± 0%       0.000 ± 0%       ~ (p=1.000 n=10) ¹
    SyncMeasure/AttrFilterView/ExemplarsEnabled/ExponentialInt64Histogram/Attributes/10-10      640.0 ± 0%       640.0 ± 0%       ~ (p=1.000 n=10) ¹
    EndToEndCounterAdd/NoFilter/Precomputed/WithAttributeSet-10                                 0.000 ± 0%       0.000 ± 0%       ~ (p=1.000 n=10) ¹
    EndToEndCounterAdd/NoFilter/Precomputed/WithAttributes-10                                   0.000 ± 0%       0.000 ± 0%       ~ (p=1.000 n=10) ¹
    EndToEndCounterAdd/NoFilter/Precomputed/WithUnsafeAttributes-10                           1.375Ki ± 0%     1.375Ki ± 0%       ~ (p=1.000 n=10) ¹
    EndToEndCounterAdd/NoFilter/Dynamic/WithAttributeSet-10                                     705.0 ± 0%       705.0 ± 0%       ~ (p=1.000 n=10) ¹
    EndToEndCounterAdd/NoFilter/Dynamic/WithAttributes-10                                       705.0 ± 0%       705.0 ± 0%       ~ (p=1.000 n=10) ¹
    EndToEndCounterAdd/NoFilter/Dynamic/WithUnsafeAttributes-10                               1.376Ki ± 0%     1.376Ki ± 0%       ~ (p=1.000 n=10) ¹
    EndToEndCounterAdd/NoFilter/Naive/WithAttributes-10                                       1.414Ki ± 0%     1.414Ki ± 0%       ~ (p=1.000 n=10) ¹
    EndToEndCounterAdd/Filtered/Precomputed/WithAttributeSet-10                                 0.000 ± 0%       0.000 ± 0%       ~ (p=1.000 n=10) ¹
    EndToEndCounterAdd/Filtered/Dynamic/WithAttributeSet-10                                     705.0 ± 0%       705.0 ± 0%       ~ (p=1.000 n=10) ¹
    MeasureNewAttributeSet/AlwaysOn/Int64Counter-10                                             516.0 ± 0%       516.0 ± 0%       ~ (p=1.000 n=10) ¹
    MeasureNewAttributeSet/AlwaysOn/Int64Histogram-10                                           926.0 ± 0%       927.0 ± 0%       ~ (p=0.337 n=10)
    MeasureNewAttributeSet/AlwaysOff/Int64Counter-10                                            208.0 ± 0%       208.0 ± 0%       ~ (p=0.474 n=10)
    MeasureNewAttributeSet/AlwaysOff/Int64Histogram-10                                          289.0 ± 0%       289.0 ± 0%       ~ (p=1.000 n=10)
    AsyncMeasureNewAttributeSet/AlwaysOn-10                                                   2.095Ki ± 0%     2.095Ki ± 0%       ~ (p=1.000 n=10) ¹
    AsyncMeasureNewAttributeSet/TraceBased-10                                                   608.0 ± 0%       608.0 ± 0%       ~ (p=1.000 n=10) ¹
    geomean                                                                                                ²                 +0.00%                ²
    ¹ all samples are equal
    ² summaries must be >0 to compute geomean
    
                                                                                            │ /tmp/main.txt │           /tmp/branch.txt           │
                                                                                            │   allocs/op   │ allocs/op   vs base                 │
    SyncMeasure/NoView/ExemplarsDisabled/Int64Counter/Attributes/0-10                          0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=10) ¹
    SyncMeasure/NoView/ExemplarsDisabled/Int64Counter/Attributes/10-10                         0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=10) ¹
    SyncMeasure/NoView/ExemplarsDisabled/Int64Gauge/Attributes/0-10                            0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=10) ¹
    SyncMeasure/NoView/ExemplarsDisabled/Int64Gauge/Attributes/10-10                           0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=10) ¹
    SyncMeasure/NoView/ExemplarsDisabled/Int64Histogram/Attributes/0-10                        0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=10) ¹
    SyncMeasure/NoView/ExemplarsDisabled/Int64Histogram/Attributes/10-10                       0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=10) ¹
    SyncMeasure/NoView/ExemplarsDisabled/ExponentialInt64Histogram/Attributes/0-10             0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=10) ¹
    SyncMeasure/NoView/ExemplarsDisabled/ExponentialInt64Histogram/Attributes/10-10            0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=10) ¹
    SyncMeasure/NoView/ExemplarsEnabled/Int64Counter/Attributes/0-10                           0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=10) ¹
    SyncMeasure/NoView/ExemplarsEnabled/Int64Counter/Attributes/10-10                          0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=10) ¹
    SyncMeasure/NoView/ExemplarsEnabled/Int64Gauge/Attributes/0-10                             0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=10) ¹
    SyncMeasure/NoView/ExemplarsEnabled/Int64Gauge/Attributes/10-10                            0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=10) ¹
    SyncMeasure/NoView/ExemplarsEnabled/Int64Histogram/Attributes/0-10                         0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=10) ¹
    SyncMeasure/NoView/ExemplarsEnabled/Int64Histogram/Attributes/10-10                        0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=10) ¹
    SyncMeasure/NoView/ExemplarsEnabled/ExponentialInt64Histogram/Attributes/0-10              0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=10) ¹
    SyncMeasure/NoView/ExemplarsEnabled/ExponentialInt64Histogram/Attributes/10-10             0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=10) ¹
    SyncMeasure/DropView/ExemplarsDisabled/Int64Counter/Attributes/0-10                        0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=10) ¹
    SyncMeasure/DropView/ExemplarsDisabled/Int64Counter/Attributes/10-10                       0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=10) ¹
    SyncMeasure/DropView/ExemplarsDisabled/Int64Gauge/Attributes/0-10                          0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=10) ¹
    SyncMeasure/DropView/ExemplarsDisabled/Int64Gauge/Attributes/10-10                         0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=10) ¹
    SyncMeasure/DropView/ExemplarsDisabled/Int64Histogram/Attributes/0-10                      0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=10) ¹
    SyncMeasure/DropView/ExemplarsDisabled/Int64Histogram/Attributes/10-10                     0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=10) ¹
    SyncMeasure/DropView/ExemplarsDisabled/ExponentialInt64Histogram/Attributes/0-10           0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=10) ¹
    SyncMeasure/DropView/ExemplarsDisabled/ExponentialInt64Histogram/Attributes/10-10          0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=10) ¹
    SyncMeasure/DropView/ExemplarsEnabled/Int64Counter/Attributes/0-10                         0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=10) ¹
    SyncMeasure/DropView/ExemplarsEnabled/Int64Counter/Attributes/10-10                        0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=10) ¹
    SyncMeasure/DropView/ExemplarsEnabled/Int64Gauge/Attributes/0-10                           0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=10) ¹
    SyncMeasure/DropView/ExemplarsEnabled/Int64Gauge/Attributes/10-10                          0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=10) ¹
    SyncMeasure/DropView/ExemplarsEnabled/Int64Histogram/Attributes/0-10                       0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=10) ¹
    SyncMeasure/DropView/ExemplarsEnabled/Int64Histogram/Attributes/10-10                      0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=10) ¹
    SyncMeasure/DropView/ExemplarsEnabled/ExponentialInt64Histogram/Attributes/0-10            0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=10) ¹
    SyncMeasure/DropView/ExemplarsEnabled/ExponentialInt64Histogram/Attributes/10-10           0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=10) ¹
    SyncMeasure/AttrFilterView/ExemplarsDisabled/Int64Counter/Attributes/0-10                  0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=10) ¹
    SyncMeasure/AttrFilterView/ExemplarsDisabled/Int64Counter/Attributes/10-10                 0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=10) ¹
    SyncMeasure/AttrFilterView/ExemplarsDisabled/Int64Gauge/Attributes/0-10                    0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=10) ¹
    SyncMeasure/AttrFilterView/ExemplarsDisabled/Int64Gauge/Attributes/10-10                   0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=10) ¹
    SyncMeasure/AttrFilterView/ExemplarsDisabled/Int64Histogram/Attributes/0-10                0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=10) ¹
    SyncMeasure/AttrFilterView/ExemplarsDisabled/Int64Histogram/Attributes/10-10               0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=10) ¹
    SyncMeasure/AttrFilterView/ExemplarsDisabled/ExponentialInt64Histogram/Attributes/0-10     0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=10) ¹
    SyncMeasure/AttrFilterView/ExemplarsDisabled/ExponentialInt64Histogram/Attributes/10-10    0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=10) ¹
    SyncMeasure/AttrFilterView/ExemplarsEnabled/Int64Counter/Attributes/0-10                   0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=10) ¹
    SyncMeasure/AttrFilterView/ExemplarsEnabled/Int64Counter/Attributes/10-10                  1.000 ± 0%     1.000 ± 0%       ~ (p=1.000 n=10) ¹
    SyncMeasure/AttrFilterView/ExemplarsEnabled/Int64Gauge/Attributes/0-10                     0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=10) ¹
    SyncMeasure/AttrFilterView/ExemplarsEnabled/Int64Gauge/Attributes/10-10                    1.000 ± 0%     1.000 ± 0%       ~ (p=1.000 n=10) ¹
    SyncMeasure/AttrFilterView/ExemplarsEnabled/Int64Histogram/Attributes/0-10                 0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=10) ¹
    SyncMeasure/AttrFilterView/ExemplarsEnabled/Int64Histogram/Attributes/10-10                1.000 ± 0%     1.000 ± 0%       ~ (p=1.000 n=10) ¹
    SyncMeasure/AttrFilterView/ExemplarsEnabled/ExponentialInt64Histogram/Attributes/0-10      0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=10) ¹
    SyncMeasure/AttrFilterView/ExemplarsEnabled/ExponentialInt64Histogram/Attributes/10-10     1.000 ± 0%     1.000 ± 0%       ~ (p=1.000 n=10) ¹
    EndToEndCounterAdd/NoFilter/Precomputed/WithAttributeSet-10                                0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=10) ¹
    EndToEndCounterAdd/NoFilter/Precomputed/WithAttributes-10                                  0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=10) ¹
    EndToEndCounterAdd/NoFilter/Precomputed/WithUnsafeAttributes-10                            2.000 ± 0%     2.000 ± 0%       ~ (p=1.000 n=10) ¹
    EndToEndCounterAdd/NoFilter/Dynamic/WithAttributeSet-10                                    1.000 ± 0%     1.000 ± 0%       ~ (p=1.000 n=10) ¹
    EndToEndCounterAdd/NoFilter/Dynamic/WithAttributes-10                                      1.000 ± 0%     1.000 ± 0%       ~ (p=1.000 n=10) ¹
    EndToEndCounterAdd/NoFilter/Dynamic/WithUnsafeAttributes-10                                2.000 ± 0%     2.000 ± 0%       ~ (p=1.000 n=10) ¹
    EndToEndCounterAdd/NoFilter/Naive/WithAttributes-10                                        4.000 ± 0%     4.000 ± 0%       ~ (p=1.000 n=10) ¹
    EndToEndCounterAdd/Filtered/Precomputed/WithAttributeSet-10                                0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=10) ¹
    EndToEndCounterAdd/Filtered/Dynamic/WithAttributeSet-10                                    1.000 ± 0%     1.000 ± 0%       ~ (p=1.000 n=10) ¹
    MeasureNewAttributeSet/AlwaysOn/Int64Counter-10                                            5.000 ± 0%     5.000 ± 0%       ~ (p=1.000 n=10) ¹
    MeasureNewAttributeSet/AlwaysOn/Int64Histogram-10                                          5.000 ± 0%     5.000 ± 0%       ~ (p=1.000 n=10) ¹
    MeasureNewAttributeSet/AlwaysOff/Int64Counter-10                                           4.000 ± 0%     4.000 ± 0%       ~ (p=1.000 n=10) ¹
    MeasureNewAttributeSet/AlwaysOff/Int64Histogram-10                                         5.000 ± 0%     5.000 ± 0%       ~ (p=1.000 n=10) ¹
    AsyncMeasureNewAttributeSet/AlwaysOn-10                                                    15.00 ± 0%     15.00 ± 0%       ~ (p=1.000 n=10) ¹
    AsyncMeasureNewAttributeSet/TraceBased-10                                                  12.00 ± 0%     12.00 ± 0%       ~ (p=1.000 n=10) ¹
    geomean                                                                                               ²               +0.00%                ²
    

    Diff: 447 lines (+399 / -48) across 8 files Reviewer: MrAlias Review duration: 106689m
    All Vouch review confidence checks passed
    Residual risk 0.08 = Change Risk (0.50) × (1 − Review Confidence (0.84)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.50 · 447 lines diff across 8 files
    0.50
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.73 · 5 substantive comment(s)
    0.73
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 50%
    84%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.365
    Real PR Conversation Timeline
    12 items
    codecov[bot] codecov[bot] commented on Aug 07, 2026 20:02 UTC
    Bot

    Codecov Report


    :white_check_mark: All modified and coverable lines are covered by tests.
    :white_check_mark: Project coverage is 84.1%. Comparing base (ec606c3) to head (10c5eda).
    :warning: Report is 15 commits behind head on main.

    <details><summary>Additional details and impacted files</summary>

    ![Impacted file tree graph](https://app.codecov.io/gh/open-telemetry/opentelemetry-go/pull/8709?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=open-telemetry)

    @@          Coverage Diff          @@
    ##            main   #8709   +/-   ##
    =====================================
      Coverage   84.0%   84.1%           
    =====================================
      Files        329     329           
      Lines      26068   26110   +42     
    =====================================
    + Hits       21918   21961   +43     
    + Misses      3769    3768    -1     
      Partials     381     381           
    

    | Files with missing lines | Coverage Δ | |
    |---|---|---|
    | sdk/metric/config.go | 95.5% <100.0%> (+0.2%) | :arrow_up: |
    | sdk/metric/instrument.go | 98.4% <100.0%> (+0.2%) | :arrow_up: |
    | sdk/metric/meter.go | 92.7% <100.0%> (+0.2%) | :arrow_up: |
    | sdk/metric/provider.go | 100.0% <100.0%> (ø) | |

    ... and 3 files with indirect coverage changes
    </details>
    <details><summary> :rocket: New features to boost your workflow: </summary>

  • :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

  • </details>

    MrAlias MrAlias commented on Aug 11, 2026 15:05 UTC
    Contributor

    Please fix lint and coverage, then align naming and semantics with #8488.

    MrAlias MrAlias commented on code on Aug 12, 2026 00:07 UTC
    Code Review
    sdk/metric/benchmark_test.go:1
    @@ -748,6 +748,112 @@ func BenchmarkMeasureNewAttributeSet(b *testing.B) {
     	}
     }
     
    +var (
    +	benchAttrs = []attribute.KeyValue{
    +		attribute.String("user", "Robin"),
    +		attribute.Bool("admin", true),
    +		attribute.Map(
    +			"map",
    +			attribute.String("key1", "value1"),
    +			attribute.String("key2", "value2"),
    +		),
    +	}
    +	benchAttrsDupMapKeys = []attribute.KeyValue{
    +		attribute.String("user", "Robin"),
    +		attribute.Bool("admin", true),
    +		attribute.Map(
    +			"map",
    +			attribute.String("key", "first"),
    +			attribute.String("key", "second"),
    +		),
    +	}
    +)
    +
    +func BenchmarkMeasureKeyDuplication(b *testing.B) {
    +	ctx := b.Context()
    +
    +	operations := []struct {
    +		name string
    +		make func(b *testing.B, meter metric.Meter) func(attrs []attribute.KeyValue)
    +	}{
    +		{
    +			name: "op=Add",
    +			make: func(b *testing.B, meter metric.Meter) func(attrs []attribute.KeyValue) {
    +				cnt, err := meter.Int64Counter("int64-counter")
    +				assert.NoError(b, err)
    +				return func(attrs []attribute.KeyValue) {
    +					cnt.Add(ctx, 1, metric.WithAttributes(attrs...))
    +				}
    +			},
    +		},
    +		{
    +			name: "op=Record",
    +			make: func(b *testing.B, meter metric.Meter) func(attrs []attribute.KeyValue) {
    +				hist, err := meter.Int64Histogram("int64-histogram")
    +				assert.NoError(b, err)
    +				return func(attrs []attribute.KeyValue) {
    +					hist.Record(ctx, 1, metric.WithAttributes(attrs...))
    +				}
    +			},
    +		},
    +		{
    +			name: "op=Observe",
    +			make: func(b *testing.B, meter metric.Meter) func(attrs []attribute.KeyValue) {
    +				gauge, err := meter.Int64ObservableGauge("int64-observable-gauge")
    +				assert.NoError(b, err)
    +				var obs metric.Observer
    +				reg, err := meter.RegisterCallback(func(_ context.Context, o metric.Observer) error {
    +					obs = o
    +					return nil
    +				}, gauge)
    +				assert.NoError(b, err)
    +				b.Cleanup(func() { assert.NoError(b, reg.Unregister()) })
    +				return func(attrs []attribute.KeyValue) {
    +					obs.ObserveInt64(gauge, 1, metric.WithAttributes(attrs...))

    metric.Observer is captured from the callback and used after Collect returns. observer.ObserveInt64 assumes pipeline.produce still holds the pipeline guard, so this measures an unsupported lifetime rather than the asynchronous API path.

    Could we keep the observation inside the callback and benchmark collection, or make this an explicit internal resolver microbenchmark?

    MrAlias MrAlias commented on code on Aug 12, 2026 00:07 UTC
    Code Review
    sdk/metric/instrument.go:1
    @@ -240,12 +251,20 @@ var (
     func (i *int64Inst) Add(ctx context.Context, val int64, opts ...metric.AddOption) {
     	c := metric.NewAddConfig(opts)
     	rawKVs := extractRawKVs(opts)
    +	if i.allowDupKeys {

    allowDupKeys now adds dispatch to every default-path measurement, but the posted results compare two configurations in the same head build. They cannot show whether the unchanged default regresses relative to main.

    Could we add main-versus-head benchstat for the default configuration before settling on this dispatch shape? This is the comparison required for a performance-critical hot-path change.

    MrAlias MrAlias commented on Aug 12, 2026 00:07 UTC
    Reviewer

    The behavior is consistently wired across the metric paths, but the performance evidence still needs to represent supported async use and establish that the default hot path has not regressed.

    Mujib-Ahasan Mujib-Ahasan commented on code on Aug 12, 2026 18:21 UTC
    Code Review
    sdk/metric/benchmark_test.go:1
    @@ -748,6 +748,112 @@ func BenchmarkMeasureNewAttributeSet(b *testing.B) {
     	}
     }
     
    +var (
    +	benchAttrs = []attribute.KeyValue{
    +		attribute.String("user", "Robin"),
    +		attribute.Bool("admin", true),
    +		attribute.Map(
    +			"map",
    +			attribute.String("key1", "value1"),
    +			attribute.String("key2", "value2"),
    +		),
    +	}
    +	benchAttrsDupMapKeys = []attribute.KeyValue{
    +		attribute.String("user", "Robin"),
    +		attribute.Bool("admin", true),
    +		attribute.Map(
    +			"map",
    +			attribute.String("key", "first"),
    +			attribute.String("key", "second"),
    +		),
    +	}
    +)
    +
    +func BenchmarkMeasureKeyDuplication(b *testing.B) {
    +	ctx := b.Context()
    +
    +	operations := []struct {
    +		name string
    +		make func(b *testing.B, meter metric.Meter) func(attrs []attribute.KeyValue)
    +	}{
    +		{
    +			name: "op=Add",
    +			make: func(b *testing.B, meter metric.Meter) func(attrs []attribute.KeyValue) {
    +				cnt, err := meter.Int64Counter("int64-counter")
    +				assert.NoError(b, err)
    +				return func(attrs []attribute.KeyValue) {
    +					cnt.Add(ctx, 1, metric.WithAttributes(attrs...))
    +				}
    +			},
    +		},
    +		{
    +			name: "op=Record",
    +			make: func(b *testing.B, meter metric.Meter) func(attrs []attribute.KeyValue) {
    +				hist, err := meter.Int64Histogram("int64-histogram")
    +				assert.NoError(b, err)
    +				return func(attrs []attribute.KeyValue) {
    +					hist.Record(ctx, 1, metric.WithAttributes(attrs...))
    +				}
    +			},
    +		},
    +		{
    +			name: "op=Observe",
    +			make: func(b *testing.B, meter metric.Meter) func(attrs []attribute.KeyValue) {
    +				gauge, err := meter.Int64ObservableGauge("int64-observable-gauge")
    +				assert.NoError(b, err)
    +				var obs metric.Observer
    +				reg, err := meter.RegisterCallback(func(_ context.Context, o metric.Observer) error {
    +					obs = o
    +					return nil
    +				}, gauge)
    +				assert.NoError(b, err)
    +				b.Cleanup(func() { assert.NoError(b, reg.Unregister()) })
    +				return func(attrs []attribute.KeyValue) {
    +					obs.ObserveInt64(gauge, 1, metric.WithAttributes(attrs...))

    yup!! I can see the problem here. I shoudl keep the observation inside a WithInt64Callback and the benchmark measures reader.Collect. Thanks!

    Mujib-Ahasan Mujib-Ahasan commented on code on Aug 12, 2026 18:23 UTC
    Code Review
    sdk/metric/instrument.go:1
    @@ -240,12 +251,20 @@ var (
     func (i *int64Inst) Add(ctx context.Context, val int64, opts ...metric.AddOption) {
     	c := metric.NewAddConfig(opts)
     	rawKVs := extractRawKVs(opts)
    +	if i.allowDupKeys {

    yupp! updated the PR with fresh main vs head benchstat

    Mujib-Ahasan Mujib-Ahasan commented on Aug 26, 2026 16:30 UTC
    Author

    just a gentle ping- @MrAlias, can I get some reviews here whenever you get a chance!!

    opentelemetry-pr-dashboard[bot] opentelemetry-pr-dashboard[bot] commented on Oct 13, 2026 17:41 UTC
    Bot

    <!-- pull-request-dashboard-status -->
    <!-- pull-request-dashboard-status-revision:21 -->

    Pull request dashboard status

    Closed · refreshed 2026-10-19 21:49 UTC

    <details>
    <summary>Status above doesn't look right?</summary>

    <br>

  • Anything look wrong? Report it with what you expected; it helps us improve the dashboard.
  • </details>

    chethanm99 chethanm99 commented on Oct 18, 2026 02:32 UTC
    Contributor

    Hey @Mujib-Ahasan I believe you should first resolve the conflicts in the PR, then ask for review, that will be helpful for maintainers while reviewing.

    Mujib-Ahasan Mujib-Ahasan commented on Oct 19, 2026 21:48 UTC
    Author

    This PR have not seen much review interest over the past three months and Im finding it difficult to stay motivated to continue working on it without any signals from the maintainers! Happy to revisit it if there is renewed interest. For now I am closing this PR.

    Reviewers
    Assignees
    Mujib-Ahasan Mujib-Ahasan
    Labels
    risk: low confidence: 84.3% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 49.8% (MEDIUM) · Higher = larger blast radius
    49.8%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 84.3% · Lower = rushed or shallow review
    84.3%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 7.8% · Safe to merge
    7.8%