-
Notifications
You must be signed in to change notification settings - Fork 1
systems observability
Bryan edited this page Jun 13, 2026
·
1 revision
Active contributors: Bryan
Lode's observability is local and lightweight. src/lode/observability.py provides structured JSON logs, sensitive-field redaction, and in-memory request counters used by src/lode/daemon.py.
src/lode/observability.py # sanitize, log_event, Metrics
src/lode/features.py # environment-driven feature flags
src/lode/daemon.py # request IDs, /metrics, request logging
tests/test_observability.py
| Name | File | Description |
|---|---|---|
sanitize() |
src/lode/observability.py |
Recursively redacts sensitive dict fields. |
log_event() |
src/lode/observability.py |
Emits sorted JSON log events to stderr or a provided stream. |
Metrics |
src/lode/observability.py |
Counts daemon requests by method, path, and status. |
enabled() |
src/lode/features.py |
Reads LODE_FEATURE_* environment flags. |
ensure_request_id() |
src/lode/daemon.py |
Sets or propagates x-request-id. |
sequenceDiagram
participant Client
participant Daemon as src/lode/daemon.py
participant Metrics as src/lode/observability.py
participant Logs as stderr
Client->>Daemon: HTTP request
Daemon->>Daemon: ensure_request_id()
Daemon->>Metrics: record(method, path, status)
Daemon->>Logs: log_event("http_request")
Daemon-->>Client: response with x-request-id
/metrics is only exposed when LODE_FEATURE_METRICS is enabled. The metrics format is Prometheus-style text with a loded_requests_total counter.
-
src/lode/daemon.pyrecords every response inrecord_request(). -
tests/test_observability.pyverifies redaction, log shape, and metrics rendering. -
docs/runbooks/loded.mddescribes operational checks for the daemon.
Add new daemon counters to Metrics in src/lode/observability.py, then expose them through render(). Add new feature flags through src/lode/features.py and document the flag in .env.example if operators need it.
| File | Purpose |
|---|---|
src/lode/observability.py |
Structured logs and local metrics. |
src/lode/features.py |
Environment feature flags. |
src/lode/daemon.py |
Request IDs and metrics endpoint. |
tests/test_observability.py |
Observability tests. |