Metadata-Version: 2.4
Name: serp-tracing
Version: 0.1.0
Summary: Serpentine distributed tracing: OpenTelemetry-style spans, W3C traceparent propagation, memory/stderr/file JSON exporters
Author: Serpentine contributors
License: MIT
Project-URL: Homepage, https://github.com/avijitbhuin21/Serpentine
Keywords: serpentine,tracing,opentelemetry,observability
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3 :: Only
Requires-Python: >=3.11
Description-Content-Type: text/markdown
Requires-Dist: serpentine-shim
Requires-Dist: serp-json>=0.2.0
Requires-Dist: serp-log>=0.2.1
Requires-Dist: serp-prometheus
Requires-Dist: serp-secrets
Requires-Dist: serp-time

# serp-tracing

OpenTelemetry-style tracing for [Serpentine](https://github.com/avijitbhuin21/Serpentine) services.

```python
from serp_tracing import get_tracer, inject, extract

tracer = get_tracer("checkout")

def handle(headers: dict[str, str]) -> None:
    with tracer.start_as_current_span("request", context=extract(headers), kind="SERVER") as span:
        span.set_attribute("http.route", "/items/{id}")
        downstream: dict[str, str] = {}
        inject(downstream)          # traceparent for the next hop
```

Nested spans link to their parents via a per-thread current-span stack; W3C `traceparent` is
injected and extracted for cross-service traces. Finished spans are written as JSON lines to the
in-memory store (`finished_spans()`), stderr, or a file (`set_exporter("file", path)`).

Caps: no OTLP exporter or sampling; exceptions are not recorded automatically.
