Skip to main content

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.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for kensa-sdk 0.1.0
File Size Uploaded Provenance Actions
kensa_sdk-0.1.0.tar.gz 30.4 kB Without provenance Details for kensa_sdk-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for kensa-sdk 0.1.0
File Interpreter ABI Platform Actions
kensa_sdk-0.1.0-py3-none-any.whl Python 3 none any Details for kensa_sdk-0.1.0-py3-none-any.whl

Total release size: 37.0 kB

Release files / kensa_sdk-0.1.0.tar.gz

Download URL kensa_sdk-0.1.0.tar.gz
Size 30.4 kB
Tags Source
SHA-256 checksum
How to use checksums
07a7852d0bcbae110bdfcef820847af4ba6ff9b6808fa6180591145755c9a081
BLAKE2b-256 checksum
How to use checksums
1be949dbabf3f2e8158732326e73a220267927ceda69178d49607d674e816a61
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.0-py3-none-any.whl

Download URL kensa_sdk-0.1.0-py3-none-any.whl
Size 6.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
672c0cce0fc64f3fdfcbef354eeebc89102d8fbe5ff1fae0a26777090679d319
BLAKE2b-256 checksum
How to use checksums
2d299b7450a6d2eb59679fd4d197ac80712e3960b4daae5d08e778b820798fa1
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.0

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.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page