Skip to main content
The SDK provides seamless instrumentation for the Google Gemini Python client.

Setup

Enable instrumentation with a single function call. This will automatically track all subsequent calls to GenerativeModel.

Usage

Once instrumented, use the Gemini client as you normally would. The SDK automatically captures:
  • Model name
  • Input prompts
  • Generated content
  • Token usage
  • Latency

Synchronous

Asynchronous

Streaming

Streaming responses are also supported and will be fully tracked once the stream completes.

Captured Data

The integration automatically records:
FieldDescription
gen_ai.systemgemini
gen_ai.request.modelModel name (e.g., gemini-pro)
gen_ai.promptInput prompt text
gen_ai.completionGenerated response
gen_ai.usage.input_tokensPrompt token count
gen_ai.usage.output_tokensCompletion token count
durationRequest latency