Class SpanContext

java.lang.Object
com.google.genkit.core.tracing.SpanContext

public class SpanContext extends Object
SpanContext contains trace and span identifiers for distributed tracing.
  • Constructor Details

    • SpanContext

      public SpanContext(String traceId, String spanId, String parentSpanId)
      Creates a new SpanContext.
      Parameters:
      traceId - the trace ID
      spanId - the span ID
      parentSpanId - the parent span ID, may be null
  • Method Details

    • getTraceId

      public String getTraceId()
      Returns the trace ID.
      Returns:
      the trace ID
    • getSpanId

      public String getSpanId()
      Returns the span ID.
      Returns:
      the span ID
    • getParentSpanId

      public String getParentSpanId()
      Returns the parent span ID.
      Returns:
      the parent span ID, or null if this is a root span
    • hasParent

      public boolean hasParent()
      Returns true if this span has a parent.
      Returns:
      true if this span has a parent
    • toString

      public String toString()
      Overrides:
      toString in class Object