Skip to content

feat(observability): Prometheus /metrics endpoint with tracing bridge (STR-2557)#1516

Draft
voidash wants to merge 1 commit intomainfrom
STR-2557-prometheus-metrics-endpoint
Draft

feat(observability): Prometheus /metrics endpoint with tracing bridge (STR-2557)#1516
voidash wants to merge 1 commit intomainfrom
STR-2557-prometheus-metrics-endpoint

Conversation

@voidash
Copy link
Contributor

@voidash voidash commented Mar 20, 2026

Adds Prometheus metrics support using the metrics crate (same facade Reth uses).

  • Chain progress gauges: alpen_l1_tip_height, alpen_l2_sync_tip_slot, alpen_l2_finalized_slot, alpen_ol_tip_slot
  • Tracing-to-metrics bridge: MetricsLayer captures span busy/idle timing as alpen_span_busy_seconds / alpen_span_idle_seconds histograms — flows to Prometheus instead of only Loki
  • DB transaction histogram: alpen_db_transaction_duration_seconds for sled transactions (independent of log level)
  • strata binary: metrics-exporter-prometheus serves /metrics on configurable logging.metrics_port
  • alpen-client: our gauges automatically appear on Reth's built-in --metrics endpoint

All calls are no-ops when no recorder is installed.

STR-2557

…2557)

Use the `metrics` crate (same facade Reth uses) with
`metrics-exporter-prometheus` for the HTTP endpoint.

For alpen-client: domain gauges automatically appear on Reth's
built-in --metrics endpoint alongside EVM/P2P metrics.
For strata binary: metrics-exporter-prometheus serves /metrics on
configurable logging.metrics_port.

Chain progress gauges:
- alpen_l1_tip_height: ASM worker anchor block height
- alpen_l2_sync_tip_slot: L2 sync worker tip slot
- alpen_l2_finalized_slot: last finalized L2 slot
- alpen_ol_tip_slot: OL fork-choice best block slot

Tracing-to-metrics bridge:
- MetricsLayer captures span busy/idle timing as histograms
  (alpen_span_busy_seconds / alpen_span_idle_seconds) so they
  flow to Prometheus instead of only being visible in Loki logs

DB metrics:
- alpen_db_transaction_duration_seconds histogram for sled
  transactions, independent of log level
@voidash voidash force-pushed the STR-2557-prometheus-metrics-endpoint branch from 2c021ac to 08c0bd8 Compare March 20, 2026 00:27
@github-actions
Copy link
Contributor

github-actions bot commented Mar 20, 2026

Commit: 4513b72

SP1 Execution Results

program cycles success
EVM EE STF 1,320,914
Checkpoint 5,226
Checkpoint New 883,623

@codecov
Copy link

codecov bot commented Mar 20, 2026

Codecov Report

❌ Patch coverage is 11.29032% with 55 lines in your changes missing coverage. Please review.
✅ Project coverage is 65.55%. Comparing base (41587e9) to head (08c0bd8).
⚠️ Report is 4 commits behind head on main.

Files with missing lines Patch % Lines
crates/common/src/logging/metrics_layer.rs 0.00% 45 Missing ⚠️
bin/strata/src/main.rs 0.00% 5 Missing ⚠️
crates/common/src/logging/manager.rs 0.00% 2 Missing ⚠️
crates/sync/src/state.rs 0.00% 2 Missing ⚠️
crates/consensus-logic/src/fcm/state.rs 0.00% 1 Missing ⚠️

❗ There is a different number of reports uploaded between BASE (41587e9) and HEAD (08c0bd8). Click for more details.

HEAD has 2 uploads less than BASE
Flag BASE (41587e9) HEAD (08c0bd8)
unit 2 1
functional 1 0
@@            Coverage Diff             @@
##             main    #1516      +/-   ##
==========================================
- Coverage   75.24%   65.55%   -9.69%     
==========================================
  Files         800      801       +1     
  Lines       74882    75671     +789     
==========================================
- Hits        56342    49608    -6734     
- Misses      18540    26063    +7523     
Flag Coverage Δ
functional ?
unit 65.55% <11.29%> (+0.52%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
crates/asm/worker/src/state.rs 76.27% <100.00%> (-1.30%) ⬇️
crates/common/src/logging/mod.rs 0.00% <ø> (-80.00%) ⬇️
crates/config/src/config.rs 91.70% <ø> (-2.60%) ⬇️
crates/db/store-sled/src/config.rs 70.96% <100.00%> (+4.30%) ⬆️
crates/consensus-logic/src/fcm/state.rs 0.00% <0.00%> (-81.61%) ⬇️
crates/common/src/logging/manager.rs 0.00% <0.00%> (-29.17%) ⬇️
crates/sync/src/state.rs 0.00% <0.00%> (ø)
bin/strata/src/main.rs 0.00% <0.00%> (-95.66%) ⬇️
crates/common/src/logging/metrics_layer.rs 0.00% <0.00%> (ø)

... and 245 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant