Skip to content

feat(app): Charon-parity monitoring metrics and custom testnet support - #566

Open
varex83 wants to merge 1 commit into
mainfrom
feat/monitoring-metrics-and-testnet-parity
Open

feat(app): Charon-parity monitoring metrics and custom testnet support#566
varex83 wants to merge 1 commit into
mainfrom
feat/monitoring-metrics-and-testnet-parity

Conversation

@varex83

@varex83 varex83 commented Jul 23, 2026

Copy link
Copy Markdown
Collaborator

Summary

Brings three Charon parity gaps in the app crate up to functional equivalence.

Monitoring metrics parity (initStartupMetrics + global labels)

  • Adds the startup gauges Charon exposes: app_version, app_peer_name, app_git_commit, app_start_time_secs and the cluster-lock gauges cluster_threshold / cluster_operators / cluster_validators, all set via a new init_startup_metrics(...).
  • Stamps the global cluster_* labels (cluster_hash, cluster_name, cluster_network, cluster_peer, charon_version, nickname) onto every series in the /metrics exposition via MonitoringState::with_labels, so the Charon dashboard's template variables resolve against Pluto's output. cluster_network falls back to "unknown" for unrecognised fork versions, matching Charon.

Custom testnet support (--testnet-*)

  • A fully-specified custom testnet is now threaded into AppConfig and registered (add_test_network) before the node resolves the cluster fork version, replacing the previous --testnet-* is not yet supported rejection.
  • Partially-specified testnet flags remain silently ignored (IsNonZero parity).

Peerinfo git-hash coercion

  • Adds git_commit_hash_short(), which coerces the build hash into Charon's ^[0-9a-f]{7}$ form. Charon drops a peer's entire peerinfo record when the git hash fails that regex, so git-less builds (e.g. Docker without .git) previously vanished from the cluster dashboard. Now they advertise a well-formed fallback hash and stay visible.

Testing

  • New unit tests: global-label stamping on the /metrics series, git-hash coercion/fallback, and --testnet-* acceptance/partial-ignore in build_app_config.

🤖 Generated with Claude Code

…pport

Expose the startup and cluster gauges Charon sets in initStartupMetrics
(app_version, app_peer_name, app_git_commit, app_start_time_secs,
cluster_threshold/operators/validators) and stamp the global cluster_*
labels (cluster_hash, cluster_name, cluster_network, cluster_peer,
charon_version, nickname) onto every series in the /metrics exposition so
the Charon dashboard template variables resolve.

Register a fully-specified custom testnet from --testnet-* before the node
resolves the cluster fork version, replacing the previous "unsupported"
rejection; partially-specified flags stay ignored (IsNonZero parity).

Coerce the build git hash into Charon's ^[0-9a-f]{7}$ peerinfo form so
git-less builds still advertise a well-formed hash and stay visible to
Charon peers instead of having their entire peerinfo record dropped.

@iamquang95 iamquang95 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

please merge the main

// are ignored (Charon parity, `IsNonZero`-gated). `Box::leak` promotes the
// runtime strings to `'static` as required by `Network`; the leak is
// bounded (one custom testnet per process) and matches `create cluster`.
let testnet = testnet

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This should be on main already

// version up in the supported-networks allowlist. Registration is
// idempotent (keyed on genesis fork version).
if let Some(testnet) = &config.testnet {
pluto_eth2util::network::add_test_network(testnet.clone())

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

this should be on main already

MONITORING_METRICS.peer_name[&peer_name.to_owned()].set(1);
MONITORING_METRICS.git_commit[&git_hash.to_owned()].set(1);
MONITORING_METRICS.start_time_secs.set(start_time_secs);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

missing cluster_network and app_feature_flags

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.

2 participants