You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Add user identity (enduser.id) attribute to OpenTelemetry #592
Currently, the OpenTelemetry (OTel) traces and spans generated during AgentCore invocation (InvokeAgentRuntime / gen_ai execution) capture telemetry metrics and session identifiers, but do not consistently populate user identity in the span attributes.
We request adding support to automatically populate user identity (or allow passing custom user identity metadata) onto OTel span attributes, following the OpenTelemetry Semantic Conventions for user attributes (enduser.id).
Use Case & Impact
User-level Observability & Debugging: When troubleshooting agent execution failures or slow agent runs in observability platforms (e.g., Datadog, Grafana, Dynatrace, OpenSearch), SREs and developers need to trace issues back to specific end-users.
Auditability & Compliance: Enterprise compliance standards often require linking LLM invocations and tool calls directly to the initiating user identity.
Extract the user ID automatically from Inbound Authentication JWT tokens (e.g., Cognito sub or custom claim) if passed via AgentCore Identity/Auth headers.
Expose a mechanism in BedrockAgentCoreApp or request context context/metadata to explicitly inject user_id when initializing or handling incoming requests.
Example / Expected Behavior
When an agent invocation span is generated, the resulting OpenTelemetry span attributes should include:
Activity
gingeekrishna commentedon Aug 8, 2026
Hi, I've implemented this in #628.
What's in the PR:
Two extraction sources checked per request (priority order):
The value is stored in a ContextVar (same pattern as ), so concurrent requests can't bleed into each other. then stamps on every new OTel span.
All three entry paths are covered — , (A2A), and . 22 new tests; all existing tests still pass.
feat: add enduser.id OTel span attribute from request identity