Class Tracer

java.lang.Object
sonia.scm.trace.Tracer

public final class Tracer extends Object
The tracer api allows the tracing of long running tasks, such as calling external systems. The api is able to collect tracing points called spans. To use the tracer api inject the Tracer and open a span in a try with resources block e.g.:
   try (Span span = tracer.span("jenkins").label("repository", "builds/core")) {
     Response response = jenkins.call("http://...");
     if (!response.isSuccess()) {
       span.label("reason", response.getFailedReason());
       span.failed();
     }
   }
 
As seen in the example we can mark span as failed and add more context to the span with labels. After a span is closed it is delegated to an Exporter, which
Since:
2.9.0
  • Constructor Details

    • Tracer

      @Inject public Tracer(Set<Exporter> exporters)
  • Method Details

    • span

      public Span span(String kind)
      Creates a new span.
      Parameters:
      kind - kind of span