Interface Span

All Known Implementing Classes:
AbstractSpan, NoopSpan

@ExperimentalApi public interface Span
An interface that represents a tracing span. Spans are created by the Tracer.startSpan method. Span must be ended by calling SpanScope.close which internally calls Span's endSpan.
Opensearch.experimental:
  • Method Details

    • endSpan

      void endSpan()
      Ends the span
    • getParentSpan

      Span getParentSpan()
      Returns span's parent span
    • getSpanName

      String getSpanName()
      Returns the name of the Span
    • addAttribute

      void addAttribute(String key, String value)
      Adds string type attribute in the span
      Parameters:
      key - of the attribute
      value - value of the attribute
    • addAttribute

      void addAttribute(String key, Long value)
      Adds long type attribute in the span
      Parameters:
      key - of the attribute
      value - value of the attribute
    • addAttribute

      void addAttribute(String key, Double value)
      Adds double type attribute in the span
      Parameters:
      key - of the attribute
      value - value of the attribute
    • addAttribute

      void addAttribute(String key, Boolean value)
      Adds boolean type attribute in the span
      Parameters:
      key - of the attribute
      value - value of the attribute
    • setError

      void setError(Exception exception)
      Records error in the span
      Parameters:
      exception - exception to be recorded
    • addEvent

      void addEvent(String event)
      Adds an event in the span
      Parameters:
      event - name of the event
    • getTraceId

      String getTraceId()
      Returns traceId of the span
      Returns:
      span's traceId
    • getSpanId

      String getSpanId()
      Returns spanId of the span
      Returns:
      span's spanId