Skip to main content

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 traceparent and tracestate context from incoming NATS headers in worker_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, and cliffracer.correlation_id as span attributes.
    • Marks status as ERROR and records exceptions on handler failure or RejectMessage.
    • Ends the span and detaches the context token in worker_teardown.
  • Outbound Spans:

    • Intercepts outgoing call_rpc, call_async, call_rpc_no_wait, publish_event, and broadcast in before_call.
    • Starts a client span (SpanKind.CLIENT for RPCs, SpanKind.PRODUCER for events/broadcasts).
    • Injects W3C traceparent into outgoing headers so downstream microservices continue the distributed trace waterfall.
    • Completes the outbound span and records errors in after_call.
  • Health Details:

    • Exposes telemetry counters (spans_total, errors_total, active_spans) on /health.

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)

Source distribution for cliffracer-otel 1.0.0
File Size Uploaded
cliffracer_otel-1.0.0.tar.gz 8.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for cliffracer-otel 1.0.0
File Interpreter ABI Platform
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}

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release 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