diff --git a/static/app/gettingStartedDocs/python/python.tsx b/static/app/gettingStartedDocs/python/python.tsx index 9f4f631b61d5ee..df4d5c35ad1ac5 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 - add the GoogleGenAIIntegration to your integrations list:', + {code: } ), }, { @@ -590,9 +588,18 @@ sentry_sdk.init( language: 'python', code: ` import sentry_sdk +from sentry_sdk.integrations.google_genai import GoogleGenAIIntegration -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, + integrations=[ + GoogleGenAIIntegration(), + ], +)`, }, ], }; @@ -724,6 +731,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 +773,9 @@ sentry_sdk.init( if (selected === 'litellm') { return [liteLLMStep]; } + if (selected === 'google_genai') { + return [googleGenAIStep]; + } if (selected === 'manual') { return [manualStep]; } @@ -968,6 +1004,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() +response = client.models.generate_content( + model="gemini-2.0-flash-exp", + contents="What's the weather like in San Francisco?" +) + +print(response) + `, }, ], @@ -1025,6 +1089,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({