Installation
Quick Start
What Gets Traced
- generateContent — input text (user messages only), output, model, token usage (promptTokenCount/candidatesTokenCount)
- Cached tokens —
cached_content_token_countfrom usage metadata →ai.usage.cached_tokens - Thinking tokens —
thoughts_token_countfrom usage metadata (Gemini 2.5) →ai.usage.thoughts_tokens - Finish reason —
candidate.finish_reason(STOP, MAX_TOKENS, SAFETY, RECITATION) →vertex_ai.finish_reason - Errors — captured with error status, re-thrown to caller
Configuration
Projects
Route events to a specific project by passing its slug asprojectId (project_id in Python):
X-Raindrop-Project-Id header on every event. Omit it (or pass "default") to use your org’s default Production project, which is the existing behavior. Single-project orgs need nothing new.
Multiple projects in one process
Available inraindrop-ai>=0.0.56. When one service wraps several Vertex AI
clients that should report to different projects, create one
RaindropVertexAI wrapper per project. Each wrapper owns its own
raindrop.Raindrop client, so the two route independently — there is no shared
module-level state:
raindrop.Raindrop yourself and
pass it via client=:
identify()
track_signal()
Flushing and Shutdown
finish_reason Tracking
The Python wrapper capturescandidate.finish_reason from Vertex AI responses and maps it to vertex_ai.finish_reason in event properties. Possible values: STOP, MAX_TOKENS, SAFETY, RECITATION.
Token Tracking
The following token usage fields are captured fromusage_metadata:
Factory Function
Acreate_raindrop_vertex_ai() factory is also available:
Known Limitations
- Python SDK: No
events.*API — useraindrop.analyticsdirectly.identify()andtrack_signal()are available on the wrapper instance. - Streaming:
generateContentStream()is not instrumented. OnlygenerateContent()is traced.