public class Span extends SubscribersBatch<Span>
Holds the details of an individual OTLP span record received from a client as a Batch of all subscribers that are expected to process it.
  • Constructor Details

    • Span

      public Span(Batch<Span> parent, io.opentelemetry.context.Context otelContext)
      Create a new empty span.
      Parameters:
      parent - parent Batch
      otelContext - Context for own telemetry
  • Method Details

    • setFrom

      public void setFrom(long batchTS, String batchID, int sequenceNum, io.opentelemetry.proto.trace.v1.ResourceSpans resourceSpan, io.opentelemetry.proto.trace.v1.ScopeSpans scopeSpan, io.opentelemetry.proto.trace.v1.Span otelSpan)
      Set the details of this span. Also sets the validity of this record and potentially an error message.
      Parameters:
      batchTS - the batch timestamp
      batchID - the batch id
      sequenceNum - the sequence number of this span
      resourceSpan - used to fill-in OpenTelemetry Resource details
      scopeSpan - used to fill-in OpenTelemetry Scope details
      otelSpan - the span details
    • getBatchTimestamp

      public long getBatchTimestamp()
      Get the timestamp when the containing OTLP packet was received.
      Returns:
      the timestamp, in ms
    • getBatchUUID

      public String getBatchUUID()
      Get the unique id of the containing OTLP packet.
      Returns:
      the UUID
    • getSeqNo

      public int getSeqNo()
      Get the sequence number of this span within the containing OTLP packet.
      Returns:
      the sequence number, zero-based
    • getResource

      public io.opentelemetry.proto.resource.v1.Resource getResource()
      Get the OpenTelemetry Resource of this span.
      Returns:
      the resource details
    • getResourceSchemaUrl

      public String getResourceSchemaUrl()
      Get the schema URL of the OpenTelemetry Resouce of this span.
      Returns:
      the schema URL
    • getScope

      public io.opentelemetry.proto.common.v1.InstrumentationScope getScope()
      Get the OpenTelemetry Scope of this span.
      Returns:
      the scope details
    • getSpan

      public io.opentelemetry.proto.trace.v1.Span getSpan()
      Get the OpenTelemetry Span.
      Returns:
      the span details
    • getSpanSchemaUrl

      public String getSpanSchemaUrl()
      Get the schema URL of the OpenTelemetry Span.
      Returns:
      the schema URL
    • isValid

      public boolean isValid()
      Check if this record is valid.
      Returns:
      true if data is valid
    • getErrorMessage

      public String getErrorMessage()
      Get the message associated with an error in the data.
      Returns:
      the error message or null if data is valid