Indexer: optional Prometheus metrics #89

Closed
opened 2026-04-09 03:24:32 +00:00 by PlasticDigits · 6 comments
PlasticDigits commented 2026-04-09 03:24:32 +00:00 (Migrated from gitlab.com)

Epic

#62

## Epic #62
PlasticDigits commented 2026-04-09 03:24:33 +00:00 (Migrated from gitlab.com)

marked this issue as related to #62

marked this issue as related to #62
PlasticDigits commented 2026-04-13 12:29:11 +00:00 (Migrated from gitlab.com)

Epic #62 delivery

Optional Prometheus metrics:

  • Set non-empty METRICS_BIND in the environment to enable GET /metrics on the same host/port as the API (value is a flag; scrape http://<API_BIND>:<API_PORT>/metrics).
  • Counters: indexer_blocks_processed_total, indexer_block_process_errors_total, indexer_block_time_fallbacks_total (indexer/src/metrics.rs, wired from indexer/src/indexer/poller.rs).
  • /metrics is mounted outside the rate-limit layer (indexer/src/api/mod.rs).
  • Tests: indexer/tests/api_metrics.rs (lazy DB pool), metrics::tests in lib.

Verify: cd indexer && cargo test --test api_metrics --lib metrics::

@brouie please review.

## Epic #62 delivery Optional Prometheus metrics: - Set **non-empty** `METRICS_BIND` in the environment to enable `GET /metrics` on the **same host/port as the API** (value is a flag; scrape `http://<API_BIND>:<API_PORT>/metrics`). - Counters: `indexer_blocks_processed_total`, `indexer_block_process_errors_total`, `indexer_block_time_fallbacks_total` (`indexer/src/metrics.rs`, wired from `indexer/src/indexer/poller.rs`). - `/metrics` is mounted **outside** the rate-limit layer (`indexer/src/api/mod.rs`). - Tests: `indexer/tests/api_metrics.rs` (lazy DB pool), `metrics::tests` in lib. Verify: `cd indexer && cargo test --test api_metrics --lib metrics::` @brouie please review.
PlasticDigits commented 2026-04-13 12:29:18 +00:00 (Migrated from gitlab.com)

mentioned in issue #62

mentioned in issue #62
Brouie commented 2026-04-20 06:58:46 +00:00 (Migrated from gitlab.com)

@PlasticDigits Verified on current main. All 3 tests pass:

Unit (metrics::tests): 1 passed

  • gather_contains_indexer_counters

Integration (api_metrics): 2 passed

  • prometheus_metrics_not_exposed_by_default
  • prometheus_metrics_when_enabled

Implementation confirmed: indexer/src/metrics.rs exposes counters indexer_blocks_processed_total, indexer_block_process_errors_total, indexer_block_time_fallbacks_total. /metrics mounted outside rate-limit layer per indexer/src/api/mod.rs. METRICS_BIND env var gates the endpoint (disabled by default, enabled when non-empty).

Optional Prometheus metrics properly wired. Closing.

@PlasticDigits Verified on current main. All 3 tests pass: **Unit (metrics::tests):** 1 passed - gather_contains_indexer_counters **Integration (api_metrics):** 2 passed - prometheus_metrics_not_exposed_by_default - prometheus_metrics_when_enabled Implementation confirmed: indexer/src/metrics.rs exposes counters indexer_blocks_processed_total, indexer_block_process_errors_total, indexer_block_time_fallbacks_total. /metrics mounted outside rate-limit layer per indexer/src/api/mod.rs. METRICS_BIND env var gates the endpoint (disabled by default, enabled when non-empty). Optional Prometheus metrics properly wired. Closing.
Brouie (Migrated from gitlab.com) closed this issue 2026-04-20 06:58:50 +00:00
Brouie commented 2026-04-20 07:20:01 +00:00 (Migrated from gitlab.com)

mentioned in issue #97

mentioned in issue #97
PlasticDigits commented 2026-05-26 08:00:40 +00:00 (Migrated from gitlab.com)

mentioned in issue #200

mentioned in issue #200
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
code/cl8y-dex-terraclassic#89
No description provided.