Observability¶
This page describes the signals a Spongram server exposes: the two health endpoints and what each one judges, the states of the background workers, the Prometheus metrics, the log lines worth alerting on, and the optional tracing of model calls to Langfuse.
Two probes with two purposes¶
| Endpoint | Question it answers | Judges | Use it for |
|---|---|---|---|
GET /readyz |
Can this process serve requests? | Graphiti, Postgres, Neo4j | Container healthcheck, load balancer, rolling updates |
GET /healthz (alias /health) |
Is everything working as intended? | The same three, plus the background workers | Monitoring, dashboards, diagnosis |
Neither requires authentication. Both answer 200 or 503.
Never use /healthz as a container healthcheck
/healthz answers 503 as soon as a background worker is unhealthy. A healthcheck built on
it makes the orchestrator restart, in a loop, a container that serves every request
correctly, because a summary job is late or a worker is disabled. /readyz ignores the
workers on purpose.
/readyz¶
Each dependency is ok or degraded. The answer is 503 with "ready": false when any of them
is degraded. The Graphiti check calls its /health endpoint; the Postgres check runs
SELECT 1; the Neo4j check runs RETURN 1 on the shared driver.
/healthz¶
{
"version": "<release>",
"edition": "cloud",
"frozen": false,
"graphiti_upstream": "ok",
"postgres": "ok",
"neo4j": "ok",
"sleeper_worker": "ok",
"dream_worker": "ok",
"pending_episodes_worker": "ok",
"components": {
"pending_episodes_worker": {
"state": "ok",
"queue_depth": 0,
"parked": 0,
"note": "…",
"parked_note": "…"
}
},
"status": "ok"
}
| Field | Meaning |
|---|---|
version |
The running release. Compare it with what you deployed |
edition |
cloud on a server, local on a desktop |
frozen |
true only in the packaged desktop binary |
graphiti_upstream, postgres, neo4j |
ok or degraded, the same checks as /readyz |
sleeper_worker, dream_worker |
A worker state, see below |
pending_episodes_worker |
ok when the ingestion worker exists, else not_configured |
components.pending_episodes_worker.queue_depth |
Memories accepted and not yet forwarded to Graphiti. 0 means forwarded, not yet searchable: extraction runs asynchronously after the forward |
components.pending_episodes_worker.parked |
Memories that failed at least six attempts. They are still retried, every 6 hours, and can be replayed from the admin UI. 0 in normal operation |
status |
The summary, see the next table |
status |
HTTP | Condition |
|---|---|---|
ok |
200 | Dependencies ok, both workers healthy |
starting |
200 | As ok, and a worker is still in its start grace period |
throttled |
200 | As ok, and a worker is deliberately paused |
degraded |
503 | Dependencies ok, a worker is stalled or not_configured |
down |
503 | At least one dependency is degraded |
On a server, a worker that you disabled (SPONGRAM_SLEEPER_ENABLED=0 or
SPONGRAM_DREAM_ENABLED=0) reports not_configured, which counts as unhealthy: /healthz then
answers 503 with "status": "degraded" permanently. If you run without a worker, alert on the
individual fields or on /readyz instead of the HTTP status of /healthz. In the desktop
edition not_configured is a healthy state.
Worker states¶
The Sleeper and the Dream each report one of five states.
| State | Healthy | Meaning |
|---|---|---|
not_configured |
desktop only | The worker was not started |
starting |
yes | The process started less than 90 seconds ago |
ok |
yes | The worker task is alive and ticking on time |
throttled |
yes | The worker is skipping its ticks on purpose because the circuit breaker of the inference provider is open. It is waiting for the provider, not broken |
stalled |
no | The worker task ended, or a tick has been running for too long, or no tick completed for too long |
How "too long" is decided:
- A tick in progress is considered stuck after
max(900 s, interval / 4). With the default intervals that is 900 seconds for the Sleeper (interval 120 s) and 90 minutes for the Dream (interval 6 hours). The cap is proportional because one fixed cap, sized for the fastest worker, declared long but legitimate Dream passes stalled and produced 503 answers with no fault behind them. - Between ticks, a worker is late when nothing completed for
2 × max(interval, duration of the last tick). Using the real duration of the last tick keeps a worker with a backlog, whose ticks outlast its interval, from flapping betweenokandstalled. throttledinstead ofstalled: when a worker is late, it is reportedthrottledif it recorded a breaker skip after its last real tick and within the last2 × interval. Once the skips stop being recent, prolonged silence isstalledagain, so a pause can never hide a real failure indefinitely.
A worker whose tick fails clears its "tick in progress" marker, so a loop that keeps failing is not mistaken for a long tick.
Prometheus metrics¶
GET /metrics returns the Prometheus text format and requires the admin token:
scrape_configs:
- job_name: spongram
metrics_path: /metrics
scheme: https
authorization:
type: Bearer
credentials: <admin-token>
static_configs:
- targets: ["spongram.example.com"]
Counters live in the memory of the process and restart from zero with it.
Requests and access¶
| Metric | Type | Labels | Meaning |
|---|---|---|---|
spongram_requests_total |
counter | method, tool, status |
MCP requests handled, by JSON-RPC method, tool name and HTTP status |
spongram_request_duration_seconds |
histogram | method, tool |
Latency of MCP requests |
spongram_auth_failures_total |
counter | kind |
Requests refused: tampering (the payload named another brain's group_id), constitution (an add_memory rejected by the tagging rules) |
spongram_rate_limited_total |
counter | instance_id |
Requests refused with 429 by the per-brain rate limit |
spongram_active_instances |
gauge | Instances with status active, refreshed at each scrape |
|
spongram_persona_activations_total |
counter | instance_id, slug |
Successful activate_persona calls |
Ingestion and inference¶
| Metric | Type | Labels | Meaning |
|---|---|---|---|
spongram_add_memory_chunked_total |
counter | Oversized add_memory bodies that were split |
|
spongram_add_memory_chunks_total |
counter | Episodes produced by those splits | |
spongram_episodes_deduplicated_total |
counter | instance_id |
add_memory calls acknowledged without queueing, because an identical episode was queued in the last 24 hours |
spongram_prompt_clamped_total |
counter | Chat prompts trimmed to fit the model's context window | |
spongram_inference_retries_total |
counter | role, endpoint, reason |
Retries of the inference proxy towards the provider. reason is http_<status>, connect_error, connect_timeout or remote_protocol_error |
spongram_inference_retry_exhausted_total |
counter | role, endpoint |
Requests whose retry budget ran out; the provider's error was returned to the caller |
spongram_breaker_state |
gauge | name |
Circuit breaker state: 0 closed, 1 half-open, 2 open. name is llm or embedder |
spongram_breaker_opens_total |
counter | name |
Transitions to open |
spongram_breaker_closes_total |
counter | name |
Recoveries |
spongram_breaker_probes_total |
counter | name, outcome |
Half-open probes, success or failure |
Search¶
| Metric | Type | Labels | Meaning |
|---|---|---|---|
spongram_hot_cache_hits_total |
counter | Search responses served from the cache | |
spongram_hot_cache_misses_total |
counter | Cacheable searches that missed | |
spongram_hot_cache_invalidations_total |
counter | Per-brain invalidations | |
spongram_hot_cache_invalidated_entries_total |
counter | Entries dropped by invalidations | |
spongram_hot_cache_size |
gauge | Entries currently cached | |
spongram_pagerank_rerank_total |
counter | outcome |
PageRank re-ranking outcomes: reranked or fallback |
spongram_pagerank_fallback_total |
counter | reason |
Why a re-ranking fell back to the original order |
spongram_pagerank_rerank_duration_seconds |
histogram | Duration of a re-ranking |
Sleeper¶
| Metric | Type | Meaning |
|---|---|---|
spongram_sleeper_summaries_total |
counter | Summaries written |
spongram_sleeper_skipped_unchanged_total |
counter | Entities whose set of episodes had not changed |
spongram_sleeper_skipped_empty_total |
counter | Entities with no source episode |
spongram_sleeper_errors_total |
counter | Tick or per-entity errors |
spongram_sleeper_last_tick_unixtime |
gauge | Time of the last completed tick, 0 if none |
spongram_sleeper_last_tick_duration_seconds |
gauge | Duration of the last tick |
spongram_persona_summaries_total |
counter | Persona summaries written |
spongram_persona_summaries_skipped_total |
counter | Persona summary passes skipped because nothing changed. In steady state this one should dominate the previous one |
spongram_persona_summary_errors_total |
counter | Persona summary errors |
Starting points for alerts¶
| Alert | Expression |
|---|---|
| Not ready | probe GET /readyz from outside and alert on a non-200 answer |
| Server errors above 1 % | sum(rate(spongram_requests_total{status=~"5.."}[5m])) / sum(rate(spongram_requests_total[5m])) > 0.01 |
| Slow requests | histogram_quantile(0.95, sum(rate(spongram_request_duration_seconds_bucket[5m])) by (le)) > 5 |
| Provider unavailable | max(spongram_breaker_state) == 2 |
| Retries running out | increase(spongram_inference_retry_exhausted_total[15m]) > 0 |
| Sleeper silent | time() - spongram_sleeper_last_tick_unixtime > 1800 with the breaker closed |
| Memories parked | components.pending_episodes_worker.parked above 0 in /healthz |
Logs¶
The service logs to standard output at the level set by SPONGRAM_LOG_LEVEL. Read them with
docker compose logs -f spongram, docker service logs -f spongram_spongram or kubectl logs.
Some messages are written in French; they are quoted here as they appear.
| Line | Level | Meaning |
|---|---|---|
==> applying migrations, {"migration": "<file>", "state": "applied"}, ==> migrations applied |
start | Normal migration sequence |
==> migrations refused: … |
start, fatal | The schema or a migration file is not what the journal expects. Nothing was changed. See Upgrades and migrations |
spongram <version> ready (graphiti=…, cache_ttl=…s) |
INFO | The service started; confirms the release |
thinking levels: graphiti=…, sleeper=…, distill=… |
INFO | Reasoning levels in force. The only proof that a SPONGRAM_THINKING_* setting was received |
SPONGRAM_INTERNAL_AUTH_TOKEN is not set — the inference proxy will refuse every graphiti call with 503 |
ERROR | Memories will be accepted and never extracted until the token is set on both services |
decrypt failed — returning empty string (token rotated?) |
WARNING | The stored provider key cannot be decrypted with the current SPONGRAM_ENCRYPTION_KEY (or admin token, when the key is derived from it) |
inference_proxy[<role>/<endpoint>] breaker OPEN, refusing request |
INFO | The provider failed repeatedly; calls are refused for the cool-down |
inference_proxy[…] prompt clamped to fit context window |
WARNING | A prompt was trimmed. Frequent occurrences suggest raising the limit for a larger-context model or lowering the episode size |
pending_episodes reconcile: re-enqueued N acked-but-unpersisted rows |
WARNING | Memories that Graphiti acknowledged but did not write were found and submitted again. Occasional lines are the safety net working; a steady stream points at the provider or at Graphiti |
get_episodes: graph read failed, forwarding to graphiti |
WARNING | The chronological answer could not be read from the graph; Graphiti answered instead |
marketplace: N article(s) chargé(s) depuis … (M ignoré(s)) |
INFO | Persona marketplace catalogue loaded; a non-zero ignored count means an invalid article |
marketplace: source ignorée (dossier absent) |
WARNING | A directory named in SPONGRAM_MARKETPLACE_DIRS does not exist in the container |
langfuse tracing désactivé : serveur …, le SDK v5 exige >= 4.59.0 |
WARNING | Tracing was turned off at start because the Langfuse server is too old |
healthz: postgres ping failed, healthz: neo4j ping failed |
WARNING | A dependency check failed |
In the graphiti-mcp logs, an HTTP 401 on a request to api.openai.com means the engine is not
routed through the Spongram proxy (see Troubleshooting).
Tracing model calls with Langfuse¶
Tracing is optional and off unless you configure it.
Enabling¶
All of these must hold:
LANGFUSE_BASE_URLis set (orLANGFUSE_HOSTwhen the first is empty). There is no implicit destination: keys without a URL trace nothing.LANGFUSE_PUBLIC_KEYandLANGFUSE_SECRET_KEYare set.SPONGRAM_LANGFUSE_ENABLEDis not0,false,offorno. The stack file sets it tofalseby default, so set it totruethere.- The edition is
cloud. The desktop edition never traces, whatever its environment contains.
The client is created once per process. Restart the service after changing the URL or the keys. Setting the switch to false stops new observations without removing the keys.
Server version¶
The image ships version 5 of the Langfuse Python SDK, which requires Langfuse Cloud or a
self-hosted server at version 4.59.0 or later. At start the service calls
<base URL>/api/public/health once, with a 5-second timeout:
- a server older than 4.59.0 turns tracing off for the life of the process and logs a warning;
- an unreachable server or an unreadable version leaves the setting unchanged;
- the check never prevents the service from starting.
What is sent¶
One observation per non-streamed chat or embeddings call that goes through the inference proxy,
named <role>-chat or <role>-embeddings.
| Data | Sent |
|---|---|
| Role, endpoint, model, duration, HTTP status, error message | yes |
Token counts reported by the provider (input, output, total) |
yes |
| Chat messages and the model's answer | yes, except with the Cloud control plane |
| Embedding inputs | only the number of inputs and the first 500 characters of the first one, except with the Cloud control plane |
| Embedding vectors | never; only their count |
| Authorization headers and keys | never |
user_id |
the brain's group_id; with the Cloud control plane, the acting identity when it is known |
session_id |
an episode or request identifier when one is known |
With the Cloud control plane (SPONGRAM_CLOUD_CONTROL_ENABLED=true), prompt and response
content is not captured: observations carry the metadata and token counts only.
Without it, chat content is sent. The text of your memories therefore reaches the Langfuse server you configured. Take that into account when you choose where that server runs.
Streamed calls are not traced. The user_id is a label for observability, not an access
control in Langfuse. A failure of the tracing library is logged and never affects the model
call it was observing.