Mirexa

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
/metrics Prometheus text exposition every family listed in docs/metrics/catalog.txt
/health liveness 503 when a registered check fails
/ready 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_candles_total, ingestion_ticks_total, ingestion_latency_seconds, ingestion_durability_wait_seconds, ingestion_shed_batches_total{kind,reason}, ingestion_restatements_total{outcome}, wal_buffered_bytes sheds (every one is an Overloaded answer that stored nothing); wal_buffered_bytes climbing toward wal.max_buffer_bytes before sheds begin
Queries queries_total, query_duration_seconds, query_errors_total, query_result_size, query_cache_*, decoded_chunk_cache_* latency; chunk-cache hit ratio when sizing storage.decoded_chunk_cache_bytes
Network network_connections_active, network_connections_rejected_total, network_frames_total, network_frames_invalid_total, errors_total{component,error_type} rejected connections (at max_connections); invalid frames
Subscriptions subscriptions_active, subscription_batches_total{result}, subscription_evictions_total, subscription_backfills_total dropped batches and evictions (slow consumers)
Authentication and TLS init_handshakes_total{result}, init_handshake_duration_seconds, tls_handshakes_total, tls_handshake_errors_total, tls_cert_reloads_total expired, invalid_signature and revoked handshake results; failed reloads
Storage storage_streams, storage_records, storage_bytes, storage_uncompressed_bytes, each with scope=held or scope=served growth; compression ratio (uncompressed_bytes ÷ bytes)
Data health (per stream) stream_newest_data_timestamp_seconds, stream_trading_seconds_since_data, stream_interval_seconds, stream_open_gaps, stream_missing_seconds see below
Control plane control_rpcs_total{method,code} —
Cluster cluster_partitions_{unassigned,under_replicated,primary_down,unavailable}, cluster_copies_missing, cluster_primary_lease_remaining_seconds, cluster_migrations_*, cluster_rebalance_*_recommended, cluster_replica_transitions_total, raft_*, redirects_total, fenced_writes_total, copy_reads_total partitions_unavailable > 0 is data out of reach; lease at 0 on a primary
Replication and repair replica_copies, replica_worst_lag_seconds, replica_worst_lag_records, replication_cert_expiry_timestamp_seconds, reconcile_rotten_chunks, reconcile_repairs_total, reconcile_divergences_total, reconcile_startup_quarantines_total, reconcile_scrub_* reconcile_rotten_chunks 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_stream_newest_data_timestamp_seconds timestamp of the newest bar, flushed or not
mirexa_stream_trading_seconds_since_data trading time since that bar closed, by the stream's calendar; a market closure adds nothing
mirexa_stream_interval_seconds the stream's bar interval
mirexa_stream_open_gaps OPEN gaps: missing data that can be filled (market closures are not gaps)
mirexa_stream_missing_seconds 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) or console. JSON lines carry level, 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) with max_backups, max_age_days and optional gzip.
  • Level logging.level (info by default) is the one setting the server applies on hot reload.
  • Sampling: past sample_initial identical messages in a second, one in sample_thereafter is 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.checkpoint_interval: 0
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_timeout
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_CANDLES and LIST_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

Tests

Further reading

External