OffchainLabs / go-ethereum

GNU Lesser General Public License v3.0
52 stars 88 forks source link

fix pebble metrics registration [NIT-2468] #314

Closed magicxyyz closed 2 months ago

magicxyyz commented 2 months ago

Pebble gauge metrics are stuck when twice opening same database (same metrics namespace). That happens in openInitializeChainDb: https://github.com/OffchainLabs/nitro/blob/e6afd28add5c9ff8be5952e3fe546d70015841af/cmd/nitro/init.go#L175-L181

Gauge metrics are created with metrics.NewRegisteredGauge and it fails silently if metric name already exists. The Meter metrics work despite that metrics.NewRegisteredMeter is used, because it calls metrics.GetOrRegisterMeter internally.

This PR fixes the issue by using metrics.GetOrRegister* functions instead.

magicxyyz commented 2 months ago

just added a PR to upstream the fix: https://github.com/ethereum/go-ethereum/pull/29699