Monitor Ledger from the user-visible outcome back to the cluster. A useful alert says which capability is at risk, which cluster or member caused it, what evidence confirms it, and which runbook owns the response.
Before you connect telemetry#
Decide and record:
- the OpenTelemetry collector and storage backend;
- the Ledger metric prefix and the collector's name normalization;
- the stable environment, Stack, cluster, and node attributes;
- retention for metrics, traces, and logs;
- service-level objectives for write availability, current reads, and latency;
- an owner and runbook for every paging alert.
Every node reports service.name ledger. A cluster is identified by k8s.namespace.name and formance.ledger.cluster.name, and a member by formance.ledger.node.id. The operator sets the namespace and sets the cluster name to the Cluster resource name; without the operator, the namespace is absent and the cluster name defaults to the cluster ID. Node IDs repeat across clusters and separate clusters often share a cluster ID, so group by namespace and cluster name as well as node. service.instance.id, which Prometheus maps to the instance label, is unique per node.
Without these attributes, a slow member and a cluster-wide outage look alike. The dashboards Ledger ships use k8s.namespace.name, formance.ledger.cluster.name, and formance.ledger.node.id as their template variables and expect them as series labels, so the pipeline must promote them from target_info — for example with the collector's resource_to_telemetry_conversion or Prometheus otlp.promote_resource_attributes. Treat the names as a contract rather than an implementation detail, and never set service.instance.id or formance.ledger.node.id in a cluster-wide attribute list such as spec.monitoring.attributes: every node would then report the same identity.
Know the metric names#
Ledger emits every metric its own code creates under the formance.ledger namespace, in OpenTelemetry dot notation. For example:
formance.ledger.raft.node.leader;formance.ledger.raft.fsm.logs_appended;formance.ledger.raft.apply_entries.duration;formance.ledger.admission.propose_queue.overflows;formance.ledger.pebble.write_stall.active;formance.ledger.storage.disk.volume.usage;formance.ledger.usage.builder.lag.
The prefix covers the raft.* and pebble.* families too: etcd-raft and Pebble do not export OpenTelemetry themselves, so those are Ledger's own instruments. OpenTelemetry semantic-convention metrics — http.server.request.duration, rpc.*, go.*, process.*, and system.* — keep their upstream names and never receive the prefix.
The server always emits dot notation. A collector that writes to Prometheus replaces the dots with underscores. Under the default full OpenTelemetry-to-Prometheus normalization, which ledger-metrics-prom-normalized-native.json expects, it also appends _total to counters and a unit suffix to histograms: formance.ledger.raft.fsm.logs_appended is stored as formance_ledger_raft_fsm_logs_appended_total, and formance.ledger.admission.command.duration as formance_ledger_admission_command_duration_seconds. A collector that only replaces the dots stores formance_ledger_raft_fsm_logs_appended.
The namespace is configurable with the --otel-metrics-prefix server flag, the OTEL_METRICS_PREFIX environment variable, or spec.monitoring.metrics.prefix on the Ledger operator's Cluster resource. It defaults to formance.ledger; set it to none to emit the names without a prefix. An empty OTEL_METRICS_PREFIX is ignored rather than treated as none.
Ledger 3.0 pre-release builds used different metric and resource attribute names. Rebuild any dashboard or alert written against a pre-release on the names on this page before you upgrade; a silent name mismatch removes monitoring while the service keeps running.
Ledger ships a generated Grafana dashboard for each combination of server prefix, collector normalization, and histogram representation, so you do not have to rewrite queries by hand. The eight variants are committed under misc/devenv/monitoring-dashboards/config/dashboards in the Ledger repository, and the README beside them maps every file to the server prefix, collector behavior, and histogram representation it expects. Pick the one matching your pipeline: ledger-metrics-prom-normalized-native.json covers the common case of the default prefix with full OpenTelemetry-to-Prometheus normalization and native histograms, and the -noprefix files match a server running with the prefix set to none. A custom prefix has no pre-built dashboard.
Configure OTLP export, authentication, the metric prefix, and resource attributes only through the release-specific Stack Operator fields documented for your selected Stack version.
Do not copy provisional field names into a production resource.
Verify the telemetry path#
Run this precheck before loading dashboards:
- Confirm that every voter exports a process heartbeat and a distinct node label.
- Confirm that all voters share the intended cluster label.
- Send a controlled read and write in a test ledger.
- Find the corresponding HTTP or gRPC trace and the server-side span. HTTP server spans come from the
ledger-http-serverinstrumentation. A write then shows theadmission.*span family —admission.verify_signatures,admission.preload,admission.propose,admission.fsm_wait,admission.marshal— and a read shows thectrl.*family. - Confirm that request duration, response status, and route attributes appear without unbounded IDs in labels.
- Compare
formance.ledger.raft.fsm.logs_appendedbefore and after the write. - Compare
ledgerctl cluster statuswith the reported leader and member signals. - Stop one telemetry collector in staging and confirm that Ledger requests continue while telemetry delivery recovers.
Telemetry export must not become a dependency of the write path.
Build the operational dashboard#
Keep the primary dashboard focused on decisions:
| Question | Signals to correlate |
|---|---|
| Can the cluster commit? | Known leader, healthy voter count, commit/apply positions, proposal errors. |
| Are users succeeding? | Request rate, latency by operation, response status, retry reasons. |
| Is consensus under pressure? | Apply duration, WAL append duration, peer latency, queue load and full events. |
| Can storage sustain the workload? | WAL/data bytes, disk headroom, flush/compaction duration, active write stalls. |
| Will a process be killed? | Working memory, Go heap goal, container limit, restarts and OOM events. |
| Can applications query? | Required index state and lag, read latency, consistency failures. |
| Are usage statistics current? | Usage-builder processed position, available audit head, and lag on every serving member. |
| Are asynchronous workflows current? | Event-sink cursor/error, backup job state and last verified artifact. |
Use separate detail dashboards for consensus queues, Pebble, indexes, usage projection, event sinks, and backup jobs. The landing dashboard should answer whether users can write and read now.
For Mirror progress and promotion proofs, use the migration-specific Mirror monitoring procedure.
Monitor usage statistics#
Ledger serves per-ledger counters through the ledger stats endpoint and ledgerctl ledgers stats. Applications and finance dashboards read them, so a stalled projection surfaces as numbers that quietly stop moving rather than as a failed request.
The nine returned fields do not share one source. transactionCount and logCount come from Raft-applied ledger boundaries and are always current. The projected counters — volumeCount, postingCount, referenceCount, revertCount, numscriptExecutionCount, ephemeralEvictedCount, and transientUsedCount — along with Numscript template usage, are rebuilt from the audit chain into a local derived store on each member. Those can trail committed accounting data briefly during normal operation and for longer after an upgrade or restore.
When a stats read carries a checkpoint, every projected counter returns 0. Read that 0 as "not available at this checkpoint", not as an empty ledger; only transactionCount and logCount are checkpoint-consistent. metadataCount is not returned at all, and ephemeralEvictedCount and transientUsedCount are informational — the integrity checker excludes them when it re-derives ledger boundaries.
| Metric | Healthy interpretation |
|---|---|
formance.ledger.usage.builder.last_indexed_sequence | Advances as audit entries are reflected in the local usage store. |
formance.ledger.usage.builder.audit_last_sequence | Tracks the latest audit sequence available from the primary store. |
formance.ledger.usage.builder.lag | Returns to zero after normal writes, startup catch-up, an upgrade, or a restore. |
Compare all three gauges on every serving member. formance.ledger.usage.builder.lag counts sequences, not time: it is the latest available audit sequence minus the last one indexed locally. A large but decreasing lag is expected during a known rebuild; an unchanged or growing lag needs investigation, and so does last_indexed_sequence standing still while audit_last_sequence keeps moving.
formance.ledger.usage.builder.lag = 0 means the member processed the audit history still available to it. It does not prove that archived pre-reset history contributed to the counters, and neither the primary-store integrity checker nor restore validate checks this local projection.
Start with actionable alerts#
The conditions below are initial triggers, not universal capacity promises. Validate them under representative load and tune them against your service objectives.
| Alert | Initial trigger | User impact | Verify | First action |
|---|---|---|---|---|
| No leader | Every replica reports formance.ledger.raft.node.leader = 0 for 30 seconds | Writes and linearizable reads cannot complete | ledgerctl cluster status | Restore a voter majority and peer connectivity; honor Retry-After while elections remain transient. |
| Lost failure tolerance | Fewer healthy voters than the intended topology | The next failure can stop commits | Cluster and Operator status | Stop rollout or disruption and recover the missing voter. |
| Proposal queue full | Any increase in formance.ledger.admission.propose_queue.overflows when admission metrics are enabled (--admission-metrics, off by default), or any corresponding overload error | Writes are rejected or delayed | Queue load, apply and WAL latency | Reduce incoming load, then find consensus or storage pressure. |
| Active write stall | formance.ledger.pebble.write_stall.active = 1 for 10 seconds | Write latency rises and requests may fail | Compaction, flush, CPU and disk IOPS | Reduce writes and restore storage throughput or headroom. |
| Disk headroom low | Used bytes on formance.ledger.storage.disk.volume.usage cross the warning level you compute against volume capacity, initially no later than 70% | Ledger can block writes at its configured high-water mark | ledgerctl cluster disk-usage on each member | Expand the affected volume and confirm usage falls below the resume mark. |
| Memory headroom low | Working memory remains near the container limit or startup estimate exceeds GOMEMLIMIT | Kubernetes can kill a voter | Process, Go and container metrics | Reduce configured memory consumers or increase the limit; keep quorum during restart. |
| Apply latency outside SLO | p99 formance.ledger.raft.apply_entries.duration exceeds the tested baseline for five minutes | Write latency and catch-up time rise | WAL, compaction, queue and peer latency | Identify CPU, disk, network, or payload pressure before tuning. |
| HTTP failures outside SLO | 5xx rate exceeds the service objective by route | Users receive failed requests | Status code, structured error reason, leader and write gates | Route to Troubleshoot Ledger; do not retry every 5xx identically. |
| Required index not ready | A required index is building, failed, or behind on any serving member | Queries fail or return an unavailable view | Index status per replica | Keep dependent traffic disabled and recover the index build. |
| Usage projection behind | formance.ledger.usage.builder.lag remains above the tested sequence backlog or grows continuously | Ledger statistics and Numscript template usage are stale or incomplete | The three usage-builder gauges on the affected member | Preserve logs, reduce competing resource pressure, and let the online builder catch up; do not delete its store as an alert response. |
| Async workflow stalled | A sink or backup cursor stops advancing and reports an error | Downstream delivery or the recovery point falls behind | Workflow-specific status | Follow its owning runbook; a committed transaction is not rolled back by sink failure. |
Ledger exports used bytes, not capacity
formance.ledger.storage.disk.volume.usage reports used bytes only, once per volume, with a volume attribute of wal or data. Ledger publishes no capacity series, so the disk-headroom percentage cannot be computed from Ledger telemetry alone. Pair the gauge with your platform's volume-capacity series — kubelet_volume_stats_capacity_bytes on Kubernetes, for example — or read used and total together from ledgerctl cluster disk-usage. The server does compare used against total internally to apply its own high- and low-water marks; it just does not export the ratio.
Attach a dashboard link, owner, severity, expected response time, and runbook to each alert. Page only on conditions that require an operator action; use tickets or dashboards for trends that need capacity planning.
Diagnose an alert#
Begin with non-destructive evidence:
cluster disk-usage reports the node to which ledgerctl is directly connected; run it against each member endpoint or profile when the cluster-level alert does not identify the affected volume.
Then correlate the alert window with the two things this page owns: Stack and Kubernetes reconciliation events, and any deployment, index build, usage-projection rebuild, backup, or restore in flight. For the full signal-by-signal chain — request reasons, queue load, WAL and apply duration, membership changes, compaction, disk, memory, and changes in client request shape — follow the latency procedure in Troubleshoot Ledger instead of keeping a second copy of that order here.
Do not compact, restart, remove a member, or change thresholds only to clear the alert. Identify the resource or availability constraint first.
Verify and roll back monitoring changes#
After changing export, dashboards, or alerts:
- repeat the controlled read and write;
- confirm every member still reports under the same cluster identity;
- exercise one warning and one paging route in staging;
- confirm the notification reaches the documented owner;
- verify that the linked runbook contains a non-destructive first step;
- watch telemetry delivery and Ledger request latency through the change window.
If telemetry disappears, restore the previous exporter and metric prefix configuration. Keep the previous dashboards and alerts active until the replacement has produced continuous data for an agreed overlap period.
A collector failure must never be handled by disabling Ledger health or capacity protection.