Skip to content

how to monitor metrics

Bryan edited this page Jun 13, 2026 · 1 revision

Metrics

The daemon can expose local request counters at /metrics. This endpoint is gated by the LODE_FEATURE_METRICS feature flag in src/lode/features.py.

What is tracked

Metrics in src/lode/observability.py counts requests by HTTP method, path, and status. The metric name is loded_requests_total.

Example output:

# HELP loded_requests_total Total local daemon HTTP requests.
# TYPE loded_requests_total counter
loded_requests_total{method="GET",path="/health",status="200"} 1

Enable metrics

LODE_FEATURE_METRICS=1 uv run loded --host 127.0.0.1 --port 7979
curl http://127.0.0.1:7979/metrics

How to add metrics

Add counters to Metrics in src/lode/observability.py, record them from src/lode/daemon.py, and update tests in tests/test_observability.py. Keep labels low-cardinality because the endpoint is meant for local diagnostics.

Key source files

File Purpose
src/lode/observability.py Metrics storage and rendering.
src/lode/features.py Feature flag gate.
src/lode/daemon.py /metrics endpoint and request recording.
tests/test_observability.py Metrics tests.

Related pages

Clone this wiki locally