1
0
mirror of https://github.com/open-telemetry/opentelemetry-go.git synced 2025-11-23 22:34:47 +02:00
Files
opentelemetry-go/sdk/trace
Tyler Yahn 9798759463 Statically define trace observability attributes (#7263)
There are a finite set of attributes that can be recorded with self
observability instruments. Cache these combinations to avoid computation
and allocations on the hot-path of tracing.

### Benchmarks

```console
$ benchstat main_25d02741f.txt cache-trace-obs-sets_05fd6ee.txt
goos: linux
goarch: amd64
pkg: go.opentelemetry.io/otel/sdk/trace
cpu: Intel(R) Core(TM) i7-8550U CPU @ 1.80GHz
                                      │ main_25d02741f.txt │  cache-trace-obs-sets_05fd6ee.txt   │
                                      │       sec/op       │   sec/op     vs base                │
SpanEnd/SelfObservabilityEnabled-8             366.2n ± 5%   229.2n ± 3%  -37.39% (p=0.000 n=10)
TraceStart/SelfObservabilityEnabled-8         1076.0n ± 2%   800.2n ± 2%  -25.63% (p=0.000 n=10)
geomean                                        627.7n        428.3n       -31.76%

                                      │ main_25d02741f.txt │  cache-trace-obs-sets_05fd6ee.txt  │
                                      │        B/op        │    B/op     vs base                │
SpanEnd/SelfObservabilityEnabled-8             192.00 ± 0%   64.00 ± 0%  -66.67% (p=0.000 n=10)
TraceStart/SelfObservabilityEnabled-8           992.0 ± 0%   608.0 ± 0%  -38.71% (p=0.000 n=10)
geomean                                         436.4        197.3       -54.80%

                                      │ main_25d02741f.txt │  cache-trace-obs-sets_05fd6ee.txt  │
                                      │     allocs/op      │ allocs/op   vs base                │
SpanEnd/SelfObservabilityEnabled-8              4.000 ± 0%   2.000 ± 0%  -50.00% (p=0.000 n=10)
TraceStart/SelfObservabilityEnabled-8           9.000 ± 0%   5.000 ± 0%  -44.44% (p=0.000 n=10)
geomean                                         6.000        3.162       -47.30%
```
2025-08-29 08:36:54 -07:00
..
2025-07-29 10:19:11 +02:00
2025-07-29 10:19:11 +02:00

SDK Trace

PkgGoDev