From 26226d5b111ccac56ccb63296d6cd9fe9afa0cc1 Mon Sep 17 00:00:00 2001
From: Ogi <86684834+obostjancic@users.noreply.github.com>
Date: Mon, 13 Oct 2025 17:08:14 +0200
Subject: [PATCH 1/4] feat(ai-insights): python google gen ai onboarding
---
.../app/gettingStartedDocs/python/python.tsx | 81 ++++++++++++++++---
.../insights/agents/views/onboarding.tsx | 1 +
.../details/span/eapSections/aiIOAlert.tsx | 3 +
3 files changed, 76 insertions(+), 9 deletions(-)
diff --git a/static/app/gettingStartedDocs/python/python.tsx b/static/app/gettingStartedDocs/python/python.tsx
index 9f4f631b61d5ee..e48ca439df2f83 100644
--- a/static/app/gettingStartedDocs/python/python.tsx
+++ b/static/app/gettingStartedDocs/python/python.tsx
@@ -460,6 +460,8 @@ export const agentMonitoringOnboarding: OnboardingConfig = {
packageName = 'sentry-sdk[langgraph]';
} else if (selected === 'litellm') {
packageName = 'sentry-sdk[litellm]';
+ } else if (selected === 'google_genai') {
+ packageName = 'sentry-sdk[google_genai]';
}
return [
@@ -571,18 +573,14 @@ sentry_sdk.init(
],
};
- const manualStep: OnboardingStep = {
+ const googleGenAIStep: OnboardingStep = {
type: StepType.CONFIGURE,
content: [
{
type: 'text',
text: tct(
- 'If you are not using a supported SDK integration, you can instrument your AI calls manually. See [link:manual instrumentation docs] for details.',
- {
- link: (
-
- ),
- }
+ 'Import and initialize the Sentry SDK - the GoogleGenAIIntegration will be enabled automatically:',
+ {code: }
),
},
{
@@ -591,8 +589,13 @@ sentry_sdk.init(
code: `
import sentry_sdk
-sentry_sdk.init(dsn="${params.dsn.public}", traces_sample_rate=1.0)
-`,
+sentry_sdk.init(
+ dsn="${params.dsn.public}",
+ traces_sample_rate=1.0,
+ # Add data like inputs and responses to/from LLMs and tools;
+ # see https://docs.sentry.io/platforms/python/data-management/data-collected/ for more info
+ send_default_pii=True,
+)`,
},
],
};
@@ -724,6 +727,32 @@ sentry_sdk.init(
],
};
+ const manualStep: OnboardingStep = {
+ type: StepType.CONFIGURE,
+ content: [
+ {
+ type: 'text',
+ text: tct(
+ 'If you are not using a supported SDK integration, you can instrument your AI calls manually. See [link:manual instrumentation docs] for details.',
+ {
+ link: (
+
+ ),
+ }
+ ),
+ },
+ {
+ type: 'code',
+ language: 'python',
+ code: `
+import sentry_sdk
+
+sentry_sdk.init(dsn="${params.dsn.public}", traces_sample_rate=1.0)
+`,
+ },
+ ],
+ };
+
const selected = (params.platformOptions as any)?.integration ?? 'openai_agents';
if (selected === 'openai') {
return [openaiSdkStep];
@@ -740,6 +769,9 @@ sentry_sdk.init(
if (selected === 'litellm') {
return [liteLLMStep];
}
+ if (selected === 'google_genai') {
+ return [googleGenAIStep];
+ }
if (selected === 'manual') {
return [manualStep];
}
@@ -968,6 +1000,34 @@ response = completion(
messages=[{"role": "user", "content": "Tell me a joke"}],
)
print(response.choices[0].message.content)
+`,
+ },
+ ],
+ };
+
+ const googleGenAIVerifyStep: OnboardingStep = {
+ type: StepType.VERIFY,
+ content: [
+ {
+ type: 'text',
+ text: t(
+ 'Verify that agent monitoring is working correctly by making a simple Google Gen AI API call:'
+ ),
+ },
+ {
+ type: 'code',
+ language: 'python',
+ code: `
+from google.genai import Client
+
+client = Client()
+client.models.generate_content(
+ model="gemini-2.0-flash-exp",
+ contents="What's the weather like in San Francisco?"
+)
+
+print(response)
+
`,
},
],
@@ -1025,6 +1085,9 @@ with sentry_sdk.start_span(op="gen_ai.chat", name="chat o3-mini") as span:
if (selected === 'litellm') {
return [liteLLMVerifyStep];
}
+ if (selected === 'google_genai') {
+ return [googleGenAIVerifyStep];
+ }
if (selected === 'manual') {
return [manualVerifyStep];
}
diff --git a/static/app/views/insights/agents/views/onboarding.tsx b/static/app/views/insights/agents/views/onboarding.tsx
index 234bb9d0ca19da..0e7858623573e1 100644
--- a/static/app/views/insights/agents/views/onboarding.tsx
+++ b/static/app/views/insights/agents/views/onboarding.tsx
@@ -250,6 +250,7 @@ export function Onboarding() {
{label: 'OpenAI SDK', value: 'openai'},
{label: 'OpenAI Agents SDK', value: 'openai_agents'},
{label: 'Anthropic SDK', value: 'anthropic'},
+ {label: 'Google Gen AI SDK', value: 'google_genai'},
{label: 'LangChain', value: 'langchain'},
{label: 'LangGraph', value: 'langgraph'},
{label: 'LiteLLM', value: 'litellm'},
diff --git a/static/app/views/performance/newTraceDetails/traceDrawer/details/span/eapSections/aiIOAlert.tsx b/static/app/views/performance/newTraceDetails/traceDrawer/details/span/eapSections/aiIOAlert.tsx
index 1b7ccc3fb2c160..68a194c1d6070d 100644
--- a/static/app/views/performance/newTraceDetails/traceDrawer/details/span/eapSections/aiIOAlert.tsx
+++ b/static/app/views/performance/newTraceDetails/traceDrawer/details/span/eapSections/aiIOAlert.tsx
@@ -32,6 +32,7 @@ const knownSpanOrigins = {
'auto.ai.langgraph',
'auto.ai.anthropic',
'auto.ai.litellm',
+ 'auto.ai.google_genai',
],
javascript: ['auto.ai.anthropic', 'auto.ai.openai', 'auto.vercelai.otel'],
} as const;
@@ -136,6 +137,8 @@ const pythonIntegrationLinks: Record = {
'auto.ai.langgraph': 'https://docs.sentry.io/platforms/python/integrations/langgraph/',
'auto.ai.anthropic': 'https://docs.sentry.io/platforms/python/integrations/anthropic/',
'auto.ai.litellm': 'https://docs.sentry.io/platforms/python/integrations/litellm/',
+ 'auto.ai.google_genai':
+ 'https://docs.sentry.io/platforms/python/integrations/google-genai/',
};
function PythonContent({
From 8e6f14523234c4aff41e5071699c3e8b785e346c Mon Sep 17 00:00:00 2001
From: Ogi <86684834+obostjancic@users.noreply.github.com>
Date: Mon, 13 Oct 2025 17:25:59 +0200
Subject: [PATCH 2/4] add integration
---
static/app/gettingStartedDocs/python/python.tsx | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/static/app/gettingStartedDocs/python/python.tsx b/static/app/gettingStartedDocs/python/python.tsx
index e48ca439df2f83..0d482ac5c9d6af 100644
--- a/static/app/gettingStartedDocs/python/python.tsx
+++ b/static/app/gettingStartedDocs/python/python.tsx
@@ -588,6 +588,7 @@ sentry_sdk.init(
language: 'python',
code: `
import sentry_sdk
+from sentry_sdk.integrations.google_genai import GoogleGenAIIntegration
sentry_sdk.init(
dsn="${params.dsn.public}",
@@ -595,6 +596,9 @@ sentry_sdk.init(
# Add data like inputs and responses to/from LLMs and tools;
# see https://docs.sentry.io/platforms/python/data-management/data-collected/ for more info
send_default_pii=True,
+ integrations=[
+ GoogleGenAIIntegration(),
+ ],
)`,
},
],
@@ -1021,7 +1025,7 @@ print(response.choices[0].message.content)
from google.genai import Client
client = Client()
-client.models.generate_content(
+response = client.models.generate_content(
model="gemini-2.0-flash-exp",
contents="What's the weather like in San Francisco?"
)
From e4ac885494d563fcb6046ed99a646a4dc7e6527c Mon Sep 17 00:00:00 2001
From: Ogi <86684834+obostjancic@users.noreply.github.com>
Date: Mon, 13 Oct 2025 17:31:48 +0200
Subject: [PATCH 3/4] indentation
---
static/app/gettingStartedDocs/python/python.tsx | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/static/app/gettingStartedDocs/python/python.tsx b/static/app/gettingStartedDocs/python/python.tsx
index 0d482ac5c9d6af..0070745985e4a6 100644
--- a/static/app/gettingStartedDocs/python/python.tsx
+++ b/static/app/gettingStartedDocs/python/python.tsx
@@ -1026,8 +1026,8 @@ from google.genai import Client
client = Client()
response = client.models.generate_content(
- model="gemini-2.0-flash-exp",
- contents="What's the weather like in San Francisco?"
+ model="gemini-2.0-flash-exp",
+ contents="What's the weather like in San Francisco?"
)
print(response)
From 3ef972c688f7547c3e56a53cf6a9f2ff2863ca68 Mon Sep 17 00:00:00 2001
From: Ogi <86684834+obostjancic@users.noreply.github.com>
Date: Tue, 14 Oct 2025 10:32:56 +0200
Subject: [PATCH 4/4] fix text
---
static/app/gettingStartedDocs/python/python.tsx | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/static/app/gettingStartedDocs/python/python.tsx b/static/app/gettingStartedDocs/python/python.tsx
index 0070745985e4a6..df4d5c35ad1ac5 100644
--- a/static/app/gettingStartedDocs/python/python.tsx
+++ b/static/app/gettingStartedDocs/python/python.tsx
@@ -579,7 +579,7 @@ sentry_sdk.init(
{
type: 'text',
text: tct(
- 'Import and initialize the Sentry SDK - the GoogleGenAIIntegration will be enabled automatically:',
+ 'Import and initialize the Sentry SDK - add the GoogleGenAIIntegration to your integrations list:',
{code: }
),
},