Raindrop observability integration for Azure OpenAI
Project description
raindrop-azure-openai
Raindrop observability integration for Azure OpenAI (Python). Automatically captures chat.completions.create() calls by wrapping AzureOpenAI and AsyncAzureOpenAI clients.
Installation
pip install raindrop-azure-openai openai
Quick Start
from raindrop_azure_openai import RaindropAzureOpenAI
from openai import AzureOpenAI
raindrop = RaindropAzureOpenAI(
api_key="rk_...",
user_id="user-123",
debug=False, # set True for verbose logging
)
client = AzureOpenAI(
azure_endpoint="https://your-resource.openai.azure.com",
api_key="...",
api_version="2024-10-21",
)
wrapped = raindrop.wrap(client)
response = wrapped.chat.completions.create(
model="gpt-4o-mini",
messages=[{"role": "user", "content": "Hello!"}],
)
raindrop.shutdown()
Debug Mode
raindrop = RaindropAzureOpenAI(api_key="rk_...", debug=True)
When debug=True, verbose logs are emitted to the raindrop_azure_openai logger at DEBUG level.
Async Support
from raindrop_azure_openai import RaindropAzureOpenAI
from openai import AsyncAzureOpenAI
raindrop = RaindropAzureOpenAI(api_key="rk_...", user_id="user-123")
client = AsyncAzureOpenAI(
azure_endpoint="https://your-resource.openai.azure.com",
api_key="...",
api_version="2024-10-21",
)
wrapped = raindrop.wrap(client)
response = await wrapped.chat.completions.create(
model="gpt-4o-mini",
messages=[{"role": "user", "content": "Hello!"}],
)
raindrop.shutdown()
User Identification
raindrop.identify("user-123", traits={"plan": "pro", "name": "Alice"})
Tracking Signals
raindrop.track_signal(
event_id="evt-abc",
name="thumbs_up",
signal_type="feedback",
sentiment="POSITIVE",
comment="Great response!",
)
Flushing and Shutdown
raindrop.flush() # flush pending data
raindrop.shutdown() # flush + release resources
Factory Function (Backwards-Compatible)
from raindrop_azure_openai import create_raindrop_azure_openai
raindrop = create_raindrop_azure_openai(api_key="rk_...", user_id="user-123")
# raindrop is now a RaindropAzureOpenAI instance with .wrap(), .flush(), .shutdown()
What Gets Captured
- Chat completions — input messages, output text, model, token usage
- Finish reason —
azure_openai.finish_reason(stop,length,content_filter,tool_calls) - Extended tokens —
ai.usage.cached_tokens(prompt cache hits) andai.usage.thoughts_tokens(reasoning tokens for o1/o3 models) - Errors — error type and message captured as properties, then re-raised to the caller
- Async support — both sync (
AzureOpenAI) and async (AsyncAzureOpenAI) clients are instrumented
Configuration
| Option | Type | Default | Description |
|---|---|---|---|
api_key |
str | None |
None |
Raindrop API key. None disables telemetry shipping |
user_id |
str | None |
None |
Associate all events with a user (falls back to "unknown") |
convo_id |
str | None |
None |
Group events into a conversation |
tracing_enabled |
bool |
True |
Enable OTEL-based tracing |
bypass_otel_for_tools |
bool |
True |
Bypass OTEL for tool calls |
debug |
bool |
False |
Enable verbose debug logging |
Double-Wrap Protection
Calling wrap() on an already-instrumented client is a safe no-op — the client is returned unchanged.
Full Documentation
See the Raindrop docs for the complete reference.
Testing
cd packages/azure-openai-python
pip install -e ".[dev]"
python -m pytest tests/ -v
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file raindrop_azure_openai-0.0.3.tar.gz.
File metadata
- Download URL: raindrop_azure_openai-0.0.3.tar.gz
- Upload date:
- Size: 16.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f4ab435de160a377c395c0c5550045277596c671dfb70a1c9e27cb007234bb29
|
|
| MD5 |
b29b9e5266d08cd6a679be987f948093
|
|
| BLAKE2b-256 |
be1a0e088ea9ae880a26d43a5019065d6e91c21922af744668e52957c27fae18
|
File details
Details for the file raindrop_azure_openai-0.0.3-py3-none-any.whl.
File metadata
- Download URL: raindrop_azure_openai-0.0.3-py3-none-any.whl
- Upload date:
- Size: 8.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
600d4102f07634fb8f93797a46ef675521470c2b5aad4d4632ec496adc545400
|
|
| MD5 |
c0cb5be6ad997ac3ec9c3a89efdbfbb9
|
|
| BLAKE2b-256 |
4165f8f4b9c285b82eb1680c5dd25d238394055e63add9c34a8c1e48963592d1
|