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

Merged
merged 26 commits into from
Feb 10, 2025
Merged
Changes from 1 commit
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
2df7e5f
chore(metrics): use libevm metrics package and delete local metrics
qdm12 Jan 13, 2025
88ed1d4
Migrate subnet-evm specific files back to metrics/prometheus
qdm12 Jan 13, 2025
6eb0653
tests: only enable metrics and revert to disable if already disabled
qdm12 Jan 13, 2025
905aaa9
Enable metrics by default with init block
qdm12 Jan 13, 2025
e9201f5
Use latest tagged libevm release
qdm12 Jan 13, 2025
58241f7
Change copyright notice from 2025 to 2021-2025
qdm12 Jan 13, 2025
d8d0f84
Change copyright notice from 2025 to 2021-2025
qdm12 Jan 13, 2025
26c2664
Use go-ethereum instead of libevm
qdm12 Jan 13, 2025
c471a70
Only set `metrics.Enabled` in `VM.Initalize`
qdm12 Jan 13, 2025
5c9fac8
Better handling for metrics re-registration (#747)
darioush Jan 14, 2025
c3a3706
Remove now unneeded option metrics-enabled
qdm12 Jan 14, 2025
be0acbd
Add comments for exported members
qdm12 Jan 15, 2025
635783d
Revert unneeded change for sdkMetrics interface
qdm12 Jan 15, 2025
c131269
Add metric name to error wrapping
qdm12 Jan 15, 2025
7f47d8c
Very minor changes in metrics/prometheus
qdm12 Jan 15, 2025
fcf78fa
Add metrics/prometheus test cases for full test coverage
qdm12 Jan 15, 2025
cd91e1a
Removed TODO since geth doesn't set any sum
qdm12 Jan 15, 2025
70e37df
Forgotten comment revert
qdm12 Jan 15, 2025
b2d334a
plugin/evm/testutils `WithMetrics`
qdm12 Jan 15, 2025
491f5ff
`resetMetrics` helper test function
qdm12 Jan 23, 2025
97bdf9e
Remove strange line from geth-allowed-packages.txt
qdm12 Jan 23, 2025
5e17fb5
Exclude core/main_test.go from lint_allowed_geth_imports.sh
qdm12 Jan 24, 2025
addccf9
Merge branch 'master' into qdm12/libevm/metrics
qdm12 Jan 28, 2025
82af695
Merge branch 'master' into qdm12/libevm/metrics
qdm12 Jan 31, 2025
2fa1b87
Merge branch 'master' into qdm12/libevm/metrics
qdm12 Feb 7, 2025
64f5eae
Merge branch 'master' into qdm12/libevm/metrics
qdm12 Feb 10, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
resetMetrics helper test function
qdm12 committed Jan 23, 2025
commit 491f5ff8c27f56e5740d9d99524c096877257bcb
12 changes: 8 additions & 4 deletions plugin/evm/vm_test.go
Original file line number Diff line number Diff line change
@@ -375,6 +375,12 @@ func GenesisVMWithUTXOs(t *testing.T, finishBootstrapping bool, genesisJSON stri
return issuer, vm, db, sharedMemory, sender
}

// resetMetrics resets the vm avalanchego metrics, and allows
// for the VM to be re-initialized in tests.
func resetMetrics(vm *VM) {
vm.ctx.Metrics = metrics.NewPrefixGatherer()
}

func TestVMConfig(t *testing.T) {
txFeeCap := float64(11)
enabledEthAPIs := []string{"debug"}
@@ -3798,15 +3804,13 @@ func TestSkipChainConfigCheckCompatible(t *testing.T) {
genesisWithUpgradeBytes, err := json.Marshal(genesisWithUpgrade)
require.NoError(t, err)

// Reset metrics to allow re-initialization
vm.ctx.Metrics = metrics.NewPrefixGatherer()
resetMetrics(vm)

// this will not be allowed
err = reinitVM.Initialize(context.Background(), vm.ctx, dbManager, genesisWithUpgradeBytes, []byte{}, []byte{}, issuer, []*commonEng.Fx{}, appSender)
require.ErrorContains(t, err, "mismatching ApricotPhase2 fork block timestamp in database")

// Reset metrics to allow re-initialization
vm.ctx.Metrics = metrics.NewPrefixGatherer()
resetMetrics(vm)

// try again with skip-upgrade-check
config := []byte(`{"skip-upgrade-check": true}`)