traceiq (Python)
Server-side TraceIQ SDK for Python (3.8+). Pure standard library — no dependencies. Events are queued and flushed in batches by a background thread, so your code never blocks on the network.
Install
pip install traceiq-py
The package installs as traceiq-py and imports as traceiq.
Quickstart
from traceiq import Client
traceiq = Client(
project_id="YOUR_PROJECT_ID",
write_key="YOUR_WRITE_KEY", # keep server keys secret
endpoint="https://your-traceiq-api.example.com", # defaults to http://localhost:4000
)
# A trustworthy revenue event, straight from your payments service:
traceiq.capture(
"payout_succeeded",
user_id="user_123",
properties={"amount": 50000, "currency": "NGN"},
)
traceiq.identify("user_123", traits={"email": "a@b.com", "kyc_tier": 2})
traceiq.group("org_9", user_id="user_123", traits={"plan": "growth"})
traceiq.shutdown() # flush before a short-lived process exits
The client also registers an atexit flush, so long-running services generally don't
need to call shutdown() explicitly.
API
| Method | Purpose |
|---|---|
capture(event, user_id=None, anonymous_id=None, properties=None, context=None, timestamp=None) |
Track an event. |
identify(user_id, traits=None, timestamp=None) |
Create/update a user profile. |
alias(user_id, previous_id, timestamp=None) |
Link another ID for the same person (e.g. a guest ID) to user_id. |
group(organization_id, user_id=None, anonymous_id=None, traits=None, timestamp=None) |
Associate a user with an account. |
log(level, message, service=None, user_id=None, error=None, **metadata) |
Send a structured line to Logs. level is debug, info, warn, error or fatal. |
is_feature_enabled(key, distinct_id, default=False, properties=None, environment=None, track_exposure=True) |
Whether a feature flag is on for a user. Returns default if flags can't be evaluated. |
get_feature_flag_payload(key, distinct_id, default=None, ...) |
A flag's remote-config payload when it is on, else default. |
evaluate_flags(distinct_id, properties=None, environment=None) |
Every flag for a user: {"flags", "payloads", "details"}. |
track_flag_exposure(key, distinct_id, enabled, environment=None, properties=None) |
Record a flag exposure yourself (the helpers above do it unless track_exposure=False). |
flush() |
Send everything queued now (blocks). |
shutdown() |
Stop the worker and flush. |
traceiq.log("error", "Payout provider timed out", provider="stripe", error=exc)
if traceiq.is_feature_enabled("new-payouts", "user_123", properties={"plan": "pro"}):
...
Flag calls are synchronous HTTP requests (one per call), so evaluate once per request and
reuse the result, for example with evaluate_flags().
Request timing (Django, Flask, FastAPI)
traceiq.middleware times every request and reports it as a server timing, the same number your
logs and Postman show. It appears under Server in API performance. The browser SDK reports a
different number (the full round trip from the visitor's device) and the dashboard keeps the two apart.
# Django: settings.py
from traceiq import Client
TRACEIQ_CLIENT = Client(project_id="proj_...", write_key="trq_...",
endpoint="https://api.traceiq.run", service_name="my-api")
TRACEIQ_MIDDLEWARE = { # optional
"resolve_user_id": lambda request: request.user.email if request.user.is_authenticated else None,
"ignore": lambda request: request.path == "/health/",
}
MIDDLEWARE = [
"traceiq.middleware.DjangoMiddleware", # near the top, so it times the middleware below it
# ...
]
# Flask or any WSGI app
from traceiq.middleware import WSGIMiddleware
app.wsgi_app = WSGIMiddleware(app.wsgi_app, traceiq)
# FastAPI, Starlette or any ASGI app
from traceiq.middleware import ASGIMiddleware
app.add_middleware(ASGIMiddleware, client=traceiq)
Routes are templates (/api/pay/verify/:ref/), not raw URLs, so requests group instead of
exploding per id. Django and FastAPI report their own template; for Flask and other WSGI apps ids
are collapsed (/orders/42 becomes /orders/:id), or pass route=lambda environ: ....
resolve_user_id should return the same id your frontend passes to identify().
Options: ignore, resolve_user_id, service, environment, route, include_page_requests,
request_id_header ("x-request-id"), echo_request_id (True). Static files and HTML pages are
skipped. The middleware reads the incoming x-request-id and traceparent headers, so a request joins
the trace that started in the browser, and traceiq.middleware.get_trace_headers() gives you a
traceparent to send on calls your handler makes to other services. It never reads headers, query
strings or bodies, and a failure inside it never reaches your request.
Options
endpoint, flush_at (20), flush_interval (10.0s), max_retries (3),
timeout (10.0s), debug (False), on_error (callback), service_name ("server") and
environment ("production") stamped on log lines.
Delivery is at-most-once; a batch that fails after max_retries is dropped and passed
to on_error. properties["amount"] (a number) powers the dashboard's revenue metrics.
Metadata
Release files for traceiq-py 0.3.0
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 |
|---|---|---|---|---|
| traceiq_py-0.3.0.tar.gz | 22.5 kB | With provenance | Details for traceiq_py-0.3.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| traceiq_py-0.3.0-py3-none-any.whl | Python 3 | none | any | Details for traceiq_py-0.3.0-py3-none-any.whl |
Total release size: 37.4 kB
Release files / traceiq_py-0.3.0.tar.gz
| Download URL | traceiq_py-0.3.0.tar.gz |
|---|---|
| Size | 22.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6f945f0f5b165ba246dd9c35b0d6b6ffaebd04556d548dce001999a2e51f8eb0
|
|
BLAKE2b-256 checksum How to use checksums |
3fbb9186e2e28530dbaa7622af523a8601d73fec3796e274117fb7955f9d0bf8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 Nov 1, 2026.
Transparency logRelease files / traceiq_py-0.3.0-py3-none-any.whl
| Download URL | traceiq_py-0.3.0-py3-none-any.whl |
|---|---|
| Size | 14.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
31d2ce47abe285b24b6677ef35dd31f3c9968c0f57d31e2c3c855fe4e39fe6be
|
|
BLAKE2b-256 checksum How to use checksums |
8a9581fe89b222513231d3613afeeefab0c9ef035e648949ca7ef83745da7ae6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 Nov 1, 2026.
Transparency logSecurity for traceiq-py 0.3.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
Both files in this release have been uploaded with provenance metadata.
Attestation for traceiq_py-0.3.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 Nov 1, 2026.
Transparency logA 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.