Wiki Operations
Monitoring and alerting
What a Mirexa node exposes for monitoring — the /metrics, /health and /ready endpoints, the metric families by area, data-health gauges, logs, and the companion monitoring stack.
Every Mirexa node serves Prometheus metrics and two health probes over HTTP on
observability.addr, and logs structured JSON. Each node reports only its own numbers:
there is no cluster-wide aggregation inside Mirexa, and rates and percentiles are computed
by whatever scrapes it. The dashboard process exports its own small set of metrics on a
separate port. Alert rules, dashboards and playbooks live in a companion repository.
Endpoints
| Path | Purpose | Notes |
|---|---|---|
/ |
Prometheus text exposition | every family listed in docs/ |
/ |
liveness | 503 when a registered check fails |
/ |
readiness | 503 until startup has finished, after shutdown begins, or when a check fails |
The node's checks are tcp_listener (the data-plane listener is running) and data_dir
(the data directory exists). Neither measures free disk space; monitor that from the host.
Details and example responses are in running a node.
The observability server starts late in startup — after WAL recovery and, on a clustered node, after joining — and stops last at shutdown, so a long recovery shows as a refused connection rather than a 503.
If the observability address cannot be bound (for example, it collides with the control listener's default
127.0.0.1:9090), the node logs one ERROR line and keeps running with no metrics or probes. Alert on a target that stops answering, not only on metric values.
Metric families
All node families carry the mirexa_ prefix; the standard Go process collector adds
process_*. docs/metrics/catalog.txt in the repository is generated from the node's own
registry by a test and lists all 94 mirexa_ and process_ families with their labels and
help text (as of 2026-10-30); the metrics reference describes
them. Some families are registered only when the feature that feeds them is on: the query
cache, the decoded chunk cache, and everything clustered (Raft, partition health,
migrations, replication, reconciliation, the primary lease).
| Area | Representative families | Watch for |
|---|---|---|
| Ingestion | ingestion_, ingestion_, ingestion_, ingestion_, ingestion_, ingestion_, wal_ |
sheds (every one is an Overloaded answer that stored nothing); wal_ climbing toward wal. before sheds begin |
| Queries | queries_, query_, query_, query_, query_, decoded_ |
latency; chunk-cache hit ratio when sizing storage. |
| Network | network_, network_, network_, network_, errors_ |
rejected connections (at max_); invalid frames |
| Subscriptions | subscriptions_, subscription_, subscription_, subscription_ |
dropped batches and evictions (slow consumers) |
| Authentication and TLS | init_, init_, tls_, tls_, tls_ |
expired, invalid_ and revoked handshake results; failed reloads |
| Storage | storage_, storage_, storage_, storage_, each with scope=held or scope=served |
growth; compression ratio (uncompressed_) |
| Data health (per stream) | stream_, stream_, stream_, stream_, stream_ |
see below |
| Control plane | control_ |
— |
| Cluster | cluster_, cluster_, cluster_, cluster_, cluster_, cluster_, raft_, redirects_, fenced_, copy_ |
partitions_ > 0 is data out of reach; lease at 0 on a primary |
| Replication and repair | replica_, replica_, replica_, replication_, reconcile_, reconcile_, reconcile_, reconcile_, reconcile_ |
reconcile_ that stays above 0 (no copy holds the chunk whole); certificate expiry |
Several cluster gauges report NaN, not zero, when the node cannot read its control-plane state or (for the rebalance gauges) cannot tell; treat NaN as "unknown", never as healthy. See operating a cluster.
Data-health gauges
For each stream a node serves (on a cluster, the streams it is primary of — a copy never reports, so a stream is never counted twice), the node exports:
| Family | Meaning |
|---|---|
mirexa_ |
timestamp of the newest bar, flushed or not |
mirexa_ |
trading time since that bar closed, by the stream's calendar; a market closure adds nothing |
mirexa_ |
the stream's bar interval |
mirexa_ |
OPEN gaps: missing data that can be filled (market closures are not gaps) |
mirexa_ |
time those OPEN gaps cover |
Because staleness is measured in trading time, a stale-feed alert on
stream_trading_seconds_since_data (relative to stream_interval_seconds) does not fire
over a weekend or a declared holiday. These are read at scrape time over every served
stream, so with many streams they are high-cardinality: one series per stream per family.
See gaps and trading calendars.
Dashboard metrics
mirexa-dashboard serves its own metrics on dashboard.metrics_addr (default
127.0.0.1:9101), separate from its UI port, under mirexa_dashboard_: upstream connection
state, authentication and transport failures, reconnects, ingest calls and attempts,
stream records, and the permissions the node granted it. They describe the dashboard's
connection to the node — things the node cannot see, such as a handshake it refused.
Logs
Both processes log through zap:
- Format
logging.encoding: json(default) orconsole. JSON lines carrylevel,ts(Unix time in nanoseconds, an integer),msg, and structured fields. - Destination
logging.output: stderr(default),stdout, or a file path; files rotate by size (max_size_mb) withmax_backups,max_age_daysand optional gzip. - Level
logging.level(infoby default) is the one setting the server applies on hot reload. - Sampling: past
sample_initialidentical messages in a second, one insample_thereafteris kept.
Lines worth alerting or searching on:
Message (msg) |
Level | Meaning |
|---|---|---|
mirexa started |
info | startup finished; carries listen address, TLS and auth posture |
observability server |
error | the metrics/health server failed (usually a bind error) |
WAL checkpointing disabled; the log will grow without bound |
warn | wal. |
WAL checkpoint failed |
error | a checkpoint could not drain or reclaim |
ingest failed / tick ingest failed |
error | an internal failure answered as Internal to a client |
config changes require a restart to take effect |
warn | a hot reload changed fields that only a restart applies |
stopping with copies not yet sent everything this node acknowledged; . |
error | shutdown hand-off timed out; a failover may lack the tail |
raft entry could not be applied; this node is diverging from its peers |
error | the control-plane state machine failed to apply an entry |
starting with the LOCAL configuration: |
warn | cluster settings did not arrive within settings_ |
this node has been decommissioned and has left the cluster; . |
warn | the node stops (exit 0) |
Two configuration and TLS messages bypass the logger and go straight to stderr:
[config warning] ... (an environment variable that did not parse),
[config watcher] failed to reload ... and [tls error] certificate reload failed: ....
The monitoring stack
The Prometheus rules, Alertmanager routing, Grafana dashboards and a Grafana data source
for Mirexa live in a separate repository (mirexa-monitoring), not in this one. In outline
(not verified here, since it is outside this repository):
- Alert rules with unit tests, each with a section in a runbook. Two are specific to Mirexa: a stale-stream alert on trading time since the newest bar, which never pages for a closed market, and an open-gap alert on OPEN gaps only.
- Alertmanager routing, grouping and inhibition.
- Generated Grafana dashboards, checked against
docs/metrics/catalog.txt. - A Grafana data source that reads candles, gaps and live bars over the wire protocol,
following cluster redirects itself. It needs a token with
READ_CANDLESandLIST_STREAMS. - node_exporter for disk free space, which the node does not report as a metric.
Point Prometheus at every node's observability.addr and every dashboard's
dashboard.metrics_addr.
References
Source
observability.NewServer,HealthManager.observability.Metricsand itsRegister*methods.RegisterDataHealth.observability.New(logger).- /docs/metrics/catalog.txt — the generated list of families.
- /cmd/dashboard/metrics.go — the dashboard's families.
Tests
TestCatalog_IsCurrent,TestCatalog_CoversEveryRegisterMethod(/internal/observability/catalog_test.go).TestHealthManager_ReadinessHandler_NotReady,TestHealthManager_LivenessHandler_CheckFails(/internal/observability/health_test.go).TestServer_ShedIngestAnswersOverloaded(/internal/network/server_overload_test.go).TestDashMetrics_EverySeriesExistsBeforeItsFirstEvent(/cmd/dashboard/metrics_test.go).
Further reading
External
- Prometheus exposition formats — https://prometheus.io/docs/instrumenting/exposition_formats/
- zap — https://pkg.go.dev/go.uber.org/zap