java.lang.Object
java.lang.Record
codes.grow.packages.otelcollector.tracing.query.Span
Record Components:
traceId - 32 lower-hex characters (or a native id, see TraceIds.traceId(java.lang.String))
spanId - 16 lower-hex characters (or a native id, see TraceIds.spanId(java.lang.String))
parentSpanId - parent span id, if any
name - operation name
kind - span kind
serviceName - service.name of the reporting service
startMicros - start time
endMicros - end time
durationMicros - duration
status - status code and message
attributes - attribute values
events - events
links - links

public record Span(String traceId, String spanId, Optional<String> parentSpanId, String name, Span.Kind kind, String serviceName, long startMicros, long endMicros, long durationMicros, Span.Status status, Map<String,Object> attributes, List<Span.Event> events, List<Span.Link> links) extends Record
A span as returned by a TraceQueryClient (normalized model; not the OpenTelemetry API span). Times are microseconds since the Unix epoch.
  • Constructor Details

    • Span

      public Span(String traceId, String spanId, Optional<String> parentSpanId, String name, Span.Kind kind, String serviceName, long startMicros, long endMicros, long durationMicros, Span.Status status, Map<String,Object> attributes, List<Span.Event> events, List<Span.Link> links)
      Normalises ids, copies collections and checks the times.
      Parameters:
      traceId - trace id
      spanId - span id
      parentSpanId - parent span id
      name - name
      kind - kind
      serviceName - service name
      startMicros - start
      endMicros - end
      durationMicros - duration
      status - status
      attributes - attributes
      events - events
      links - links
  • Method Details

    • builder

      public static Span.Builder builder(String traceId, String spanId, String name)
      Returns a builder.
      Parameters:
      traceId - trace id
      spanId - span id
      name - name
      Returns:
      builder
    • isRoot

      public boolean isRoot()
      Whether the span is a root (no parent).
      Returns:
      true for roots
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with '=='.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • traceId

      public String traceId()
      Returns the value of the traceId record component.
      Returns:
      the value of the traceId record component
    • spanId

      public String spanId()
      Returns the value of the spanId record component.
      Returns:
      the value of the spanId record component
    • parentSpanId

      public Optional<String> parentSpanId()
      Returns the value of the parentSpanId record component.
      Returns:
      the value of the parentSpanId record component
    • name

      public String name()
      Returns the value of the name record component.
      Returns:
      the value of the name record component
    • kind

      public Span.Kind kind()
      Returns the value of the kind record component.
      Returns:
      the value of the kind record component
    • serviceName

      public String serviceName()
      Returns the value of the serviceName record component.
      Returns:
      the value of the serviceName record component
    • startMicros

      public long startMicros()
      Returns the value of the startMicros record component.
      Returns:
      the value of the startMicros record component
    • endMicros

      public long endMicros()
      Returns the value of the endMicros record component.
      Returns:
      the value of the endMicros record component
    • durationMicros

      public long durationMicros()
      Returns the value of the durationMicros record component.
      Returns:
      the value of the durationMicros record component
    • status

      public Span.Status status()
      Returns the value of the status record component.
      Returns:
      the value of the status record component
    • attributes

      public Map<String,Object> attributes()
      Returns the value of the attributes record component.
      Returns:
      the value of the attributes record component
    • events

      public List<Span.Event> events()
      Returns the value of the events record component.
      Returns:
      the value of the events record component
    • links

      public List<Span.Link> links()
      Returns the value of the links record component.
      Returns:
      the value of the links record component