Class NoOpSpanFactory.NoOpSpan

java.lang.Object
org.axonframework.messaging.tracing.NoOpSpanFactory.NoOpSpan
All Implemented Interfaces:
Span
Enclosing class:
NoOpSpanFactory

public static class NoOpSpanFactory.NoOpSpan extends Object implements Span
The Span implementation that does nothing.
  • Field Details

  • Constructor Details

    • NoOpSpan

      public NoOpSpan()
  • Method Details

    • start

      public Span start()
      Description copied from interface: Span
      Starts the Span. However, does not set this span as the span of the current thread. See Span.makeCurrent() in order to do so.
      Specified by:
      start in interface Span
      Returns:
      The span for fluent interfacing.
    • makeCurrent

      public SpanScope makeCurrent()
      Description copied from interface: Span
      Sets the Span as the current for the current thread. The returned SpanScope must be closed before ending the Span, on the same thread, or through a try-with-resources statement in the same thread as this method was called.

      You can make a span current on as many threads as you like, but you have to close every SpanScope, or context will leak into the current thread. Note that if this is neglected, the Span.end() method should warn the user in order to report this back to the framework.

      Specified by:
      makeCurrent in interface Span
      Returns:
      The scope of the span that must be closed be
    • end

      public void end()
      Description copied from interface: Span
      Ends the span. All scopes should have been closed at this point. In addition, a span can only be ended once.

      If scopes are still open when this method is called, either an exception should be thrown or an error log should be produced to warn the user of the leak. This information can then be reported back to the developers of the framework for a fix.

      Specified by:
      end in interface Span
    • recordException

      public Span recordException(Throwable t)
      Description copied from interface: Span
      Records an exception to the span. This will be reported to the APM tooling, which can show more information about the error in the trace. This method does not end the span.
      Specified by:
      recordException in interface Span
      Parameters:
      t - The exception to record
      Returns:
      The span for fluent interfacing.
    • addAttribute

      public Span addAttribute(String key, String value)
      Description copied from interface: Span
      Adds an attribute to the span. This can be used to add extra information to the span, which can be used by the APM tooling to provide more information about the span.
      Specified by:
      addAttribute in interface Span
      Parameters:
      key - The key of the attribute.
      value - The value of the attribute.
      Returns:
      The span for fluent interfacing.