-
Notifications
You must be signed in to change notification settings - Fork 142
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
chore(metrics): use libevm metrics package and delete local metrics #745
base: master
Are you sure you want to change the base?
Conversation
f8dadc2
to
dd1a167
Compare
e6c2e5b
to
2164d72
Compare
- Enable metrics for specific tests
- Bring over refactoring and fixes done in ava-labs/libevm#103 - Bring over test refactoring done in ava-labs/libevm#103
2164d72
to
caf4d61
Compare
@@ -34,8 +34,7 @@ import ( | |||
"github.com/ava-labs/coreth/core/types" | |||
"github.com/ava-labs/coreth/eth" | |||
"github.com/ava-labs/coreth/eth/ethconfig" | |||
"github.com/ava-labs/coreth/metrics" | |||
corethPrometheus "github.com/ava-labs/coreth/metrics/prometheus" | |||
corethprometheus "github.com/ava-labs/coreth/metrics/prometheus" |
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.
nit I took the liberty to have this all lowercase, I believe this is Go convention for package name aliases (correct me if I'm wrong!)
@@ -636,7 +636,7 @@ func (vm *VM) initializeMetrics() error { | |||
return nil | |||
} | |||
|
|||
gatherer := corethPrometheus.Gatherer(metrics.DefaultRegistry) | |||
gatherer := corethprometheus.NewGatherer(metrics.DefaultRegistry) |
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.
nit I took the liberty (again) to rename Gatherer
to NewGatherer
in order to export gatherer
as Gatherer
and return a *Gatherer
from NewGatherer
to satisfy the "return concrete types" concept
metrics/prometheus/prometheus.go
Outdated
default: | ||
return nil, fmt.Errorf("metric type is not supported: %T", metric) |
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.
I took the liberty to change this to return an error (instead of silently ignoring it) on an unsupported type to prevent in the future to define new types and forget to add the implementation in the switch here.
Signed-off-by: Quentin McGaw <[email protected]>
Signed-off-by: Quentin McGaw <[email protected]>
2d6a89e
to
624eafc
Compare
624eafc
to
d7b1c12
Compare
d7b1c12
to
3e3d44c
Compare
some review suggestions: #747 |
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.
Self review
ℹ️ pretty much copy pasta of ava-labs/subnet-evm#1422
Why this should be merged
Contribution to the libevm effort.
Note there are the same changes for both coreth and subnet-evm, but they should not be part of libevm since these are extra features specific to subnet-evm/coreth, even if they're the same for both.
How this works
Comparing the following:
master
vs corethmaster
: subnet-evm is missing the extra file https://github.com/ava-labs/coreth/blob/b6b4dfbc4bfc7f17e4cfe5f3c0fb44944176c884/metrics/init_test.go (which is present in geth as well)master
vs gethv1.13.14
: subnet-evm has many deletions, very few minor unneeded changes and the new non-conflicting filemetrics/prometheus/prometheus.go
Therefore:
metrics
are deleted EXCEPT:metrics/prometheus/prometheus.go
+init
block added to set the metrics enabled by defaultmetrics/prometheus/prometheus_test.go
metrics/prometheus/interfaces.go
(new file added whilst refactoring)metrics.Enabled
is set to true ininitializeMetrics
How this was tested
CI passing
Need to be documented?
No
Need to update RELEASES.md?
Not really, since it should not change anything 🙏