datasette/demos
Alex Garcia 4a97e577b8 Add a pure-Python OTLP demo: receiver, Jaeger recipe, no Docker
demos/otel/ shows the whole export path end to end with uv alone. The
~150 line otlp_receiver.py decodes the real OTLP/HTTP protobuf wire
format and prints a summary on Ctrl-C; a Justfile wraps the receiver,
an instrumented `datasette` under opentelemetry-instrument, a
generated 200-row demo database, and Jaeger from its own binary.
Jaeger and the receiver both listen on 4318, so the Datasette side is
one identical `just serve` either way.

Verified against this branch: startup plus one request against the
demo table exports 93 spans with exactly two roots - the request span
and datasette.startup - and in Jaeger the same run lands as two
traces, 67 spans nested under `GET <route>` and 26 under startup.
That "no orphans" shape is new since the earlier demo iteration: the
per-request server span and the startup parent are in core now, so
the old asgi_wrapper plugin and its "ignore the ~24 tiny traces"
caveats are gone rather than ported.

serve_forever() runs on a worker thread with the main thread waiting
on an event, and SIGINT/SIGTERM are handled explicitly, because
KeyboardInterrupt alone does not reliably reach the script through
the `uv run` wrapper - the summary was silently never printed. The
per-batch print flushes explicitly so live feedback survives a pipe.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012U7coQfVu8nK2R4q2mCULA
2026-09-01 16:24:35 -07:00
..
apache-proxy Upgrade Docker images to Python 3.11, closes #1853 2022-10-25 12:04:53 -07:00
otel Add a pure-Python OTLP demo: receiver, Jaeger recipe, no Docker 2026-09-01 16:24:35 -07:00
plugins Fixed an unnecessary f-string 2024-02-04 10:15:21 -08:00