Skip to content

SSE streaming operation duration is incomplete — span ends at stream initiation #1220

Description

@ehsavoie

The current span for SSE streaming requests ends immediately after the stream is initiated (when the publisher returns), not when the stream actually completes. This means gen_ai.client.operation.duration (if it existed) would only record the stream setup time — potentially 0ms — rather than the full end-to-end streaming duration.
Current Behavior

CLIENT Span: sendMessage
│
│ ← Span ends here (stream publisher created)
│
[CLIENT Span: event-1] (addLink)
[CLIENT Span: event-2] (addLink)
[CLIENT Span: event-3] (addLink)
│
│ ← Stream actually ends here (no span records this)
▼

The parent span closes before any events are sent.
There is no span or metric that captures the full duration from stream initiation to the last event.
The measured "operation duration" may be 0ms or near-0ms, completely misleading.

Expected Behavior

Either extend the parent span's lifetime to cover the full streaming duration, or
Record a dedicated metric (a2a.task.request.duration or similar) that measures the time from stream initiation to the final event.

Impact

Operation latency appears as ~0ms in dashboards, masking actual processing time.
Cannot measure true end-to-end streaming duration.
SLO/SLA monitoring based on operation duration would be incorrect.

Cf Issue #1132

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions