This release is a pre-release and may not be stable for production use.
benzene-otel
OpenTelemetry integration for Benzene Python. The
port already traces itself — benzene.mesh.trace_middleware emits one TraceEvent per invocation —
but that tracing was Benzene-internal only, feeding a mesh collector rather than a general OTel
pipeline. This package exports it to a real OpenTelemetry SDK, and adds a response-as-event pattern
mirroring .NET's Benzene.ResponseEvents. Depends on benzene-core and benzene-mesh.
pip install "benzene-otel[otel]" # the [otel] extra pulls opentelemetry-api / opentelemetry-sdk
OtelTraceExporter is a benzene.mesh.TraceExporter, so it wires into the existing tracing
middleware — no second instrumentation. Each finished span maps one-to-one onto an OTel span: topic →
span name, started_at/duration_ms → OTel start/end nanoseconds, every field → a benzene.*
attribute, and the semantic status → the OTel span status.
from benzene.mesh import trace_middleware
from benzene.otel import OtelTraceExporter, RecordingSink, response_event_interception
# Trace export: forward the port's own spans to OpenTelemetry (real tracer acquired lazily).
definition.middleware.insert(0, trace_middleware(OtelTraceExporter(), service="orders"))
# Response-as-event: publish each result to a sink after the handler runs.
sink = RecordingSink() # swap for an OTel-log / outbox / audit-topic sink in production
definition.middleware.append(response_event_interception(sink))
OtelTraceExporter— consumes the mesh trace model and pushes eachTraceEventto an injected (or lazily created) OTel tracer. The tracer is a duck-typed seam (OtelTracer/OtelSpan), so a fake tracer exercises it with noopentelemetryinstalled; export is non-blocking and never raises, so a bad tracer can't break the invocation it observes.response_event_interception(sink, *, when=..., include_payload=...)— afterawait next(), emits aResponseEvent(topic, status, correlation id, optional payload) to aResponseEventSink. Emits every result by default; passwhen=lambda r: r.is_successfulfor successes only. A sink that raises is logged and swallowed — emitting an event never breaks the pipeline.RecordingSink— an in-memorylistof emitted events, the fake for tests and dogfooding.
Nothing here needs a collector, a real clock, or the OpenTelemetry package to run in tests: the tracer
and sink are injectable seams, so the whole surface is exercised in memory. Mirrors the role of .NET's
Benzene.Diagnostics OTel wiring and Benzene.ResponseEvents, and contributes the benzene.otel
subpackage to the shared benzene namespace.
Metadata
Release files for benzene-otel 0.1.0b2
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 |
|---|---|---|---|---|
| benzene_otel-0.1.0b2.tar.gz | 8.4 kB | With provenance | Details for benzene_otel-0.1.0b2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| benzene_otel-0.1.0b2-py3-none-any.whl | Python 3 | none | any | Details for benzene_otel-0.1.0b2-py3-none-any.whl |
Total release size: 19.1 kB
Release files / benzene_otel-0.1.0b2.tar.gz
| Download URL | benzene_otel-0.1.0b2.tar.gz |
|---|---|
| Size | 8.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
eb634316f71e61d3bfe1402c98aa4e6387616c6d0a6c79c7c0f75d920d7198b1
|
|
BLAKE2b-256 checksum How to use checksums |
550f1e9ffc46421355de6decf1e303fbfa82039f1495b9109d9e47844535ac1b
|
| 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 16, 2026.
Transparency logRelease files / benzene_otel-0.1.0b2-py3-none-any.whl
| Download URL | benzene_otel-0.1.0b2-py3-none-any.whl |
|---|---|
| Size | 10.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
55f2ae43fd75a521603a5078421d7df4fd9edf4ad2105a1df62b616abfe5187b
|
|
BLAKE2b-256 checksum How to use checksums |
2d4852afc86dcc80cdbb415e99920b24ee0a46c6b4f15bde4378859737714616
|
| 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 16, 2026.
Transparency logSecurity for benzene-otel 0.1.0b2
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.
Attestation for benzene_otel-0.1.0b2.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 16, 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.