java.lang.Object
org.eclipse.microprofile.opentracing.tck.tracer.TestTracer
All Implemented Interfaces:
io.opentracing.Tracer, Closeable, AutoCloseable

@Alternative public class TestTracer extends Object implements io.opentracing.Tracer
Test Tracer. The Alternative annotation is needed so that this doesn't get injected instead of the container's Tracer.
  • Constructor Details

    • TestTracer

      public TestTracer()
  • Method Details

    • getSpans

      public List<TestSpan> getSpans()
      Get a list of accumulated spans.
      Returns:
      List of spans.
    • setSpans

      public void setSpans(List<TestSpan> newSpans)
      Set the list of spans.
      Parameters:
      newSpans - List of spans.
    • scopeManager

      public io.opentracing.ScopeManager scopeManager()
      Specified by:
      scopeManager in interface io.opentracing.Tracer
    • activeSpan

      public io.opentracing.Span activeSpan()
      Specified by:
      activeSpan in interface io.opentracing.Tracer
    • activateSpan

      public io.opentracing.Scope activateSpan(io.opentracing.Span span)
      Specified by:
      activateSpan in interface io.opentracing.Tracer
    • buildSpan

      public io.opentracing.Tracer.SpanBuilder buildSpan(String operationName)
      Specified by:
      buildSpan in interface io.opentracing.Tracer
    • inject

      public <C> void inject(io.opentracing.SpanContext spanContext, io.opentracing.propagation.Format<C> format, C carrier)
      Specified by:
      inject in interface io.opentracing.Tracer
    • extract

      public <C> io.opentracing.SpanContext extract(io.opentracing.propagation.Format<C> format, C carrier)
      Specified by:
      extract in interface io.opentracing.Tracer
    • close

      public void close()
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Specified by:
      close in interface io.opentracing.Tracer
    • spanTree

      public TestSpanTree spanTree()
      Convert the list of spans into a tree.
      Returns:
      Tree of spans.