-
Notifications
You must be signed in to change notification settings - Fork 843
fix: Always register Firewood metrics when enabled #4793
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR ensures Firewood metrics are always registered when Firewood is enabled, rather than conditionally based on the MetricsExpensiveEnabled flag. The initialization of metrics is moved to an init() function to avoid errors from multiple calls to ffi.StartMetrics() during testing.
Key changes:
- Moved
ffi.StartMetrics()call to aninit()function in a newmetrics.gofile - Removed the
MetricsExpensiveEnabledcondition from metric registration logic - Simplified error messages for metric registration failures
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| graft/evm/firewood/metrics.go | New file introducing init() function to start Firewood metrics once per process |
| graft/subnet-evm/plugin/evm/vm.go | Removed conditional check for expensive metrics and simplified registration logic |
| graft/coreth/plugin/evm/vm.go | Removed conditional check for expensive metrics and simplified registration logic |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Why this should be merged
Firewood metrics aren't particularly expensive, and there's a ticket to expose more expensive metrics within Firewood. It should always be registered.
How this works
ffi.StartMetricscan only be called once per process, otherwirse it returns an error. This is a problem for tests, so this is moved to an init function, guaranteeing it will only happen once.How this was tested
Locally, to ensure metrics are still scrapable.

Need to be documented in RELEASES.md?
No.