Skip to content

feat(telemetry): record the trusted user as user.id - #3552

Merged
EItanya merged 1 commit into
kagent-dev:mainfrom
krisztianfekete:feat/telemetry-user-id
Nov 6, 2026
Merged

EItanya merged 1 commit into
kagent-dev:mainfrom
krisztianfekete:feat/telemetry-user-id

Conversation

@krisztianfekete

Copy link
Copy Markdown
Contributor

What

The runtimes now record the gateway-forwarded user (x-user-id) as user.id instead of enduser.id, on the request span and the spans beneath it. Go ADK and the Python runtimes change together, and the registry, policy, live-check rule and docs follow.

Why

Semantic conventions v1.45.0 deprecated enduser.id and enduser.pseudo.id and moved them to the client-side conventions (open-telemetry/semantic-conventions#4238), which cover browsers and mobile apps. For a server, the attribute is the core user.id. It already exists in the pinned v1.44.0 registry and in the Go semconv/v1.43.0 package, so this PR needs no dependency or pin bump. The core v1.45.0 and GenAI pin bump comes in a follow-up.

Breaking change

This is a hard rename. Queries, dashboards and access rules that read enduser.id must read user.id. To keep the old name for one release, add this to an OpenTelemetry Collector transform processor:

trace_statements:
  - context: span
    statements:
      - set(attributes["enduser.id"], attributes["user.id"]) where attributes["user.id"] != nil

Claude Code spans carry their own user.id, which is a hash of the Claude account and not the kagent user. Read the trusted user from the invocation span.

Notes

  • The live-check matcher for kagent.request now finds request spans by a2a.method instead of the user attribute. Otherwise Claude Code's native user.id would match its spans against the kagent request group.
  • Downstream readers that already accept user.id should land before this PR is synced into their tree.

Testing

  • make semconv-check semconv-policies-test semconv-generate
  • go test ./pkg/tracing/... ./adk/pkg/a2a/... ./adk/pkg/telemetry/...
  • uv run pytest packages/kagent-core/tests/test_a2a_telemetry.py

Signed-off-by: krisztianfekete <git@krisztianfekete.org>
@github-actions github-actions Bot added the enhancement New feature or request label Nov 6, 2026
@krisztianfekete
krisztianfekete marked this pull request as ready for review November 6, 2026 11:19
@krisztianfekete
krisztianfekete requested review from a team and supreme-gg-gg as code owners November 6, 2026 11:19
@EItanya
EItanya added this pull request to the merge queue Nov 6, 2026
Merged via the queue into kagent-dev:main with commit 3198d13 Nov 6, 2026
31 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

⌂ 换网址