Class Span

java.lang.Object
sonia.scm.trace.Span
All Implemented Interfaces:
AutoCloseable

public final class Span extends Object implements AutoCloseable
A span represents a single unit of work e.g. a request to an external system.
Since:
2.9.0
  • Method Details

    • label

      public Span label(String key, String value)
      Adds a label to the span.
      Parameters:
      key - key of label
      value - label value
      Returns:
      this
    • label

      public Span label(String key, int value)
      Adds a label to the span.
      Parameters:
      key - key of label
      value - label value
      Returns:
      this
    • label

      public Span label(String key, long value)
      Adds a label to the span.
      Parameters:
      key - key of label
      value - label value
      Returns:
      this
    • label

      public Span label(String key, float value)
      Adds a label to the span.
      Parameters:
      key - key of label
      value - label value
      Returns:
      this
    • label

      public Span label(String key, double value)
      Adds a label to the span.
      Parameters:
      key - key of label
      value - label value
      Returns:
      this
    • label

      public Span label(String key, boolean value)
      Adds a label to the span.
      Parameters:
      key - key of label
      value - label value
      Returns:
      this
    • label

      public Span label(String key, Object value)
      Adds a label to the span.
      Parameters:
      key - key of label
      value - label value
      Returns:
      this
    • failed

      public Span failed()
      Marks the span as failed.
      Returns:
      this
    • close

      public void close()
      Closes the span a reports the context to the Tracer.
      Specified by:
      close in interface AutoCloseable