AI tracing: Gemini
Trace Gemini calls made with the Google Gen AI SDK, on the Gemini API or Vertex AI.
1. Install the instrumentation
Set up your service as in Connect first; this adds the Gemini part.
pip install google-genai opentelemetry-instrumentation-google-genai2. Turn it on at start-up
Call it once, before you create the client. It covers both the Gemini API and Vertex AI clients.
from opentelemetry.instrumentation.google_genai import GoogleGenAiSdkInstrumentor
GoogleGenAiSdkInstrumentor().instrument()3. Keep the messages
Leave this out to send counts and timings only.
OTEL_SEMCONV_STABILITY_OPT_IN=gen_ai_latest_experimental
OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT=span_onlyIn Node.js, call Gemini through the Vercel AI SDK or OpenLLMetry to get the same spans. Gemini models have no built-in price in PowerTraces: set yours in AI › Settings.
Prompts and answers
Most libraries send only counts and timings until you turn content on. When you do, PowerTraces keeps it, masks personal data, or drops it, as set in AI › Settings for each workspace.
Check it works
Make one model call, then open the AI page: the run appears within a minute. Open it to see each step in the Agent tab.