Skip to main content

Options

Example — production

Example — local/offline

For CI, local development without network to the TruLayer backend, or sandboxed tests:
Or point at a mock server:

Sampling

sample_rate=0.1 means 10% of traces are sent. Sampling is applied per trace (not per span), so a sampled trace always contains all of its spans. For deterministic sampling (same trace always in or out based on its ID), use the SDK’s default hash-based sampler. For random sampling, pass a callable:

Flush control

Manual flush (useful in tests):
Shutdown (wait for flush + stop background thread):