From 15b832c09a5bc51e1325ae9b259012805a3d47e0 Mon Sep 17 00:00:00 2001 From: Ognjen Bostjancic Date: Thu, 25 Jun 2026 12:37:18 +0200 Subject: [PATCH 1/2] docs(ai-monitoring): Add setUser / user attribution instructions to Conversations Add 'Identifying Users in Conversations' sections to the JS and Python AI agent monitoring guides, explaining that setUser() / set_user() populates the User column in the Conversations view. Add a 'User Attribution' section to the Conversations product page, with JS and Python code snippets, and mention the User column in the Conversations List section. Refs TET-2513 Co-Authored-By: Claude Sonnet 4 --- docs/ai/monitoring/conversations/index.mdx | 23 +++++++++++++++++++ .../common/ai-agent-monitoring/index.mdx | 12 ++++++++++ .../ai-agents-module.mdx | 12 ++++++++++ 3 files changed, 47 insertions(+) diff --git a/docs/ai/monitoring/conversations/index.mdx b/docs/ai/monitoring/conversations/index.mdx index c477b1c547a6fd..e706df339d3795 100644 --- a/docs/ai/monitoring/conversations/index.mdx +++ b/docs/ai/monitoring/conversations/index.mdx @@ -12,6 +12,8 @@ keywords: - gen_ai.conversation.id - conversation tracking - LLM conversations + - setUser + - user attribution --- @@ -47,6 +49,26 @@ Conversations and traces are independent concepts. A single conversation can spa The reverse is also true: a single trace can contain spans from different conversations. For example, if a user starts a new chat session without refreshing the page, the new conversation's spans appear in the same trace as the previous one. +## User Attribution + +The Conversations view includes a **User** column that shows which user initiated each conversation. To populate it, call `setUser` (JavaScript) or `set_user` (Python) once per request or session, before any AI calls: + +```javascript +// JavaScript / Node.js +import * as Sentry from "@sentry/node"; + +Sentry.setUser({ id: "user_123", email: "jane@example.com", username: "jane" }); +``` + +```python +# Python +import sentry_sdk + +sentry_sdk.set_user({"id": "user_123", "email": "jane@example.com", "username": "jane"}) +``` + +Any of `id`, `email`, or `username` is sufficient. If no user is set, the column displays "Unknown". + ## Conversations List The [Conversations](https://sentry.io/orgredirect/organizations/:orgslug/explore/conversations/) page shows the most recent conversations that match your filters. @@ -55,6 +77,7 @@ The [Conversations](https://sentry.io/orgredirect/organizations/:orgslug/explore Each row in the list displays: +- **User** — the user who initiated the conversation, populated by `setUser` / `set_user` - **First input** — the first user message in the conversation - **Last output** — the most recent assistant response - **Cost** — estimated dollar cost and token usage diff --git a/docs/platforms/javascript/common/ai-agent-monitoring/index.mdx b/docs/platforms/javascript/common/ai-agent-monitoring/index.mdx index 0d2837ca4a52d1..8bfd3b46c1fc3c 100644 --- a/docs/platforms/javascript/common/ai-agent-monitoring/index.mdx +++ b/docs/platforms/javascript/common/ai-agent-monitoring/index.mdx @@ -192,6 +192,18 @@ Sentry.setConversationId(null); +## Identifying Users in Conversations + +The [Conversations](/ai/monitoring/conversations/) view includes a **User** column. To populate it, call `setUser` once per request or session, before any AI calls: + +```javascript +import * as Sentry from "___SDK_PACKAGE___"; + +Sentry.setUser({ id: "user_123", email: "jane@example.com", username: "jane" }); +``` + +Any of `id`, `email`, or `username` is sufficient — Conversations displays whichever fields are present. See the [User Feedback](/platforms/javascript/user-feedback/#identifying-users) documentation for the full list of supported fields. + ## Manual Instrumentation If you're using a library that Sentry does not automatically instrument, you can manually instrument your code to capture spans. For your AI agents data to show up in the [AI Agents Dashboards](https://sentry.io/orgredirect/organizations/:orgslug/dashboards/?filter=onlyPrebuilt&query=agents&sort=mostPopular), spans must have well-defined names and data attributes. diff --git a/docs/platforms/python/tracing/instrumentation/custom-instrumentation/ai-agents-module.mdx b/docs/platforms/python/tracing/instrumentation/custom-instrumentation/ai-agents-module.mdx index 566e9c354f64b0..18d19f11f177bc 100644 --- a/docs/platforms/python/tracing/instrumentation/custom-instrumentation/ai-agents-module.mdx +++ b/docs/platforms/python/tracing/instrumentation/custom-instrumentation/ai-agents-module.mdx @@ -227,6 +227,18 @@ response = openai.responses.create( ) ``` +## Identifying Users in Conversations + +The [Conversations](/ai/monitoring/conversations/) view includes a **User** column. To populate it, call `sentry_sdk.set_user` once per request or session, before any AI calls: + +```python +import sentry_sdk + +sentry_sdk.set_user({"id": "user_123", "email": "jane@example.com", "username": "jane"}) +``` + +Any of `id`, `email`, or `username` is sufficient — Conversations displays whichever fields are present. + ## Common Span Attributes From 869653538f66f480b8b3b25694f057455fb6eaa4 Mon Sep 17 00:00:00 2001 From: Ognjen Bostjancic Date: Thu, 25 Jun 2026 14:54:49 +0200 Subject: [PATCH 2/2] fix(ai-monitoring): Fix broken anchor in setUser docs link The link to User Feedback #identifying-users did not exist on that page. Point to the setUser API reference instead which documents all supported fields. Refs TET-2513 Co-Authored-By: Claude Sonnet 4 --- docs/platforms/javascript/common/ai-agent-monitoring/index.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/platforms/javascript/common/ai-agent-monitoring/index.mdx b/docs/platforms/javascript/common/ai-agent-monitoring/index.mdx index 95cfe55942fb65..c16c9e1fe5a033 100644 --- a/docs/platforms/javascript/common/ai-agent-monitoring/index.mdx +++ b/docs/platforms/javascript/common/ai-agent-monitoring/index.mdx @@ -200,7 +200,7 @@ import * as Sentry from "___SDK_PACKAGE___"; Sentry.setUser({ id: "user_123", email: "jane@example.com", username: "jane" }); ``` -Any of `id`, `email`, or `username` is sufficient — Conversations displays whichever fields are present. See the [User Feedback](/platforms/javascript/user-feedback/#identifying-users) documentation for the full list of supported fields. +Any of `id`, `email`, or `username` is sufficient — Conversations displays whichever fields are present. See the [setUser API reference](/platforms/javascript/apis/#setUser) for the full list of supported fields. ## Manual Instrumentation