0.4.2 — Prometheus metrics & structured tracing
This release adds an optional Prometheus metrics endpoint and structured tracing across all crates. Both are opt-in at build time and have no effect on default builds.
Note: the published Docker images for this release —
0.4.2(default) and0.4.2-no-tls(no_tls_use_unencrypted_traffic) — are built without metrics. Metrics require a build with theprometheusfeature (see below).
Enabling metrics
Build time — compile zainod with the prometheus cargo feature:
cargo build -p zainod --release --features prometheusThe prometheus feature fans out to zaino-state/prometheus, zaino-serve/prometheus, and zaino-fetch/prometheus, and pulls in metrics + metrics-exporter-prometheus. There is also a convenience feature no_tls_with_prometheus (= no_tls_use_unencrypted_traffic + prometheus) for no-TLS operator builds; the container Dockerfile enables it when built with --build-arg CARGO_FEATURES=no_tls_with_prometheus (these images are published with a -no-tls-with-prometheus tag suffix, separate from the stock -no-tls release image).
Runtime — set metrics_endpoint in the zainod config (default None = disabled):
metrics_endpoint = "0.0.0.0:9998"A Prometheus scrape endpoint is then served at that address (port 9998 by convention). Metric names are emitted with dots in code (zaino.sync.lag_blocks) and sanitized to underscores on export (zaino_sync_lag_blocks), which is what you scrape/query.
Metrics exposed
Build info
zainod_build_info— gauge,versionlabel
Sync lifecycle (zaino-state)
zaino_chain_tip_height,zaino_db_tip_heightzaino_sync_finalized_height,zaino_sync_target_height,zaino_sync_lag_blockszaino_sync_iterations_total,zaino_sync_iteration_duration_seconds,zaino_sync_errors_totalzaino_sync_has_reached_tip,zaino_sync_reached_tip_at,zaino_sync_last_block_written_atzaino_sync_reorg_total,zaino_sync_reorg_depthzaino_sync_block_build_seconds,zaino_sync_block_write_secondszaino_sync_transactions_total,zaino_sync_sapling_outputs_total,zaino_sync_orchard_actions_total
Mempool (zaino-state)
zaino_mempool_transactions,zaino_mempool_tip_changes_total
Outbound RPC to Zebra (zaino-fetch)
zaino_rpc_outbound_requests_total— counter,methodlabelzaino_rpc_outbound_request_duration_seconds— histogram,methodlabelzaino_rpc_outbound_errors_total,zaino_rpc_outbound_retries_total
gRPC inbound (zaino-serve)
zaino_grpc_requests_total,zaino_grpc_request_duration_seconds,zaino_grpc_errors_total
Error counters carry a severity label (critical / recoverable).
Structured tracing
Tracing emission was reworked to use structured key-value fields across all crates (no new mandatory configuration; standard RUST_LOG filtering applies), making logs machine-parseable for ingestion into log pipelines.
Crate versions
zainod 0.4.2, zaino-serve 0.3.1, zaino-state 0.3.1, zaino-fetch 0.2.1, zaino-proto 0.1.3, zaino-common 0.2.0 — all published to crates.io.