Skip to main content

tracelet-sdk (Python)

Tags each database query with the request that ran it, so Tracelet can show per-request waterfalls and catch N+1 loops. Zero dependencies. Python 3.8+.

pip install tracelet-sdk

Django

MIDDLEWARE = [
    "tracelet_sdk.django.TraceletMiddleware",
    # ...
]

That's all. Every query Django runs during a request carries the URL pattern (GET /users/<int:pk>/) and a trace id.

Flask

from tracelet_sdk.flask import instrument
from tracelet_sdk.sqlalchemy import instrument as instrument_engine

instrument(app)
instrument_engine(db.engine)  # Flask-SQLAlchemy, or any SQLAlchemy engine

FastAPI / Starlette / any ASGI app

from tracelet_sdk.asgi import TraceletMiddleware
from tracelet_sdk.sqlalchemy import instrument

app.add_middleware(TraceletMiddleware)  # reads the matched FastAPI route
instrument(engine)

Plain WSGI apps can use tracelet_sdk.wsgi.TraceletMiddleware(app, route=...).

Anything else

import tracelet_sdk

with tracelet_sdk.request(route="POST /import"):
    cursor.execute(tracelet_sdk.comment("SELECT * FROM jobs WHERE id = %s", escape_percent=True), (job_id,))

Pass escape_percent=True when the driver %-formats the query (psycopg, MySQLdb and Django with parameters). The comment's URL-encoded values contain %, which must then be doubled. The Django and SQLAlchemy integrations do this for you.

Notes

  • Traces: an incoming traceparent header is continued, so traces line up with OpenTelemetry.
  • No raw URLs: paths are never recorded, so ids and other values in them don't end up in your stats.
  • Existing comments: SQL that already contains a comment is left unchanged, as the sqlcommenter spec requires.
  • Streaming responses: in WSGI, queries made while a streamed response is iterated are not tagged.

Metadata

Release files for tracelet-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 tracelet-sdk 0.1.0
File Size Uploaded Provenance Actions
tracelet_sdk-0.1.0.tar.gz 9.0 kB With provenance Details for tracelet_sdk-0.1.0.tar.gz

Built distribution (wheel)

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

Total release size: 16.8 kB

Release files / tracelet_sdk-0.1.0.tar.gz

Download URL tracelet_sdk-0.1.0.tar.gz
Size 9.0 kB
Tags Source
SHA-256 checksum
How to use checksums
9a91577a19b3d6961c75f690d0cacfca7c7642b79ba5a8457611ae0019e5cfe9
BLAKE2b-256 checksum
How to use checksums
f7eeb335f9970c446e536d560b6f43c7735cde1f332b7aff405ffdce47df7ad0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 19, 2026.

Transparency log

Release files / tracelet_sdk-0.1.0-py3-none-any.whl

Download URL tracelet_sdk-0.1.0-py3-none-any.whl
Size 7.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7a8ab5e74dde368a11b5eb51d01e853b8cdf6001dc3e1e5fc2f29ea76371e2f3
BLAKE2b-256 checksum
How to use checksums
b7a81bf262b0d15990cb5f7e79681b9ba060b8305ee23d3383568f23b4b0cf6d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 19, 2026.

Transparency log

Security for tracelet-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.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for tracelet_sdk-0.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 19, 2026.

Transparency log

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 Full 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