Setup
Enable instrumentation with a single function call. This will automatically track all subsequent calls toGenerativeModel.
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:| Field | Description |
|---|---|
gen_ai.system | gemini |
gen_ai.request.model | Model name (e.g., gemini-pro) |
gen_ai.prompt | Input prompt text |
gen_ai.completion | Generated response |
gen_ai.usage.input_tokens | Prompt token count |
gen_ai.usage.output_tokens | Completion token count |
duration | Request latency |

