Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions static/app/views/explore/conversations/onboarding.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,39 @@ Sentry.setConversationId("my-conversation-123");`,
};
}

function getSetUserStep(isPython: boolean): OnboardingStep {
const content: ContentBlock[] = [
{
type: 'text',
text: t(
'Identify the user behind each conversation so the Conversations view can show who sent each message:'
),
},
isPython
? {
type: 'code' as const,
language: 'python',
code: `import sentry_sdk

# Call this once per request / session, before any AI calls
sentry_sdk.set_user({"id": "user_123", "email": "jane@example.com", "username": "jane"})`,
}
: {
type: 'code' as const,
language: 'javascript',
code: `import * as Sentry from "@sentry/node";

// Call this once per request / session, before any AI calls
Sentry.setUser({ id: "user_123", email: "jane@example.com", username: "jane" });`,
},
];

return {
title: t('Identify Users (optional)'),
content,
};
}

export function ConversationOnboarding({onDismiss}: {onDismiss: () => void}) {
const api = useApi();
const {isSelfHosted, urlPrefix} = useLegacyStore(ConfigStore);
Expand Down Expand Up @@ -369,6 +402,7 @@ export function ConversationOnboarding({onDismiss}: {onDismiss: () => void}) {
...(agentMonitoringDocs.install?.(docParams) || []),
...(agentMonitoringDocs.configure?.(docParams) || []),
getConversationIdStep(selectedIntegration, isPythonPlatform),
getSetUserStep(isPythonPlatform),
...(agentMonitoringDocs.verify?.(docParams) || []),
].filter(s => !s.collapsible);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ export const LLM_ONBOARDING_COPY_MARKDOWN = `
> The setup steps above contain the correct DSN and project-specific SDK configuration — complete them first.
> Then follow the skill references below for instrumentation and agent naming.
> If the app has multi-turn chats, set a conversation ID for each chat so Sentry can send the gen_ai.conversation.id attribute and show the session in Conversations.
> Also call setUser (JS) / sentry_sdk.set_user (Python) once per request or session so conversations are attributed to users in the Conversations view.

# Instrument Sentry AI Agent Monitoring

Expand Down
Loading