Documentation
/ Reference
Metrics
hive-serve exposes Prometheus metrics at GET /metrics. No authentication, so treat the endpoint
as internal.
What is exposed
HTTP
| Metric | Type | Labels |
|---|---|---|
http_requests_total |
counter | endpoint, method, status |
http_request_duration_seconds |
histogram | endpoint, method |
endpoint is a bounded set: /healthz, /concepts, /resolve, /card/{id}. The /mcp mount,
/find_concepts, and unknown paths are not measured, which keeps cardinality fixed. /metrics
excludes itself deliberately: counting Prometheus scraping would dilute the denominator of any
error-rate alert.
MCP
| Metric | Type | Labels |
|---|---|---|
mcp_tool_calls_total |
counter | tool, outcome |
mcp_tool_duration_seconds |
histogram | tool |
outcome is ok or error.
Corpus
| Metric | Type | Labels |
|---|---|---|
hive_corpus_cards |
gauge | product, regime |
hive_corpus_db_objects |
gauge | product |
hive_ledger_rows |
gauge | table |
Both corpus gauges are needed to see the whole corpus, and this is the important thing on this page.
hive_corpus_cards counts indexed cards. It deliberately excludes the database-object tier,
because that tier is resolved on demand and is excluded from the index. On a corpus with a real
schema behind it, that exclusion is typically most of the corpus (many more schema objects than
concept cards).
So hive_corpus_db_objects exists to cover the rest. An alert built on hive_corpus_cards alone
would report a healthy corpus while most of it was missing, which is worse than no alert at all,
because it turns silence into assurance.
There is no client label anywhere, by rule. Client names in metrics would leak the client list
to anyone who can read the endpoint, and would make cardinality grow with the customer base.
Corpus gauges are recomputed at most once every 30 seconds and cached, so a scrape never walks the whole corpus. If the sample fails, the last known good values are served rather than the endpoint breaking.
hive_ledger_rows counts objectives and memories. Under TOOL_PROFILE=retrieval there is no
ledger to count, so it carries no samples, and the corpus gauges report exactly as they do under
the full profile. See tool profiles.
Semantic layer (System One)
Emitted only when the optional semantic layer is enabled (a TYPESAFE_API_KEY is set); otherwise
these series stay at zero. See semantic layer.
The metric names predate the model-neutral rename and are kept for dashboard and alert
continuity.
| Metric | Type | Labels |
|---|---|---|
jev_events_total |
counter | event |
jev_input_tokens_total |
counter | (none) |
event is a bounded set: request, select, degrade, abstain, hold, cache_hit,
oversize, transient, permanent, posture, malformed. As with everything here there is no client label, and
the series carry only event counts and a token total, never any projected query or card text and
never a model id label (ids are reported only in the per-request reason string, which is not a
metric). A rising degrade / abstain / transient count is the operational signal of an outage
or miscalibration - the same signal a caller sees as a deterministic_fallback ranking. posture
counts calls where the configured model had no declared calibration posture (SYSTEMONE_MODEL
other than the validated default, not in SYSTEMONE_CALIBRATED_MODELS), and malformed counts
responses that were not valid System One answers (not a dict, or no answers object), plus
relevance-batch responses that did not answer exactly the questions asked with well-formed
answers - the only responses held to that exact contract.
request counts every request the layer sends: each relevance request, plus the facet-routing
request a query makes when FACET_TAXONOMY_PATH is set (a client's own transient retries inside
one request are not counted again). Against the reads - select + degrade + posture - it is
what a read costs in requests: one relevance request when the query's whole candidate union fits
in one, as it typically does. oversize counts candidates left unjudged because their question
alone exceeds SYSTEMONE_BATCH_MAX_BYTES; a steady rate means cards with very long descriptions,
or a budget set too low.
What to alert on
Not /healthz
/healthz reports that the process is alive. It says nothing about the corpus. A service whose
corpus mount has gone stale answers {"ok":true} and serves zero cards.
This is not theoretical. It caused an outage of about two hours during which every health check was green.
Alert on the card count
- alert: HiveServeCorpusEmpty
expr: (sum(hive_corpus_cards{job="hive_serve"}) or vector(0)) == 0
for: 10m
labels: { severity: critical }
- alert: HiveServeDbObjectsEmpty
expr: (sum(hive_corpus_db_objects{job="hive_serve"}) or vector(0)) == 0
for: 10m
labels: { severity: critical }
- alert: HiveServeCorpusShrank
expr: sum(hive_corpus_cards{job="hive_serve"})
< 0.8 * sum(hive_corpus_cards{job="hive_serve"} offset 1h)
for: 15m
labels: { severity: warning }
or vector(0) is load-bearing. Without it, a series that disappears entirely returns no data,
the comparison has nothing to evaluate, and the rule never fires. That is precisely the failure
being guarded against: the corpus vanishing takes the metric with it. Confirm both branches when
you install these, because a rule that cannot fire looks identical to a rule that is not firing.
The shrink rule is a warning rather than a page. Bulk corrections and product removals are legitimate, and a fifth of the corpus disappearing in an hour is worth a look rather than a call-out.
The rest
| Alert | Expression sketch |
|---|---|
| service down | up{job="hive_serve"} == 0 |
| error rate | 5xx ratio over 5m above 5% |
| latency | p95 of http_request_duration_seconds above 1.5s |
What is not measured
Cache hit rates, per-client anything, and card-level access counts.
The last one is a deliberate omission rather than an oversight. Recording which cards each identity reads would build a usage profile of individuals inside client engagements, which is a thing worth not having.