Skip to content

feat(node): add morphnode_info metrics gauge - #1071

Open
MarvelFisher wants to merge 1 commit into
mainfrom
feat/node-info-metric
Open

MarvelFisher wants to merge 1 commit into
mainfrom
feat/node-info-metric

Conversation

@MarvelFisher

@MarvelFisher MarvelFisher commented Sep 22, 2026

Copy link
Copy Markdown
Collaborator

Expose morphnode's build/version metadata as a static Prometheus info gauge, mirroring morph-reth's reth_info{} gauge: morphnode_info{...} is permanently set to 1, and version/git_commit/build_time (populated via the existing -ldflags injection) plus go_version/os/arch are carried as labels rather than the value. Registered once at startup on the default registry, so it's exposed regardless of which branch brings up /metrics.

Summary by CodeRabbit

  • New Features
    • Added Prometheus build information metrics for the node, including version, commit, build time, Go version, operating system, and architecture.
    • Exposed the metrics consistently through the node’s /metrics endpoint.

Expose morphnode's build/version metadata as a static Prometheus info
gauge, mirroring morph-reth's reth_info{} gauge: morphnode_info{...} is
permanently set to 1, and version/git_commit/build_time (populated via
the existing -ldflags injection) plus go_version/os/arch are carried as
labels rather than the value. Registered once at startup on the default
registry, so it's exposed regardless of which branch brings up /metrics.
@MarvelFisher
MarvelFisher requested a review from a team as a code owner September 22, 2026 06:16
@MarvelFisher
MarvelFisher requested review from dylanCai9 and removed request for a team September 22, 2026 06:16
@coderabbitai

coderabbitai Bot commented Sep 22, 2026

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: eb1b0e2f-a07a-4a3f-824d-a8c3b23eb8ef

📥 Commits

Reviewing files that changed from the base of the PR and between aa35ed6 and 7dbf5c3.

📒 Files selected for processing (4)
  • node/cmd/node/main.go
  • node/go.mod
  • node/version/metrics.go
  • node/version/metrics_test.go

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

The PR adds a version metrics package, tests its Prometheus and no-op implementations, moves a dependency to direct scope, and registers morphnode_info during node startup.

Changes

Prometheus metadata metric

Layer / File(s) Summary
Info metric implementation and validation
node/version/metrics.go, node/version/metrics_test.go, node/go.mod
The version package adds Prometheus and no-op metric constructors. The gauge reports build and runtime metadata and has value 1. Tests validate labels, value, and no-op registration. The Prometheus client model dependency is declared directly.
Node startup registration
node/cmd/node/main.go
L2NodeMain registers morphnode_info with build metadata before mode-specific setup.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Feature

Sequence Diagram(s)

sequenceDiagram
  participant L2NodeMain
  participant PrometheusMetrics
  participant DefaultPrometheusRegistry
  L2NodeMain->>PrometheusMetrics: provide morphnode build metadata
  PrometheusMetrics->>DefaultPrometheusRegistry: register morphnode_info
  DefaultPrometheusRegistry-->>L2NodeMain: expose gauge value 1
Loading

Merge Risk: ⚪ Minimal · up to 7dbf5

The change adds build metadata metrics with focused coverage and is ready to merge.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: adding the morphnode_info Prometheus metrics gauge.
Docstring Coverage ✅ Passed Docstring coverage is 83.33% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 6 functions across 3 files. (1 skipped: 1 u…
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR

Warning

Billing warning: we have not been able to collect payment for this subscription for more than 72 hours. Please update the payment method or pay any pending invoices in Billing to avoid service interruption.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

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