[PR #5279] feat(telemetry): Add userId and sessionId metadata to experimental_telemetry #11322

Closed
opened 2026-02-16 18:16:08 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/anomalyco/opencode/pull/5279

State: closed
Merged: Yes


Summary

Adds userId and sessionId to experimental_telemetry.metadata across all AI SDK calls, enabling session-level trace grouping in observability platforms.

Motivation

Currently, OpenCode emits OTEL traces for cost and token usage tracking, but lacks user/session context. This makes it difficult to:

  • Group traces by user sessions
  • Track conversation flows end-to-end
  • Correlate multiple LLM calls within a single session

Testing

  • Tested with Langfuse - traces correctly group by session and display user attribution
  • No impact on existing functionality when OTEL is disabled
**Original Pull Request:** https://github.com/anomalyco/opencode/pull/5279 **State:** closed **Merged:** Yes --- ## Summary Adds `userId` and `sessionId` to `experimental_telemetry.metadata` across all AI SDK calls, enabling session-level trace grouping in observability platforms. ## Motivation Currently, OpenCode emits OTEL traces for cost and token usage tracking, but lacks user/session context. This makes it difficult to: - Group traces by user sessions - Track conversation flows end-to-end - Correlate multiple LLM calls within a single session ## Testing - Tested with Langfuse ✅ - traces correctly group by session and display user attribution - No impact on existing functionality when OTEL is disabled
yindo added the pull-request label 2026-02-16 18:16:08 -05:00
yindo closed this issue 2026-02-16 18:16:08 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#11322