Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[improvement] Tracer spans are inexpensive for unsampled operations (#…
…180) ## Before this PR Operations which are fast in the common case were infeasible to trace because regardless of the trace rate, span creation performance was worse than the operation being measured. ``` Benchmark (observability) Mode Cnt Score Error Units TracingBenchmark.nestedSpans SAMPLE avgt 3 39710.354 ± 36443.873 ns/op TracingBenchmark.nestedSpans:·gc.alloc.rate SAMPLE avgt 3 3425.430 ± 3215.533 MB/sec TracingBenchmark.nestedSpans:·gc.alloc.rate.norm SAMPLE avgt 3 41560.021 ± 0.434 B/op TracingBenchmark.nestedSpans:·gc.churn.PS_Eden_Space SAMPLE avgt 3 3444.571 ± 3116.221 MB/sec TracingBenchmark.nestedSpans:·gc.churn.PS_Eden_Space.norm SAMPLE avgt 3 41795.982 ± 7880.516 B/op TracingBenchmark.nestedSpans:·gc.churn.PS_Survivor_Space SAMPLE avgt 3 0.386 ± 2.219 MB/sec TracingBenchmark.nestedSpans:·gc.churn.PS_Survivor_Space.norm SAMPLE avgt 3 4.741 ± 30.088 B/op TracingBenchmark.nestedSpans:·gc.count SAMPLE avgt 3 137.000 counts TracingBenchmark.nestedSpans:·gc.time SAMPLE avgt 3 87.000 ms TracingBenchmark.nestedSpans DO_NOT_SAMPLE avgt 3 19958.082 ± 6584.116 ns/op TracingBenchmark.nestedSpans:·gc.alloc.rate DO_NOT_SAMPLE avgt 3 3506.264 ± 1147.188 MB/sec TracingBenchmark.nestedSpans:·gc.alloc.rate.norm DO_NOT_SAMPLE avgt 3 21416.011 ± 0.230 B/op TracingBenchmark.nestedSpans:·gc.churn.PS_Eden_Space DO_NOT_SAMPLE avgt 3 3547.447 ± 1525.303 MB/sec TracingBenchmark.nestedSpans:·gc.churn.PS_Eden_Space.norm DO_NOT_SAMPLE avgt 3 21666.731 ± 4251.611 B/op TracingBenchmark.nestedSpans:·gc.churn.PS_Survivor_Space DO_NOT_SAMPLE avgt 3 0.383 ± 0.331 MB/sec TracingBenchmark.nestedSpans:·gc.churn.PS_Survivor_Space.norm DO_NOT_SAMPLE avgt 3 2.341 ± 1.300 B/op TracingBenchmark.nestedSpans:·gc.count DO_NOT_SAMPLE avgt 3 139.000 counts TracingBenchmark.nestedSpans:·gc.time DO_NOT_SAMPLE avgt 3 86.000 ms TracingBenchmark.nestedSpans UNDECIDED avgt 3 22570.008 ± 7874.344 ns/op TracingBenchmark.nestedSpans:·gc.alloc.rate UNDECIDED avgt 3 3590.635 ± 1268.870 MB/sec TracingBenchmark.nestedSpans:·gc.alloc.rate.norm UNDECIDED avgt 3 24792.658 ± 44.976 B/op TracingBenchmark.nestedSpans:·gc.churn.PS_Eden_Space UNDECIDED avgt 3 3674.586 ± 3668.504 MB/sec TracingBenchmark.nestedSpans:·gc.churn.PS_Eden_Space.norm UNDECIDED avgt 3 25360.986 ± 16430.980 B/op TracingBenchmark.nestedSpans:·gc.churn.PS_Survivor_Space UNDECIDED avgt 3 0.217 ± 2.148 MB/sec TracingBenchmark.nestedSpans:·gc.churn.PS_Survivor_Space.norm UNDECIDED avgt 3 1.509 ± 15.297 B/op TracingBenchmark.nestedSpans:·gc.count UNDECIDED avgt 3 90.000 counts TracingBenchmark.nestedSpans:·gc.time UNDECIDED avgt 3 58.000 ms ``` ## After this PR Added `Tracer.fastStartSpan` which can effectively no-op for unsampled operations. ``` Benchmark (observability) Mode Cnt Score Error Units TracingBenchmark.nestedSpans SAMPLE avgt 3 37969.436 ± 25282.797 ns/op TracingBenchmark.nestedSpans:·gc.alloc.rate SAMPLE avgt 3 3475.679 ± 2277.025 MB/sec TracingBenchmark.nestedSpans:·gc.alloc.rate.norm SAMPLE avgt 3 40360.062 ± 1.751 B/op TracingBenchmark.nestedSpans:·gc.churn.PS_Eden_Space SAMPLE avgt 3 3511.677 ± 2743.986 MB/sec TracingBenchmark.nestedSpans:·gc.churn.PS_Eden_Space.norm SAMPLE avgt 3 40771.767 ± 7164.960 B/op TracingBenchmark.nestedSpans:·gc.churn.PS_Survivor_Space SAMPLE avgt 3 0.384 ± 0.428 MB/sec TracingBenchmark.nestedSpans:·gc.churn.PS_Survivor_Space.norm SAMPLE avgt 3 4.451 ± 2.688 B/op TracingBenchmark.nestedSpans:·gc.count SAMPLE avgt 3 148.000 counts TracingBenchmark.nestedSpans:·gc.time SAMPLE avgt 3 88.000 ms TracingBenchmark.nestedSpans DO_NOT_SAMPLE avgt 3 908.402 ± 79.755 ns/op TracingBenchmark.nestedSpans:·gc.alloc.rate DO_NOT_SAMPLE avgt 3 2820.275 ± 290.026 MB/sec TracingBenchmark.nestedSpans:·gc.alloc.rate.norm DO_NOT_SAMPLE avgt 3 784.001 ± 0.011 B/op TracingBenchmark.nestedSpans:·gc.churn.PS_Eden_Space DO_NOT_SAMPLE avgt 3 2834.984 ± 293.831 MB/sec TracingBenchmark.nestedSpans:·gc.churn.PS_Eden_Space.norm DO_NOT_SAMPLE avgt 3 788.123 ± 162.926 B/op TracingBenchmark.nestedSpans:·gc.churn.PS_Survivor_Space DO_NOT_SAMPLE avgt 3 0.223 ± 1.492 MB/sec TracingBenchmark.nestedSpans:·gc.churn.PS_Survivor_Space.norm DO_NOT_SAMPLE avgt 3 0.062 ± 0.416 B/op TracingBenchmark.nestedSpans:·gc.count DO_NOT_SAMPLE avgt 3 126.000 counts TracingBenchmark.nestedSpans:·gc.time DO_NOT_SAMPLE avgt 3 77.000 ms TracingBenchmark.nestedSpans UNDECIDED avgt 3 1254.746 ± 233.856 ns/op TracingBenchmark.nestedSpans:·gc.alloc.rate UNDECIDED avgt 3 2945.625 ± 514.073 MB/sec TracingBenchmark.nestedSpans:·gc.alloc.rate.norm UNDECIDED avgt 3 1130.854 ± 22.743 B/op TracingBenchmark.nestedSpans:·gc.churn.PS_Eden_Space UNDECIDED avgt 3 2993.199 ± 1125.922 MB/sec TracingBenchmark.nestedSpans:·gc.churn.PS_Eden_Space.norm UNDECIDED avgt 3 1149.047 ± 258.339 B/op TracingBenchmark.nestedSpans:·gc.churn.PS_Survivor_Space UNDECIDED avgt 3 0.279 ± 0.890 MB/sec TracingBenchmark.nestedSpans:·gc.churn.PS_Survivor_Space.norm UNDECIDED avgt 3 0.107 ± 0.355 B/op TracingBenchmark.nestedSpans:·gc.count UNDECIDED avgt 3 135.000 counts TracingBenchmark.nestedSpans:·gc.time UNDECIDED avgt 3 81.000 ms ```
- Loading branch information