Skip to content

fix(node): restore layer1 validator metrics overrides#1023

Open
curryxbo wants to merge 1 commit into
mainfrom
fix/validator-metrics-port-config
Open

fix(node): restore layer1 validator metrics overrides#1023
curryxbo wants to merge 1 commit into
mainfrom
fix/validator-metrics-port-config

Conversation

@curryxbo

@curryxbo curryxbo commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Problem

PR #966 removed the standalone layer1 validator metrics CLI/environment overrides. Operators can configure metrics through Tendermint [instrumentation], but can no longer override the enable switch or listener port from deployment environment variables without editing config.toml.

Fix

Restore two overrides for layer1 verification mode only:

  • --metrics-server-enable / MORPH_NODE_METRICS_SERVER_ENABLE overrides [instrumentation] prometheus for the standalone layer1 validator listener.
  • --metrics-port / MORPH_NODE_METRICS_PORT replaces only that listener port while preserving the hostname from prometheus_listen_addr.

When neither option is set, behavior comes entirely from config.toml. Other modes continue using Tendermint metrics and are unaffected by these compatibility flags.

Validation

  • go test ./derivation ./cmd/node ./flags
  • make -C node lint

@curryxbo
curryxbo requested a review from a team as a code owner July 17, 2026 10:35
@curryxbo
curryxbo requested review from dylanCai9 and removed request for a team July 17, 2026 10:35
@coderabbitai

coderabbitai Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Layer1 verify mode resolves the validator metrics address from optional CLI/environment overrides, with fallback to Tendermint configuration and a default port when only a hostname is provided.

Changes

Validator metrics overrides

Layer / File(s) Summary
Metrics flag definitions and registration
node/flags/flags.go
Adds metrics-hostname and metrics-port flags, derives their environment variables, and registers them in the node flag set.
Metrics address resolution and verification wiring
node/cmd/node/main.go, node/cmd/node/main_test.go
Resolves metrics overrides for Layer1 verify mode, defaults the port when needed, preserves configured addresses when unset, and tests address formatting and zero-port handling.

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

Suggested reviewers: dylancai9

Sequence Diagram(s)

sequenceDiagram
  participant CLI as CLI or environment
  participant Resolver as resolveValidatorMetricsAddr
  participant VerifyMode as Layer1 verify mode
  participant MetricsServer as Validator metrics server
  CLI->>Resolver: Provide metrics hostname and port
  Resolver->>VerifyMode: Return override or fallback address
  VerifyMode->>MetricsServer: Start server on resolved address
Loading
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 40.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
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.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change: restoring layer1 validator metrics overrides.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/validator-metrics-port-config

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@node/cmd/node/main.go`:
- Around line 419-434: Update resolveValidatorMetricsAddr to use ctx.IsSet for
metrics hostname and port, preserving the fallback only when neither option is
set and retaining an explicitly provided port value of zero. Apply
defaultMetricsPort only when the port is genuinely unset, then construct the
address with net.JoinHostPort so IPv6 hosts are bracketed correctly; convert the
port to the required string form using strconv.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: fa44c184-e866-45bc-9445-86ec7c0c4088

📥 Commits

Reviewing files that changed from the base of the PR and between 60a7515 and 7fce578.

📒 Files selected for processing (2)
  • node/cmd/node/main.go
  • node/flags/flags.go

Comment thread node/cmd/node/main.go Outdated

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Claude Code Review

Claude Code Review is paused for this repository. To reconnect it, an admin of this repository's GitHub organization (or the account owner, for personal repositories) who can also manage your Claude organization's Code Review settings needs to re-link GitHub in Code Review settings. This is a one-time step.

Tip: disable this comment in your organization's Code Review settings.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@node/cmd/node/main_test.go`:
- Around line 51-55: Update the subtests in the tests loop to clear inherited
MORPH_NODE_METRICS_HOSTNAME and MORPH_NODE_METRICS_PORT before applying each
case’s configured environment values, ensuring fallback, hostname-only, and
port-only scenarios run independently of ambient variables.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 5ce06bcf-bcd6-4478-a99b-bd31fb463cae

📥 Commits

Reviewing files that changed from the base of the PR and between 7fce578 and 94d181a.

📒 Files selected for processing (2)
  • node/cmd/node/main.go
  • node/cmd/node/main_test.go
🚧 Files skipped from review as they are similar to previous changes (1)
  • node/cmd/node/main.go

Comment thread node/cmd/node/main_test.go Outdated
@curryxbo
curryxbo force-pushed the fix/validator-metrics-port-config branch 2 times, most recently from 46d6ddf to fa66980 Compare July 22, 2026 03:36
@curryxbo curryxbo changed the title fix(node): make validator metrics address configurable via flag/env fix(node): make validator metrics port configurable Jul 22, 2026
@curryxbo
curryxbo force-pushed the fix/validator-metrics-port-config branch from fa66980 to 7883889 Compare July 22, 2026 03:42
@curryxbo curryxbo changed the title fix(node): make validator metrics port configurable fix(node): restore metrics CLI and env overrides Jul 22, 2026
Restore enable and port CLI/environment overrides only for the standalone layer1 validator listener while leaving Tendermint-backed modes unchanged.

Co-authored-by: Cursor <cursoragent@cursor.com>
@curryxbo
curryxbo force-pushed the fix/validator-metrics-port-config branch from 7883889 to b51050b Compare July 22, 2026 03:46
@curryxbo curryxbo changed the title fix(node): restore metrics CLI and env overrides fix(node): restore layer1 validator metrics overrides Jul 22, 2026
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