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

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.1.1
File Size Uploaded Provenance
tracebloc_telemetry-0.1.1.tar.gz 48.1 kB With provenance Details

Built distribution (wheel)

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

Total release size: 75.5 kB

Release files / tracebloc_telemetry-0.1.1.tar.gz

Download URL tracebloc_telemetry-0.1.1.tar.gz
Size 48.1 kB
Tags Source
SHA-256 checksum
How to use checksums
4e302693768c575af78c1291260fac068940ece21b7ec0c216689770630fadc2
BLAKE2b-256 checksum
How to use checksums
5a3b4489a23f0adc3bb653d7d4e21070b54ac3f188a6d722a012e6b6b416bdce
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 17, 2026.

Transparency log

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

Download URL tracebloc_telemetry-0.1.1-py3-none-any.whl
Size 27.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1dc49145456d9091aaeaaf3adbfa2c24a8e8b4bf1363c63cf5cb4455ebac832b
BLAKE2b-256 checksum
How to use checksums
7905615b7a4abb6ddb6c94925f18cd5914e5a7012905ac429c52be00de34c94f
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 17, 2026.

Transparency log

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

Full provenance

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

Select from 2 files

Attestation for tracebloc_telemetry-0.1.1.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 17, 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.

Release history Release notifications | RSS feed

This release

0.1.1 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