kensa-sdk
Send your agent's OpenTelemetry traces to Kensa.
pip install kensa-sdk
The package installs as kensa-sdk and imports as kensa.
Quick start
import os
import kensa
kensa.init(api_key=os.environ.get("KENSA_API_KEY"))
Spans are sent in the background. Automatic process-exit cleanup uses OpenTelemetry's standard shutdown, which currently waits up to 30 seconds to drain its queue. Slow exports can therefore leave queued spans unsent, even though each export allows 120 seconds.
For a finite run, stop producing spans and call kensa.flush() before exiting. In a
serverless function, flush before the response ends. The installed OpenTelemetry processor
does not enforce an overall flush deadline, so multiple batches can take longer than
120 seconds to drain.
kensa.flush()
kensa.init() sends spans; your existing instrumentation produces them. Without an API
key it does nothing and logs a warning, and nothing the SDK does raises into your
application.
Already using OpenTelemetry?
kensa.init() attaches to the tracer provider your application installed instead of
replacing it, so call it after that provider is set up. Pass provider= if you have
not registered yours globally:
kensa.init(api_key=os.environ.get("KENSA_API_KEY"), provider=my_provider)
Your provider's resource is fixed when it is created, so set the service name,
service.version, and deployment.environment.name on it yourself, from your
platform's variables (table below); Kensa logs a warning when the deployment is
missing. service_name only applies when Kensa installs its own provider.
Configuration
| Setting | Set with | Default |
|---|---|---|
| API key | init(api_key=...) or KENSA_API_KEY |
Required |
| Service name | init(service_name=...) or OTEL_SERVICE_NAME |
unknown_service |
| Deployment | OTEL_RESOURCE_ATTRIBUTES |
Detected from your platform |
Kensa checks a fix against the traces from the deployment that shipped it, so it needs
the deployed commit and the environment. kensa.init() detects them:
| Platform | Commit | Environment |
|---|---|---|
| Vercel | VERCEL_GIT_COMMIT_SHA |
VERCEL_ENV |
| Railway | RAILWAY_GIT_COMMIT_SHA |
RAILWAY_ENVIRONMENT_NAME |
| Render | RENDER_GIT_COMMIT |
On Render, set the environment yourself (below). CI and local runs are never detected as a deployment.
Anywhere else, or to override detection, set the standard OpenTelemetry variable:
OTEL_RESOURCE_ATTRIBUTES="service.version=<commit sha>,deployment.environment.name=production"
Requires Python 3.12 or later.
Metadata
Release files for kensa-sdk 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| kensa_sdk-0.1.1.tar.gz | 30.4 kB | Without provenance | Details for kensa_sdk-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| kensa_sdk-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for kensa_sdk-0.1.1-py3-none-any.whl |
Total release size: 37.1 kB
Release files / kensa_sdk-0.1.1.tar.gz
| Download URL | kensa_sdk-0.1.1.tar.gz |
|---|---|
| Size | 30.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e9e0ce67a6b7aeb43ca6aea8a41d3e560a941985765d11ae8aaf1476b82799c5
|
|
BLAKE2b-256 checksum How to use checksums |
cc02c77448704d2967be0272dbaeea7dfa493b64c41d43f2818cd9552a13d9b5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.28 {"installer":{"name":"uv","version":"0.11.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / kensa_sdk-0.1.1-py3-none-any.whl
| Download URL | kensa_sdk-0.1.1-py3-none-any.whl |
|---|---|
| Size | 6.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
17223fa2ef659089246fd60a818c62f8506b1d459854e11dd01a066ffe7e7e82
|
|
BLAKE2b-256 checksum How to use checksums |
5509fdc83006009fbec092c69029fde57e508334ee75897e733a6c68d33bb0f7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.28 {"installer":{"name":"uv","version":"0.11.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Security for kensa-sdk 0.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.