Client class. This gives you full control over initialization, trace submission, scoring, and lifecycle management.
Python client API
Programmatic initialization
Python
pandaprobe.init() parameters:
Returns the configured
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
Python
Submitting pre-built traces
Python
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
Python
Lifecycle management
Error handling
Register callbacks to be notified of transport errors:Python
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.
Python
pandaprobe.get_client() returns None if auto-init fails (e.g., missing API key). pandaprobe.start_trace() raises RuntimeError if no client is available.
TypeScript client API
Programmatic initialization
TypeScript
init() sets and returns the global singleton. getClient() returns that client or attempts one-time initialization from environment variables.
Creating traces with a client
TypeScript
withTrace() and withSpan(); they provide the same callback lifecycle with less client plumbing.
Submitting pre-built traces
TypeScript
Scoring and lifecycle
TypeScript
enabled and config properties expose the resolved client state. TypeScript configuration is frozen after initialization; call init() again to replace the global client.
