Brain Docs
Run

Getting it up

Run it locallyConfiguration

Operating it

ObservabilityBackups and recoverySecurityScaling and limits

Reference

Brain/Docs
✦ ASKBrain on GitHubDashboard
RunObservability

Observability

Liveness and readiness on the metrics port, all 74 Prometheus series grouped by what they answer, structured JSON logs, and optional OTLP tracing.

PURPOSE

What to scrape, what to alert on, and which numbers actually tell you the engine is unwell.

Health

Three endpoints on the metrics listener (9091 in the image). All public, no auth — put them behind your network boundary, not behind a token.

EndpointMeaning
/healthzLiveness — the process is up
/readyzReadiness — 200 once every shard serves, 503 otherwise
/metricsPrometheus exposition

Wire /healthz to your restart policy and /readyz to load-balancer membership. The distinction matters at boot: a shard replaying a long WAL is alive but not ready, and restarting it only makes recovery start over.

Metrics

74 series, all prefixed brain_, in sixteen families. The whole set is on the /metrics endpoint; these are the ones worth a dashboard.

Serving

brain_up                      brain_shards_total
brain_request_total           brain_request_duration_ms
brain_request_active          brain_connections_total
brain_connections_active      brain_connections_closed_total
brain_connections_rejected_total
brain_frame_recv_total        brain_frame_send_total
brain_frame_size_bytes

brain_connections_rejected_total rising with no change in traffic usually means keys are failing to resolve — a revoked key, or a client pointed at the wrong deployment.

Read path

brain_query_total             brain_query_latency_ms
brain_query_outcome_total     brain_query_fusion_k
brain_query_rerank_invoked_total
brain_retriever_latency_ms    brain_retriever_invocations_total
brain_retriever_candidates_total

brain_retriever_latency_ms is the useful one when recall feels slow — it breaks out the retrievers, so you can see which lane is dragging rather than guessing from an end-to-end number. brain_retriever_candidates_total beside it tells you whether a lane is slow because it is doing more work or because it is doing the same work badly.

brain_query_rerank_invoked_total should sit at zero unless you have enabled the reranker — it ships disabled.

Storage pressure

brain_arena_slots_used     brain_arena_slots_free
brain_arena_used_bytes     brain_arena_capacity_bytes
brain_wal_segments         brain_wal_size_bytes
brain_metadata_size_bytes

Arena slots are the one to alert on early. The arena is a fixed-size mapped file; running out is not a gradual degradation.

Index health

brain_hnsw_node_count    brain_hnsw_tombstone_count    brain_hnsw_tombstone_ratio

brain_hnsw_tombstone_ratio climbing and staying high means maintenance is not keeping up with deletions — recall quality degrades before anything errors.

Background work

Every worker reports through one shared family, labelled by worker:

brain_worker_cycles_total     brain_worker_cycle_duration_ms
brain_worker_processed_total  brain_worker_pending_work
brain_worker_errors_total     brain_worker_panics_total
brain_worker_last_run_unixtime

brain_worker_last_run_unixtime is the one that catches a silently stopped worker: errors stay flat and cycles stop incrementing, so a staleness alert on this timestamp finds it where an error-rate alert will not.

The edge-building workers each add their own counters — brain_auto_edge_*, brain_temporal_edge_*, brain_causal_edge_* — with _edges_written_total, _drops_total, _skipped_total and a cycle duration. A rising _drops_total means the worker's channel is full and work is being shed.

Extraction

brain_extractor_tier_runs_total          brain_extractor_items_written_total
brain_extractor_drops_total              brain_extractor_apply_dropped_total
brain_extractor_schema_filtered_total    brain_extractor_resolver_outcome_total
brain_extractor_predicate_consolidated_total
brain_extractor_llm_micro_usd_spent_total
brain_extractor_cycle_duration_seconds

Two of these answer questions nothing else does. brain_extractor_schema_filtered_total counts claims extraction produced and the schema rejected — a spike means your schema and your data have drifted apart. brain_extractor_resolver_outcome_total breaks entity resolution down by outcome, which is where an Ambiguous rate shows up; an ambiguous resolution writes no link at all and logs nothing, so this counter is the only signal that a graph is quietly losing its edges.

brain_extractor_llm_micro_usd_spent_total is your extraction spend in micro-dollars. Worth a budget alert — extraction is the one part of the write path that costs money per memory.

Statement embedding

brain_statement_embed_cycles_total      brain_statement_embed_rows_embedded_total
brain_statement_embed_rows_skipped_total brain_statement_embed_errors_total
brain_statement_embed_batch_duration_seconds

Tracing

brain_tracing_export_errors_total    brain_tracing_spans_dropped_total

Four alerts worth having

  1. /readyz non-200 for more than a minute — a shard is not serving.
  2. brain_arena_slots_free below ~10% — you are approaching a hard wall, and it is a wall rather than a slope.
  3. brain_worker_errors_total rising, or brain_worker_last_run_unixtime going stale — background maintenance is failing or has stopped. Either surfaces as quality loss long before it surfaces as errors, and the second one produces no errors at all.
  4. brain_extractor_llm_micro_usd_spent_total above budget — a runaway write loop is expensive.
  5. brain_hnsw_tombstone_ratio high and flat — maintenance is not reclaiming, and recall degrades silently.

brain_build_info and brain_config_info carry the running version and effective configuration as labels. Scrape them — "which build is actually running" is the first question in most incidents, and the slowest to answer without this.

Logs

[monitoring.logging]
level  = "info"
output = "stdout"
format = "json"

Keep json anywhere you ship logs — Loki, Elastic and CloudWatch all ingest it without a parser.

Tracing

Off by default. Point it at an OTLP collector to turn it on:

[monitoring.tracing]
enabled      = true
sampler      = "ratio"
sample_ratio = 0.01
endpoint     = "http://otel-collector:4317"
service_name = "brain-server"

Start at 1%. Watch brain_tracing_export_errors_total after enabling — a collector that's refusing spans shows up there and nowhere else.

Explaining a single answer

Metrics tell you the system is healthy. They don't tell you why one recall returned what it did. For that, ask for a trace on the request itself — recall takes include_trace, and there are dedicated explain and trace endpoints that show which retriever surfaced a candidate, where it ranked after fusion, and what the reranker did to it.

Reach for that before tuning anything. The usual finding is that the memory you expected was never written, which no amount of ef_search will fix.

Want to knowUse
What the planner would do, and the estimated costPOST /v1/query/explain
What it did do, with measured latencyPOST /v1/query/trace
Why one recall returned what it didrecall with a trace requested
What the write pipeline derived from one memoryGET /v1/memories/{id}/inspect

The recall trace does not scale with the result size

It reports every candidate each lane considered, so it grows with the size of the space rather than with the number of hits you asked for. A three-hit recall over roughly 700 memories measured 121 KB. Leave it off in hot paths; it costs nothing when off.

See also
ConfigurationBackups and recoveryPOST /v1/query/trace

Was this page helpful?

Configuration

Both processes' settings — brain-db's TOML with environment overrides, brain-edge's pure-environment config, and the choices pinned at creation.

Backups and recovery

Snapshots are the backup story, the periodic worker captures only the HNSW graph, and restore is destructive in place — which artefact is a restore point and which is an optimisation.

On this page

HealthMetricsServingRead pathStorage pressureIndex healthBackground workExtractionStatement embeddingTracingFour alerts worth havingLogsTracingExplaining a single answer
Suggest an editOpen in Playground