File tree Expand file tree Collapse file tree 1 file changed +2
-11
lines changed
tracing/src/main/java/com/palantir/tracing Expand file tree Collapse file tree 1 file changed +2
-11
lines changed Original file line number Diff line number Diff line change 2626import com .palantir .logsafe .Safe ;
2727import com .palantir .logsafe .SafeArg ;
2828import com .palantir .logsafe .UnsafeArg ;
29- import com .palantir .logsafe .exceptions .SafeIllegalArgumentException ;
3029import com .palantir .logsafe .exceptions .SafeIllegalStateException ;
3130import com .palantir .logsafe .exceptions .SafeRuntimeException ;
3231import com .palantir .logsafe .logger .SafeLogger ;
@@ -86,16 +85,8 @@ private static Trace createTrace(
8685 }
8786
8887 private static boolean shouldObserve (Observability observability ) {
89- switch (observability ) {
90- case SAMPLE :
91- return true ;
92- case DO_NOT_SAMPLE :
93- return false ;
94- case UNDECIDED :
95- return sampler .sample ();
96- }
97-
98- throw new SafeIllegalArgumentException ("Unknown observability" , SafeArg .of ("observability" , observability ));
88+ // Simplified implementation of 'switch(observability) {' for fast inlining (30 bytes)
89+ return observability == Observability .SAMPLE || (observability == Observability .UNDECIDED && sampler .sample ());
9990 }
10091
10192 /**
You can’t perform that action at this time.
0 commit comments