Class StreamingEventAttributes
java.lang.Object
org.a2aproject.sdk.extras.opentelemetry.StreamingEventAttributes
-
Method Summary
Modifier and TypeMethodDescriptionstatic voidapply(io.opentelemetry.api.trace.SpanBuilder builder, StreamingEventKind item) Applies task-specific attributes derived from the streaming event to the span builder.static voidrecordDuration(@Nullable io.opentelemetry.api.metrics.DoubleHistogram histogram, long startNanos, String operationName, boolean success) Records elapsed time to a histogram using the standard A2A operation attributes.
-
Method Details
-
apply
Applies task-specific attributes derived from the streaming event to the span builder. Populates task ID, task status state, and other event-kind-specific fields.- Parameters:
builder- the span builder to enrich with event attributesitem- the streaming event to extract attributes from
-
recordDuration
public static void recordDuration(@Nullable io.opentelemetry.api.metrics.DoubleHistogram histogram, long startNanos, String operationName, boolean success) Records elapsed time to a histogram using the standard A2A operation attributes.The
error.typeattribute is set to the fixed string "error" on failures rather than the actual exception class name. This is intentional: metrics use a low-cardinality error marker to avoid unbounded label sets, while spans carry the full class name for debugging.- Parameters:
histogram- the histogram to record to; no-op ifnullstartNanos- the start time fromSystem.nanoTime()operationName- the A2A operation name recorded asgen_ai.agent.a2a.operation.namesuccess-falseadds theerror.typeattribute
-