Monitoring
None of this is required to run Mnemosyne. The health endpoints are always on; metrics and traces are opt-in.
Health endpoints
These need no API key:
# Liveness: never touches a dependency on the request path
curl http://localhost:3939/health/live
# -> {"status":"alive","pid":1}
# Readiness: probes Postgres, the vector index, Redis and the embedder
curl http://localhost:3939/health/ready
# -> {"status":"ready","degraded":false,
# "checks":{"postgres":"ok","vector":"ok","cache":"ok","embed":"ok"}}/health/liveanswers200while the process is up. It answers503with"reason":"db_pool_stalled"only when the connection pool is wedged, which a restart clears./health/readyanswers503with"reason":"postgres_unavailable"when Postgres is down. When Redis, the vector index or the embedder is notokit still answers200, with"degraded":true./healthzand/readyzare older aliases for liveness and readiness.
Use /health/live for restarts and /health/ready for load balancers.
/health/deep adds latency figures, but it needs a bearer key with the
memory:admin scope, so a platform health check cannot use it.
Workspace vitals
curl http://localhost:3939/health \
-H "Authorization: Bearer mns_live_..."Returns counts for the key’s workspace: factsLive, factsClosed,
pinnedCount, lastRecallAt, lastWriteAt, and embeddings.indexed and
embeddings.pending.
Prometheus metrics
GET /metrics/prometheus serves the Prometheus text format; GET /metrics
is an alias. Access depends on MNEMO_METRICS_TOKEN:
- Token set: the scrape must send it, in any environment. Anything else gets
401. - No token and
NODE_ENV=production: both paths answer404. - No token outside production: open, for local development.
curl http://localhost:3939/metrics/prometheus \
-H "Authorization: Bearer $MNEMO_METRICS_TOKEN"Even with a token, keep /metrics* off the public internet and scrape from
inside the network. Some of the metrics:
# Requests
mnemo_requests_total{method, route, status}
mnemo_errors_total{route, code, status}
mnemo_request_duration_seconds
# Recall and write
mnemo_recall_duration_seconds{tier, kind, cache_hit}
mnemo_recall_tier_hits_total{tier}
mnemo_write_duration_seconds{tier, kind}
# Memory
mnemo_facts_total{type, status}
mnemo_worth_distribution{bucket}
mnemo_hot_tier_size{workspace_id}
# Model usage
mnemo_llm_tokens_used_total{model, operation}
mnemo_llm_cost_usd_total{model, operation}
mnemo_tokens_saved_estimated_total{mechanism}
mnemo_llm_daily_spend_usd
# Queues and pools
mnemo_queue_depth
mnemo_queue_lag_seconds
mnemo_pg_pool_connections_activeOpenTelemetry
Set OTEL_EXPORTER_OTLP_ENDPOINT and the server exports traces over
OTLP/HTTP, with automatic instrumentation for HTTP, Postgres and Redis. The
production overlay sets it to its own collector:
server:
environment:
OTEL_EXPORTER_OTLP_ENDPOINT: http://otel-collector:4318The service name is mnemosyne-server. On top of the automatic spans the
server emits its own, among them mnemo.recall (with mnemo.recall.hot,
mnemo.recall.pointer and mnemo.recall.cold), mnemo.remember,
mnemo.session.collapse, mnemo.embed, mnemo.rerank and mnemo.auth.
Dashboards
Four Grafana dashboards live in docker/scripts/dashboards/:
mnemosyne-overview.json: overview.memory-health.json: memory health.cost.json: LLM cost and token economics.federation.json: federation health.
Import the JSON files into your Grafana, or use the observability stack below, which provisions them.
Observability stack
docker/docker-compose.observability.yml adds Prometheus, Grafana, Tempo,
Loki, Promtail and an OpenTelemetry collector next to the main stack:
cd mnemosyne/docker
docker compose -f docker-compose.yml -f docker-compose.observability.yml up -dGrafana is on http://localhost:3001 and Prometheus on
http://localhost:9090. Alert rules are in
docker/scripts/prometheus-rules.yml.
The stack is not hardened: Grafana starts with admin / admin. Do not
expose it without a reverse proxy and authentication. Its Prometheus config
scrapes server:3939 at /metrics/prometheus, the port of the base stack;
under the production overlay the server listens on 3000, so change the
target there.