cliffracer-otel
Distributed Tracing and OpenTelemetry instrumentation for cliffracer services.
from cliffracer import CliffracerService, ServiceConfig
from cliffracer_otel import OtelExtension
class OrderService(CliffracerService):
otel = OtelExtension()
OtelExtension automatically instruments inbound message handling and outbound RPC / event calls with OpenTelemetry spans:
-
Inbound Spans:
- Extracts W3C
traceparentandtracestatecontext from incoming NATS headers inworker_setup. - Creates a server span (
SpanKind.SERVER) and attaches the active context so handler execution and child spans inherit the trace. - Links
cliffracer.kind,cliffracer.subject, andcliffracer.correlation_idas span attributes. - Marks status as
ERRORand records exceptions on handler failure orRejectMessage. - Ends the span and detaches the context token in
worker_teardown.
- Extracts W3C
-
Outbound Spans:
- Intercepts outgoing
call_rpc,call_async,call_rpc_no_wait,publish_event, andbroadcastinbefore_call. - Starts a client span (
SpanKind.CLIENTfor RPCs,SpanKind.PRODUCERfor events/broadcasts). - Injects W3C
traceparentinto outgoing headers so downstream microservices continue the distributed trace waterfall. - Completes the outbound span and records errors in
after_call.
- Intercepts outgoing
-
Health Details:
- Exposes telemetry counters (
spans_total,errors_total,active_spans) on/health.
- Exposes telemetry counters (
Custom Tracer Provider
You can pass a custom TracerProvider or Tracer directly:
from opentelemetry.sdk.trace import TracerProvider
from opentelemetry.sdk.trace.export import BatchSpanProcessor, ConsoleSpanExporter
provider = TracerProvider()
provider.add_span_processor(BatchSpanProcessor(ConsoleSpanExporter()))
class OrderService(CliffracerService):
otel = OtelExtension(tracer_provider=provider)
If no provider is supplied, OtelExtension uses or initializes the global OpenTelemetry tracer provider.
Metadata
Release files for cliffracer-otel 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| cliffracer_otel-1.0.0.tar.gz | 8.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| cliffracer_otel-1.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 14.2 kB
Release files / cliffracer_otel-1.0.0.tar.gz
| Download URL | cliffracer_otel-1.0.0.tar.gz |
|---|---|
| Size | 8.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3b9f43f148422042cdbd3efef24e21722cac61c8c195ebf15eb1abbfa35561be
|
|
BLAKE2b-256 checksum How to use checksums |
7f188df354a81efc1a8f7632cb56df91d17102c6bada82e8fc2e63ea62e47b2e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.12.13 {"installer":{"name":"uv","version":"0.12.13","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":true}
|
Release files / cliffracer_otel-1.0.0-py3-none-any.whl
| Download URL | cliffracer_otel-1.0.0-py3-none-any.whl |
|---|---|
| Size | 5.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ac0480294efea8e79cf1874dcdd7567986be5cb5fc28e0be77426111ccc56958
|
|
BLAKE2b-256 checksum How to use checksums |
063bfb90a4cf34047405046641b00d2c98c18f447459fb84eec96781d6f1ee68
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.12.13 {"installer":{"name":"uv","version":"0.12.13","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":true}
|