Skip to main content

tracebloc-telemetry

Contract-conformant telemetry for tracebloc services. Implements RFC-BACKEND-1872 D2; the normative rules are rfcs/specs/backend-1872-telemetry-contract.md.

from tracebloc_telemetry import configure, emit

configure(service="backend", component="web")            # once, at startup
emit("api.request.failed", error_type="upstream_timeout")     # per occurrence

That is the whole surface for a service, and that is the point of the ticket: a service adopts telemetry by importing this and nothing else. No exporter construction, no resource assembly, no field-naming decisions at the call site — those are the three things every service currently does differently, and the difference is the defect the epic exists to close.

Two registered services in one process: build()

configure() sets ONE process-global identity, which is right for a process that is one service and wrong for a process that hosts two. That case is real: gateway (§10.1) is the telemetry ingress and it runs inside the backend's own Django workers. Calling configure(service="gateway", …) there would relabel every backend record in the process — the emitter that exists to stop a service topology being built from accidents would have manufactured one.

from tracebloc_telemetry import build

GATEWAY = build(service="gateway", component="ingress", environment=env)
GATEWAY.emit("gateway.batch.rejected", severity="WARN", error_type="permission")

build() is configure() without the global assignment — same registry checks, same resource assembly, same export decision — and the caller keeps the object. configure() is implemented as build() plus the assignment, so the two can never disagree about how a resource is put together. Use configure() at a process entry point and build() for anything else (backend#2398).

Why it raises

The spec marks a dozen rules mechanically checkable. They are checked here, at emission, and a violation raises. A malformed telemetry record is a programming error; a warning in a log nobody reads is precisely how the current state was reached — 28,413 error traces collapsing to 12,254 distinct messages, 4,300+ records with no environment, one service split in half by the case of a free-text field.

Enforced: the <domain>.<object>.<outcome> grammar with its closed vocabularies, the attribute-key namespace, retired field names, value types, and the error set a failure record must carry (including the stacktrace — 0.2% carry one today).

Why the exporter is optional

The OpenTelemetry SDK is an extra (pip install tracebloc-telemetry[otlp]). Without it, every contract rule is still enforced and records go to the standard library logger.

Two things follow. A service can adopt the contract and test against it before changing a single runtime dependency — which is what keeps this ticket independent of the four migrations it unblocks. And local and ci cannot export by accident, because they must never reach the hub (spec §3.2).

What this does NOT do: redaction

It applies none. Values are checked for type and bounded to 2,048 characters; nothing inspects their content, and a 2,048-character bound does nothing to a customer cell value, which is short.

This matters because §8.4 requires exception.message and exception.stacktrace together once either is present — the two fields likeliest to carry a raw value. backend#1879 found the live version of that (raw customer cell values reaching central App Insights from prod), and the policy line lives in data-ingestors/tracebloc_ingestor/utils/redaction.py: cell values never appear in errors or logs; column names, file names, counts, dtypes and row indices may.

Collector-side redaction is backend#1908. Until it lands, keeping customer data out of an exception message is the caller's guarantee, not this package's.

Where this lives, and where it is going

It lives in backend/ today and is developed and tested here. It carries its own pyproject.toml so that extraction is a move rather than a rewrite.

It is not yet consumable by the other three Python services, which are separate repositories — that needs a repo of its own and a PyPI publish path through the release train, and it needs org-admin action to create. Until then backend#1898 consumes it in-tree and #1899/#1900/#1901 wait. This is a stated limitation, not an oversight.

The one thing CI cannot check

The registry in _registry.py is a copy of the spec's tables, and the spec is in a different repository, so nothing in this repo's CI can prove the two still agree. Keeping them in step is a review rule.

Everything decidable from inside this repo is checked: the vocabularies are closed and internally consistent, every domain/outcome pair forms a legal event name, and — the one that matters — the environment classification is derived from the backend's own _KNOWN_ENVS dispatcher tuple rather than restated, so adding an environment there fails this package's tests until someone decides whether it exports. Vendoring the spec's tables as a generated data file is the fix for the rest, and is a follow-up.

Metadata

Release files for tracebloc-telemetry 0.2.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 tracebloc-telemetry 0.2.0
File Size Uploaded Provenance Actions
tracebloc_telemetry-0.2.0.tar.gz 48.2 kB With provenance Details for tracebloc_telemetry-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for tracebloc-telemetry 0.2.0
File Interpreter ABI Platform Actions
tracebloc_telemetry-0.2.0-py3-none-any.whl Python 3 none any Details for tracebloc_telemetry-0.2.0-py3-none-any.whl

Total release size: 75.7 kB

Release files / tracebloc_telemetry-0.2.0.tar.gz

Download URL tracebloc_telemetry-0.2.0.tar.gz
Size 48.2 kB
Tags Source
SHA-256 checksum
How to use checksums
d2c010a251ab064ce5ceffc4c268ce95d0c36d58f50e5732ceda08ed07f72162
BLAKE2b-256 checksum
How to use checksums
7fcfe6684d167fd91abc97758cd57b37cafd9f102b0344777309199e2115085f
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 Nov 5, 2026.

Transparency log

Release files / tracebloc_telemetry-0.2.0-py3-none-any.whl

Download URL tracebloc_telemetry-0.2.0-py3-none-any.whl
Size 27.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
47cd6a9f524fc2c29d32c06c5711298d4a25335e9e9f31a3fc00398677205c7a
BLAKE2b-256 checksum
How to use checksums
df1a24de3ede79743861a0e9c1a17f7f00585cde1b72ca7fcd185d6b82dd36a4
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 Nov 5, 2026.

Transparency log

Security for tracebloc-telemetry 0.2.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.

Select from 2 files

Attestation for tracebloc_telemetry-0.2.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 5, 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.

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