Class TracerProviderUtil

java.lang.Object
io.vertigo.core.impl.analytics.trace.TracerProviderUtil

public final class TracerProviderUtil extends Object
Utility class for providing Tracer instances.
  • 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 trace
      name - the name of the trace
      consumer - the block of code to trace
      onCloseConsumer - 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 trace
      name - the name of the trace
      function - the block of code to trace
      onCloseConsumer - the action to perform when the trace is closed
      Returns:
      the result of the function
    • getCurrentTracer

      public static Optional<Tracer> getCurrentTracer()
      Returns the current Tracer instance, if one exists.
      Returns:
      an Optional containing the current Tracer, or an empty Optional if none exists
    • addContextTag

      public static void addContextTag(String key, String value)
    • clearContextTags

      public static void clearContextTags()