You've already forked opentelemetry-go
mirror of
https://github.com/open-telemetry/opentelemetry-go.git
synced 2026-06-03 18:35:08 +02:00
8bc88510d3
Follow-up to https://github.com/open-telemetry/opentelemetry-go/pull/8211. Because the exemplar reservoir is an interface, it can't be in-lined even when it is a no-op, so it has significant overhead. Skip it when a drop reservoir is used. This seems to have an overhead of something like ~10ns, which shows up mostly on the precomputed benchmarks. Benchmarks ``` goarch: amd64 pkg: go.opentelemetry.io/otel/sdk/metric cpu: Intel(R) Xeon(R) CPU @ 2.20GHz │ benchmark_results_before.txt │ benchmark_results_after.txt │ │ sec/op │ sec/op vs base │ EndToEndCounterAdd/NoFilter/Attributes/1/Precomputed/WithAttributeSet-24 62.65n ± 15% 54.59n ± 12% -12.88% (p=0.026 n=6) EndToEndCounterAdd/NoFilter/Attributes/1/Precomputed/WithAttributes-24 63.67n ± 10% 52.21n ± 6% -17.99% (p=0.002 n=6) EndToEndCounterAdd/NoFilter/Attributes/1/Dynamic/WithAttributeSet-24 238.8n ± 14% 240.0n ± 10% ~ (p=1.000 n=6) EndToEndCounterAdd/NoFilter/Attributes/1/Dynamic/WithAttributes-24 220.7n ± 14% 245.6n ± 13% ~ (p=0.180 n=6) EndToEndCounterAdd/NoFilter/Attributes/1/Naive/WithAttributes-24 373.4n ± 26% 352.9n ± 11% ~ (p=0.240 n=6) EndToEndCounterAdd/NoFilter/Attributes/5/Precomputed/WithAttributeSet-24 69.73n ± 16% 48.85n ± 14% -29.94% (p=0.002 n=6) EndToEndCounterAdd/NoFilter/Attributes/5/Precomputed/WithAttributes-24 61.32n ± 3% 49.01n ± 5% -20.08% (p=0.002 n=6) EndToEndCounterAdd/NoFilter/Attributes/5/Dynamic/WithAttributeSet-24 988.4n ± 48% 759.9n ± 55% -23.12% (p=0.041 n=6) EndToEndCounterAdd/NoFilter/Attributes/5/Dynamic/WithAttributes-24 954.1n ± 90% 667.9n ± 19% -30.00% (p=0.002 n=6) EndToEndCounterAdd/NoFilter/Attributes/5/Naive/WithAttributes-24 1.515µ ± 32% 1.233µ ± 12% ~ (p=0.240 n=6) EndToEndCounterAdd/NoFilter/Attributes/10/Precomputed/WithAttributeSet-24 70.86n ± 11% 53.90n ± 16% -23.94% (p=0.002 n=6) EndToEndCounterAdd/NoFilter/Attributes/10/Precomputed/WithAttributes-24 69.20n ± 21% 48.95n ± 12% -29.27% (p=0.004 n=6) EndToEndCounterAdd/NoFilter/Attributes/10/Dynamic/WithAttributeSet-24 1.483µ ± 28% 1.283µ ± 29% ~ (p=0.310 n=6) EndToEndCounterAdd/NoFilter/Attributes/10/Dynamic/WithAttributes-24 1.421µ ± 41% 1.664µ ± 49% ~ (p=0.394 n=6) EndToEndCounterAdd/NoFilter/Attributes/10/Naive/WithAttributes-24 2.784µ ± 66% 2.109µ ± 19% -24.23% (p=0.041 n=6) geomean 299.2n 252.1n -15.75% ``` --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>