Installation
To install the SDK, run:
Initialize Client
Begin by initializing the via Constructor ArgumentsKey configuration options:
ABV client. You must provide your ABV api key. These can be passed as constructor arguments or set as environment variables (recommended).If you are using a data region other than the US default (e.g., EU: https://eu.app.abv.dev), ensure you configure the host argument or the ABV_HOST environment variable (recommended).via Environment Variables (recommended).env
If you are reinstantiating the ABV client with different constructor arguments in the same process, the new configuration will be used for all subsequent calls.
| Constructor Argument | Environment Variable | Description | Default value |
|---|---|---|---|
api_key | ABV_API_KEY | Your ABV project’s secret API key. Required. | |
host | ABV_HOST | The API host for your ABV instance. | "https://app.abv.dev" |
timeout | ABV_TIMEOUT | Timeout in seconds for API requests. | 5 |
httpx_client | - | Custom httpx.Client for making non-tracing HTTP requests. | |
debug | ABV_DEBUG | Enables debug mode for more verbose logging. Set to True or "True". | False |
tracing_enabled | ABV_TRACING_ENABLED | Enables or disables the ABV client. If False, all observability calls become no-ops. | True |
flush_at | ABV_FLUSH_AT | Number of spans to batch before sending to the API. | 512 |
flush_interval | ABV_FLUSH_INTERVAL | Time in seconds between batch flushes. | 5 |
environment | ABV_TRACING_ENVIRONMENT | Environment name for tracing (e.g., “development”, “staging”, “production”). Must be lowercase alphanumeric with hyphens/underscores. | "default" |
release | ABV_RELEASE | Release version/hash of your application. Used for grouping analytics. | |
media_upload_thread_count | ABV_MEDIA_UPLOAD_THREAD_COUNT | Number of background threads for handling media uploads. | 1 |
sample_rate | ABV_SAMPLE_RATE | Sampling rate for traces (float between 0.0 and 1.0). 1.0 means 100% of traces are sampled. | 1.0 |
mask | - | A function (data: Any) -> Any to mask sensitive data in traces before sending to the API. | |
ABV_MEDIA_UPLOAD_ENABLED | Whether to upload media files to ABV S3. | True |
Accessing the Client Globally
The ABV client is a singleton. It can be accessed anywhere in your application using theget_client function.
Optionally, you can initialize the client via ABV() to pass in configuration options (see above). Otherwise, it is created automatically when you call get_client() based on environment variables.