File tree Expand file tree Collapse file tree 4 files changed +14
-3
lines changed
src/jmh/java/com/palantir/tracing
tracing/src/main/java/com/palantir/tracing Expand file tree Collapse file tree 4 files changed +14
-3
lines changed Original file line number Diff line number Diff line change
1
+ type : improvement
2
+ improvement :
3
+ description : Trace threadlocal entry is never removed, only nulled
4
+ links :
5
+ - https://github.com/palantir/tracing-java/pull/849
Original file line number Diff line number Diff line change @@ -16,7 +16,7 @@ tasks.jmhCompileGeneratedClasses {
16
16
}
17
17
18
18
dependencies {
19
- annotationProcessor ' org.openjdk.jmh:jmh-generator-annprocess'
19
+ jmhAnnotationProcessor ' org.openjdk.jmh:jmh-generator-annprocess'
20
20
compileOnly ' org.openjdk.jmh:jmh-generator-annprocess'
21
21
api ' org.immutables:value::annotations'
22
22
api ' org.openjdk.jmh:jmh-core'
Original file line number Diff line number Diff line change 43
43
@ OutputTimeUnit (TimeUnit .NANOSECONDS )
44
44
@ Warmup (iterations = 3 , time = 3 , timeUnit = TimeUnit .SECONDS )
45
45
@ Measurement (iterations = 3 , time = 3 , timeUnit = TimeUnit .SECONDS )
46
- @ Fork (1 )
46
+ @ Fork (value = 1 , jvmArgsAppend = "-Dlog4j2.garbagefreeThreadContextMap=true" )
47
47
@ Threads (4 )
48
48
@ SuppressWarnings ({"checkstyle:hideutilityclassconstructor" , "checkstyle:VisibilityModifier" })
49
49
public class TracingBenchmark {
@@ -88,6 +88,12 @@ public static void nestedSpans() {
88
88
nestedSpans .run ();
89
89
}
90
90
91
+ @ Benchmark
92
+ public static void traceWithSingleSpan () {
93
+ Tracer .fastStartSpan ("benchmark" );
94
+ Tracer .fastCompleteSpan ();
95
+ }
96
+
91
97
private static Runnable createNestedSpan (int depth ) {
92
98
if (depth <= 0 ) {
93
99
return Runnables .doNothing ();
Original file line number Diff line number Diff line change @@ -919,7 +919,7 @@ private static Trace getOrCreateCurrentTrace() {
919
919
@ VisibleForTesting
920
920
static void clearCurrentTrace () {
921
921
logClearingTrace ();
922
- currentTrace .remove ( );
922
+ currentTrace .set ( null );
923
923
MDC .remove (Tracers .TRACE_ID_KEY );
924
924
MDC .remove (Tracers .TRACE_SAMPLED_KEY );
925
925
MDC .remove (Tracers .REQUEST_ID_KEY );
You can’t perform that action at this time.
0 commit comments