op-supernode: multiplex metrics by chain_id label and serve at a single endpoint#18750
Merged
op-supernode: multiplex metrics by chain_id label and serve at a single endpoint#18750
Conversation
geoknee
commented
Jan 12, 2026
Change NewMetrics to accept prometheus.Labels and, when provided, wrap the registry with those labels. Update the factory.With signature to accept a prometheus.Registerer. Plumb the new NewMetrics signature through call sites, add VIRTUAL_NODE_CHAIN_ID_LABEL in op-supernode and pass the chain ID label for virtual node metrics
Add op-supernode/supernode/metrics with a Metrics type and StartServer helper. Replace per-chain metrics router/service with a single metrics server managed by Supernode. Remove setMetricsHandler from ChainContainer and update tests. Add initMetricsServer to handle metrics startup and shutdown, and minor TODO comment in op-node initialization.
This reverts commit 0f23b94.
Rename setMetricsHandler to addMetricsHandler and adjust its signature to accept only an http.Handler. Update NewChainContainer and call sites accordingly. MetricsRouter now keeps a slice of handlers and invokes each for metrics requests, removing per-chain path normalization.
MetricsRouter now accepts prometheus.Gatherer instances and builds a single promhttp.Handler that aggregates all registered gatherers. ChainContainer and supernode updated to pass registries (AddRegistry) instead of per-chain HTTP handlers.
Expand comment to explain that MetricsRouter serves multiple Prometheus Gatherers from a single HTTP server and warn that Gatherers must not collide (e.g. use unique names or a distinct global label)
Rename AddRegistry to AddMetricsRegistry and make it accept a chain key so metrics registries are stored in a map and then aggregated into a Gatherers slice. Update chain container and supernode to pass chainID.String() when registering per-chain metrics.
5929f0d to
04c40c1
Compare
Update metrics fan-in comment to mention the /metrics path. Add a unit test to verify multiple registries are merged and served. Update supernode to call the new method name.
jelias2
approved these changes
Jan 14, 2026
axelKingsley
approved these changes
Jan 15, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #18746
Tested manually, using op-supernode wired to op-sync-tester itself talking to opm / unichain RPCs.
Snapshot of raw prometheus output:
which I also piped to
promtool check metrics, which found only some preexisting issues with op_node metrics.