Interface Span

All Superinterfaces:
SpanCustomizer
All Known Subinterfaces:
AssertingSpan

public interface Span extends SpanCustomizer
This API was heavily influenced by Brave. Parts of its documentation were taken directly from Brave. Span is a single unit of work that needs to be started and stopped. Contains timing information and events and tags.
Since:
3.0.0
Author:
OpenZipkin Brave Authors, Marcin Grzejszczak
  • Method Details

    • isNoop

      boolean isNoop()
      Returns:
      true when no recording is done and nothing is reported to an external system. However, this span should still be injected into outgoing requests. Use this flag to avoid performing expensive computation.
    • context

      TraceContext context()
      Returns:
      TraceContext corresponding to this span.
    • start

      Span start()
      Starts this span.
      Returns:
      this span
    • name

      Span name(String name)
      Sets a name on this span.
      Specified by:
      name in interface SpanCustomizer
      Parameters:
      name - name to set on the span
      Returns:
      this span
    • event

      Span event(String value)
      Sets an event on this span.
      Specified by:
      event in interface SpanCustomizer
      Parameters:
      value - event name to set on the span
      Returns:
      this span
    • tag

      Span tag(String key, String value)
      Sets a tag on this span.
      Specified by:
      tag in interface SpanCustomizer
      Parameters:
      key - tag key
      value - tag value
      Returns:
      this span
    • error

      Span error(Throwable throwable)
      Records an exception for this span.
      Parameters:
      throwable - to record
      Returns:
      this span
    • end

      void end()
      Ends the span. The span gets stopped and recorded if not noop.
    • abandon

      void abandon()
      Ends the span. The span gets stopped but does not get recorded.
    • remoteServiceName

      default Span remoteServiceName(String remoteServiceName)
      Sets the remote service name for the span.
      Parameters:
      remoteServiceName - remote service name
      Returns:
      this span
      Since:
      3.0.3
    • remoteIpAndPort

      default Span remoteIpAndPort(String ip, int port)
      Sets the remote url on the span.
      Parameters:
      ip - remote ip
      port - remote port
      Returns:
      this span
      Since:
      3.1.0