Skip to content
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 geth metrics package and delete local metrics #745

Open
wants to merge 24 commits into
base: master
Choose a base branch
from

Conversation

qdm12
Copy link
Collaborator

@qdm12 qdm12 commented Jan 13, 2025

ℹ️ 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:

Therefore:

  1. All files in metrics are deleted EXCEPT:
    • metrics/prometheus/prometheus.go + init block added to set the metrics enabled by default
    • metrics/prometheus/prometheus_test.go
    • metrics/prometheus/interfaces.go (new file added whilst refactoring)
    • go-ethereum's metrics.Enabled is set to true in initializeMetrics
  2. Refactoring and fixes were done in some intermediary step (in chore(metrics/prometheus): add files needed for coreth and subnet-evm libevm#103), so I decided to bring this over here so it doesn't get trashed. I can split it in another PR if you feel it's necessary.

How this was tested

CI passing

Need to be documented?

No

Need to update RELEASES.md?

Not really, since it should not change anything 🙏

@qdm12 qdm12 force-pushed the qdm12/libevm/metrics branch 3 times, most recently from f8dadc2 to dd1a167 Compare January 13, 2025 12:11
@qdm12 qdm12 force-pushed the qdm12/libevm/metrics branch 2 times, most recently from 2164d72 to caf4d61 Compare January 13, 2025 15:23
metrics/prometheus/prometheus.go Outdated Show resolved Hide resolved
metrics/prometheus/prometheus.go Outdated Show resolved Hide resolved
plugin/evm/vm.go Show resolved Hide resolved
plugin/evm/vm.go Show resolved Hide resolved
warp/handlers/signature_request_test.go Outdated Show resolved Hide resolved
metrics/prometheus/prometheus.go Outdated Show resolved Hide resolved
metrics/prometheus/prometheus_test.go Outdated Show resolved Hide resolved
@qdm12 qdm12 marked this pull request as ready for review January 13, 2025 16:25
@qdm12 qdm12 requested review from ceyonur, darioush and a team as code owners January 13, 2025 16:25
@qdm12 qdm12 force-pushed the qdm12/libevm/metrics branch 3 times, most recently from d7b1c12 to 3e3d44c Compare January 14, 2025 12:16
@darioush
Copy link
Collaborator

some review suggestions: #747

darioush
darioush previously approved these changes Jan 14, 2025
Copy link
Collaborator Author

@qdm12 qdm12 left a comment

Choose a reason for hiding this comment

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

Self review

plugin/evm/config/config.go Outdated Show resolved Hide resolved
metrics/prometheus/prometheus_test.go Outdated Show resolved Hide resolved
metrics/prometheus/prometheus.go Outdated Show resolved Hide resolved
metrics/prometheus/prometheus.go Show resolved Hide resolved
metrics/prometheus/prometheus.go Outdated Show resolved Hide resolved
metrics/prometheus/prometheus.go Show resolved Hide resolved
metrics/prometheus/prometheus.go Outdated Show resolved Hide resolved
metrics/prometheus/prometheus.go Outdated Show resolved Hide resolved
metrics/prometheus/prometheus_test.go Outdated Show resolved Hide resolved
plugin/evm/vm.go Outdated Show resolved Hide resolved
darioush
darioush previously approved these changes Jan 15, 2025
plugin/evm/vm_test.go Outdated Show resolved Hide resolved
scripts/geth-allowed-packages.txt Outdated Show resolved Hide resolved
@qdm12 qdm12 force-pushed the qdm12/libevm/metrics branch from 00f7ec7 to 97bdf9e Compare January 23, 2025 09:00
darioush
darioush previously approved these changes Jan 23, 2025
@darioush
Copy link
Collaborator

I think you may have to fix the regex on the linter.

@qdm12 qdm12 force-pushed the qdm12/libevm/metrics branch 3 times, most recently from 1354b31 to bbce8d0 Compare January 24, 2025 12:02
@qdm12 qdm12 force-pushed the qdm12/libevm/metrics branch from bbce8d0 to 5e17fb5 Compare January 24, 2025 21:04
@qdm12 qdm12 changed the title chore(metrics): use libevm metrics package and delete local metrics chore(metrics): use geth metrics package and delete local metrics Jan 27, 2025
@qdm12 qdm12 enabled auto-merge (squash) January 28, 2025 10:56
// If the [metrics.Enabled] is already true, nothing is done.
// Otherwise, it is set to true and is reverted to false when the test finishes.
func WithMetrics(t *testing.T) {
if metrics.Enabled {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Waiting to see if metrics were shown before on e2e tests or not. Ideally we want to keep the same behavior as before, even if we want to change it, it should be in another PR.

@qdm12 qdm12 disabled auto-merge January 28, 2025 12:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants