This release is a pre-release and may not be stable for production use.
benzene-mesh
The mesh module for the Benzene Python port.
Make a Python Benzene service a first-class citizen of a Benzene mesh: it describes itself, answers
the reserved benzene:mesh topic, traces every invocation, and reports into a collector — all
optional and additive.
Depends only on benzene-core.
pip install benzene-mesh
Describe the service + answer benzene:mesh
The ServiceDescriptor is derived from your handler registry — it is always the truth of what the
service serves, with a request/response schema per topic and a content hash over the contract:
from benzene.core import BenzeneMessageApplication, MiddlewarePipeline, Registry
from benzene.mesh import ServiceDescriptor, ServiceInfo, mesh_interception
registry = Registry() # ... your handlers, e.g. registry.add(place_order)
descriptor = ServiceDescriptor.derive(
registry,
ServiceInfo(service="orders", service_version="1.4.2", placement={"cloud": "aws"}),
)
pipeline = MiddlewarePipeline().use(mesh_interception(descriptor)) # install before the router
app = BenzeneMessageApplication(registry, pipeline)
# A message on the reserved topic returns status `ok` with the descriptor as payload:
await app.handle({"topic": "benzene:mesh", "headers": {}, "body": ""})
Interception is by topic id alone (version ignored), exactly like health-check interception. Don't install it and the endpoint simply doesn't exist — every other feed keeps working.
Trace every invocation
trace_middleware emits exactly one TraceEvent per invocation — joining an inbound W3C
traceparent trace or starting a fresh one, and recording the topic, the semantic status, and the
duration. Export is asynchronous, non-blocking, and lossy: tracing never breaks the request.
from benzene.mesh import InMemoryTraceExporter, trace_middleware
exporter = InMemoryTraceExporter()
pipeline = (
MiddlewarePipeline()
.use(trace_middleware(exporter, service="orders")) # outermost: times the whole invocation
.use(mesh_interception(descriptor))
)
Report into a collector
MeshFeedSender pushes a service's four mesh feeds to a collector over any outbound MessageSender
(Pub/Sub, SNS, Service Bus, or an HTTP POST) — register announces the descriptor once, and
publish_heartbeat / publish_traces / publish_issues stream the ongoing telemetry:
from benzene.mesh import IssueAggregator, MeshFeedSender
feeds = MeshFeedSender(outbound_client)
await feeds.register(descriptor)
await feeds.publish_traces(exporter) # any iterable of TraceEvent
issues = IssueAggregator(service="orders")
issues.record(topic="order:create", status="service-unavailable", exception_type="HttpError")
await feeds.publish_issues(issues.flush()) # deduplicated failure signatures; count is a delta
Mirrors .NET's Benzene.Mesh, and contributes the benzene.mesh subpackage to the shared benzene
namespace. The wire shapes (descriptor, TraceEvent, collector topics) are the cross-language mesh
contract — a Python service and a .NET/Go/TypeScript one show up in the same mesh.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file benzene_mesh-0.1.0b1.tar.gz.
File metadata
- Download URL: benzene_mesh-0.1.0b1.tar.gz
- Upload date:
- Size: 34.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
58452800494034fdf0e8eeba7dd27c7b9c854ede0faac79482a9404ba4e1b695
|
|
| MD5 |
852894353ea43598bb7e9ef77f184dc9
|
|
| BLAKE2b-256 |
56049d230bddbe865d205b1db97232fd1b9ef88843304256614cc0eb884530c5
|
Provenance
The following attestation bundles were made for benzene_mesh-0.1.0b1.tar.gz:
Publisher:
release.yml on daniellepelley/benzene-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
benzene_mesh-0.1.0b1.tar.gz -
Subject digest:
58452800494034fdf0e8eeba7dd27c7b9c854ede0faac79482a9404ba4e1b695 - Sigstore transparency entry: 2467247097
- Sigstore integration time:
-
Permalink:
daniellepelley/benzene-python@7f3c0d2abeeb3782a82a8e2621ee8b431bf02ca8 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/daniellepelley
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@7f3c0d2abeeb3782a82a8e2621ee8b431bf02ca8 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file benzene_mesh-0.1.0b1-py3-none-any.whl.
File metadata
- Download URL: benzene_mesh-0.1.0b1-py3-none-any.whl
- Upload date:
- Size: 42.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a8aa0db8766d1d2af0568f28b73cf8b4b6efd5b2bd9bbb8d2ef540ef10b84676
|
|
| MD5 |
a552cab229e21af2d5ab38fbf1a5bef2
|
|
| BLAKE2b-256 |
727979256209c6ddb94028e5499ff3ce43ca8532cbe1c1607d1b2b7f29bdea4c
|
Provenance
The following attestation bundles were made for benzene_mesh-0.1.0b1-py3-none-any.whl:
Publisher:
release.yml on daniellepelley/benzene-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
benzene_mesh-0.1.0b1-py3-none-any.whl -
Subject digest:
a8aa0db8766d1d2af0568f28b73cf8b4b6efd5b2bd9bbb8d2ef540ef10b84676 - Sigstore transparency entry: 2467218445
- Sigstore integration time:
-
Permalink:
daniellepelley/benzene-python@7f3c0d2abeeb3782a82a8e2621ee8b431bf02ca8 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/daniellepelley
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@7f3c0d2abeeb3782a82a8e2621ee8b431bf02ca8 -
Trigger Event:
workflow_dispatch
-
Statement type: