Skip to main content

hexastack-otel

hexastack-otel

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

Part of the Hexastack Framework.

PyPI: hexastack-otel Python 3.13+ Coverage License: Apache 2.0


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

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

hexastack_otel-0.1.0.tar.gz (8.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

hexastack_otel-0.1.0-py3-none-any.whl (14.5 kB view details)

Uploaded Python 3

File details

Details for the file hexastack_otel-0.1.0.tar.gz.

File metadata

  • Download URL: hexastack_otel-0.1.0.tar.gz
  • Upload date:
  • Size: 8.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.12.3 {"installer":{"name":"uv","version":"0.12.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for hexastack_otel-0.1.0.tar.gz
Algorithm Hash digest
SHA256 8f40477c8bd878184e9f7b09db9ec7227c9f8dbdf31a4c7d1e5183564c17c6fa
MD5 8c9142f3bd59fd5fd9978dd9cfc17c74
BLAKE2b-256 9ca3899907869d0805ef3613b0dbc7dfe181beff4e435d755224a95e8e43aea7

See more details on using hashes here.

File details

Details for the file hexastack_otel-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: hexastack_otel-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 14.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.12.3 {"installer":{"name":"uv","version":"0.12.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for hexastack_otel-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 818debd644d26e526cc05981a8c6d8b39668665c496e2743d9306d99a9f8f9b9
MD5 6fb978f256a7e1fa500fdb270e00d8cb
BLAKE2b-256 5ee56c247bac1f1ed52186a3b2c35c78767c11a045d5e1cb3297e153627d8fe4

See more details on using hashes here.

Release history Release notifications | RSS feed

0.3.0

2 files

0.2.0

2 files

This release

0.1.0 This release

2 files

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