hexastack-otel
Vendor-agnostic OpenTelemetry distributed tracing and CQRS telemetry middleware for Hexastack.
Part of the Hexastack Framework.
1. Architectural Overview
hexastack-otel provides a pure hexagonal port interface (TracingPort) backed by the official OpenTelemetry Python SDK.
It enables 100% vendor-agnostic distributed tracing, automatically linking correlation IDs and creating spans across CQRS Command/Query executions, HTTP endpoints, and gRPC RPCs.
graph TD
CQRS["CQRS Command / Query Dispatch"]
MW["TracingMiddleware (order=12)"]
PORT["TracingPort"]
OTEL["OtelTracingAdapter\n(OpenTelemetry SDK)"]
MEM["InMemoryTracingAdapter\n(Test Isolation)"]
OTLP["OTLP Exporter\n(gRPC / HTTP)"]
COLLECTOR["OTel Collector / Jaeger / Grafana Tempo / Sift"]
CQRS --> MW
MW --> PORT
PORT -.-> OTEL
PORT -.-> MEM
OTEL --> OTLP
OTLP --> COLLECTOR
2. Quickstart
Installation
# Core OpenTelemetry SDK & TracingPort
pip install hexastack-otel
# With OTLP Protobuf Exporters (gRPC & HTTP)
pip install hexastack-otel[otlp]
Configuration (hexastack.toml or pyproject.toml)
[hexastack.otel]
service_name = "order-service"
endpoint = "http://localhost:4317"
exporter = "otlp_grpc" # "memory", "console", "otlp_grpc", "otlp_http"
sample_rate = 1.0
enabled = true
3. Automatic CQRS Tracing & Dynamic Feature Flagging
The TracingMiddleware automatically wraps every dispatched command or query in a scoped span:
- Dynamic Feature Flag Control: Evaluates
features.otel.tracingviaFeatureFlagPortdynamically per-message, enabling zero-downtime activation/deactivation of telemetry spans. - Span Name:
cqrs.CreateOrderCommand - Attributes:
message.name:CreateOrderCommandmessage.type:commandcorrelation.id:0724ec78-f952-4467...tenant.id:tenant-alphauser.id:usr_123
- Error Capture: Automatically catches unhandled exceptions, records them as span exception events, and sets span status to
ERROR.
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 hexastack_otel-0.2.0.tar.gz.
File metadata
- Download URL: hexastack_otel-0.2.0.tar.gz
- Upload date:
- Size: 8.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a4c25122c8de70b4b5ae449b1dc1c0d21b89cfd5b9ecd698d78f3be2abee1e59
|
|
| MD5 |
161d6f2877acdd632d230ccd1e8f7e8e
|
|
| BLAKE2b-256 |
7abad32c922c514c8d00ab64f43b66d50370c73cae2f7daf8740e93ef0acf05d
|
File details
Details for the file hexastack_otel-0.2.0-py3-none-any.whl.
File metadata
- Download URL: hexastack_otel-0.2.0-py3-none-any.whl
- Upload date:
- Size: 14.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
caef88d6bd4784dfffb799c287458fad19fdfd9a370af576489648fcf9fc4406
|
|
| MD5 |
92fdf6c248aef55b8717a1a9c9344a8b
|
|
| BLAKE2b-256 |
6c5c676b7d605dc98aa7d741b9cdd260e4ffad4a1bb72f6e7c8ac4c3e8e709f4
|