Class TracerProviderUtil
java.lang.Object
io.vertigo.core.impl.analytics.trace.TracerProviderUtil
Utility class for providing Tracer instances.
-
Method Summary
Modifier and TypeMethodDescriptionstatic voidaddContextTag(String key, String value) static voidReturns the current Tracer instance, if one exists.static voidTraces the execution of a block of code.static <O> OtraceWithReturn(String category, String name, Function<Tracer, O> function, Consumer<TraceSpan> onCloseConsumer) Traces the execution of a block of code and returns a result.
-
Method Details
-
trace
public static void trace(String category, String name, Consumer<Tracer> consumer, Consumer<TraceSpan> onCloseConsumer) Traces the execution of a block of code.- Parameters:
category- the category of the tracename- the name of the traceconsumer- the block of code to traceonCloseConsumer- the action to perform when the trace is closed
-
traceWithReturn
public static <O> O traceWithReturn(String category, String name, Function<Tracer, O> function, Consumer<TraceSpan> onCloseConsumer) Traces the execution of a block of code and returns a result.- Parameters:
category- the category of the tracename- the name of the tracefunction- the block of code to traceonCloseConsumer- the action to perform when the trace is closed- Returns:
- the result of the function
-
getCurrentTracer
Returns the current Tracer instance, if one exists.- Returns:
- an Optional containing the current Tracer, or an empty Optional if none exists
-
addContextTag
-
clearContextTags
public static void clearContextTags()
-