Skip to main content

hexastack-otel

hexastack-otel

Vendor-agnostic OpenTelemetry distributed tracing and CQRS telemetry middleware for Hexastack.

PyPI: hexastack-otel Python 3.13+ Coverage Part of Hexastack Governed by Hexaqual License: Apache 2.0

Part of the Hexastack Framework · Governed by Hexaqual.


1. Architectural Overview

hexastack-otel provides pure hexagonal port interfaces for distributed tracing (TracingPort) and metrics collection (MetricsPort).

  • Distributed Tracing: Backed by the official OpenTelemetry Python SDK (OtelTracingAdapter, InMemoryTracingAdapter), linking correlation IDs and creating spans across CQRS Command/Query executions, HTTP endpoints, and gRPC RPCs.
  • Prometheus Metrics Engine: Backed by prometheus_client (PrometheusMetricsAdapter), tracking throughput counters, execution duration histograms, and system gauges exposed over /metrics.
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.tracing via FeatureFlagPort dynamically per-message, enabling zero-downtime activation/deactivation of telemetry spans.
  • Span Name: cqrs.CreateOrderCommand
  • Attributes:
    • message.name: CreateOrderCommand
    • message.type: command
    • correlation.id: 0724ec78-f952-4467...
    • tenant.id: tenant-alpha
    • user.id: usr_123
  • Error Capture: Automatically catches unhandled exceptions, records them as span exception events, and sets span status to ERROR.

Metadata

Release files for hexastack-otel 0.11.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for hexastack-otel 0.11.2
File Size Uploaded Provenance Actions
hexastack_otel-0.11.2.tar.gz 12.2 kB Without provenance Details for hexastack_otel-0.11.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for hexastack-otel 0.11.2
File Interpreter ABI Platform Actions
hexastack_otel-0.11.2-py3-none-any.whl Python 3 none any Details for hexastack_otel-0.11.2-py3-none-any.whl

Total release size: 30.6 kB

Release files / hexastack_otel-0.11.2.tar.gz

Download URL hexastack_otel-0.11.2.tar.gz
Size 12.2 kB
Tags Source
SHA-256 checksum
How to use checksums
be6ea4ec97222a981ab3dcc27192840dc4c618b1157bf91a0f6cb1d6d2c778cf
BLAKE2b-256 checksum
How to use checksums
a431720ee41aa6dcb132672ad304d780bb23590c34cee6f4fdbb8284d97257b8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / hexastack_otel-0.11.2-py3-none-any.whl

Download URL hexastack_otel-0.11.2-py3-none-any.whl
Size 18.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4e47ff3be4edb85ad6e713490d417069698915a2632eb285db0855f93f523609
BLAKE2b-256 checksum
How to use checksums
4709935546d4de5b11c0a8e6370bef03f337b7cce659a21e52157b04414a9a85
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Security for hexastack-otel 0.11.2

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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