Architecture
Overview

your Python process docker compose (observability/)
┌──────────────────────┐ OTLP/gRPC ┌────────────────┐ ┌───────────────┐ ┌────────┐
│ obskitpy.setup(...) │ ────────────▶ │ OTel Collector │ ─────▶ │ Elasticsearch │ ◀──── │ Kibana │
│ logs / traces / │ :4317 │ (contrib) │ otel │ data streams │ │ :5601 │
│ metrics │ └────────────────┘ mode └───────────────┘ └────────┘
│ │ ─── extracted data (optional, its own index) ────────▲
└──────────────────────┘
▲
└── obskitpy CLI: init (generates files) · up (docker compose + imports the dashboard) · export/apply
Components
The obskitpy library (obskitpy/src/obskitpy/__init__.py)
Configures the OpenTelemetry SDK (three OTLP/gRPC exporters), connects logging to the logs pipeline and adds
a filter that enriches logs that carry an exception (error.type, error.origin, error.chain). It does not lock you into anything
proprietary: tracer() and meter() return standard OpenTelemetry objects.
OpenTelemetry Collector (otel/opentelemetry-collector-contrib)
Receives OTLP (gRPC 4317, HTTP 4318), batches and exports with the elasticsearch exporter in mapping.mode: otel.
The indices are pinned to logs-/traces-/metrics-generic.otel-default.
Elasticsearch 8.17 (single node, security off) Receives the three signals in managed data streams with the native OTel templates (available since 8.16). It also stores your robot's business-data index, if there is one.
dash-obskitpy (optional, --local dash-obskitpy)
An nginx container that serves a static page (plain HTML/CSS/JS) and exposes only read access to
Elasticsearch (_search, _count, _field_caps) to the browser under /es/. It is the light alternative to Kibana; see
dash-obskitpy. Kibana and the dash are Docker Compose profiles, enabled through .env
(COMPOSE_PROFILES), so only what you chose starts.
Kibana 8.17 (optional, --local kibana)
Shows the dashboard. The objects (data views, visualizations, searches, dashboard) are imported through the
saved objects API, which is what makes the dashboard a versionable file.
The obskitpy CLI (obskitpy/src/obskitpy/cli.py)
Generates the files in observability/, calls docker compose (project named obskitpy-<service>), waits for Kibana
to become available and imports dashboard.ndjson. It uses only the standard library to talk to Kibana.
Design decisions
| Decision | Reason |
|---|---|
| OpenTelemetry instead of a proprietary agent/SDK | An open standard: you swap the backend without touching the instrumented code. |
| A Collector between the app and Elasticsearch | The app only knows OTLP; mapping and destination live in the Collector configuration. |
mapping.mode: otel + pinned indices |
Uses Elasticsearch's native templates; without the explicit indices, the exporter routes by attributes and the signals land in the wrong data streams. |
| Metrics with delta temporality | Elasticsearch's OTel mode drops cumulative histograms. setup() already sets this. |
Dashboard as versionable ndjson |
No manual steps in a new environment; changes go through code review. |
One base panel set filtered by service.name |
Several services can share the same stack without mixing. |
Security off, ports on 127.0.0.1 |
Focused on local development; less friction. See the security section of the README. |
Signal data model
- Traces: each operation is a span; the root span represents a run. Recorded exceptions become events
(extra documents without a
name).durationis in nanoseconds. - Logs:
body.textis the message;attributes.*carries theextra={...}fromloggingand theerror.*fields;trace_id/span_idlink the log to the active span. - Metrics: one document per instrument/interval; the value lives in
metrics.<name>and the dimensions inattributes.*.
Known limits
- A single Elasticsearch node, 1 GB of heap, no replicas: enough for development, not for production.
error.chainis akeywordfield; very long chains (> 1024 characters) are kept in_sourcebut are not indexed for search.- The first data takes a few seconds to become searchable (Elasticsearch refresh delay).
- Pinned versions: OpenTelemetry Python 1.27.0, Elasticsearch/Kibana 8.17.0, Collector 0.116.1. Upgrade them together.