Client class. This gives you full control over initialization, trace submission, scoring, and lifecycle management.
Programmatic initialization
pandaprobe.init() parameters:
| Parameter | Type | Default | Description |
|---|---|---|---|
api_key | str | None | From env | PandaProbe API key |
project_name | str | None | From env | Project name |
endpoint | str | None | https://api.pandaprobe.com | Backend URL |
environment | str | None | From env | Environment tag (e.g., "production") |
release | str | None | From env | Release/version tag |
enabled | bool | None | True | Enable/disable SDK |
batch_size | int | None | 10 | Traces per flush batch |
flush_interval | float | None | 5.0 | Seconds between automatic flushes |
max_queue_size | int | None | 1000 | Max queued items before dropping |
debug | bool | None | False | Enable verbose debug logging |
Client instance and sets it as the global singleton.
If
init() is called when a client already exists, the existing client is shut down and replaced.Creating traces via Client
client.trace() has the same signature as pandaprobe.start_trace().
- Module API
- Client instance
Submitting pre-built traces
When to use `log_trace`
When to use `log_trace`
Use pre-built
TraceData when traces are assembled offline, replayed from logs, or produced by frameworks that already materialize a full trace object.Scoring
Lifecycle management
Error handling
Register callbacks to be notified of transport errors:Properties
client.enabled—bool, whether the SDK is activeclient.config—SdkConfig, the resolved configuration (frozen dataclass)
Auto-initialization
The global client auto-initializes from environment variables on first use. You only need to callpandaprobe.init() if you want to configure the SDK programmatically or override environment variables.
pandaprobe.get_client() returns None if auto-init fails (e.g., missing API key). pandaprobe.start_trace() raises RuntimeError if no client is available.