Skip to content

Conversation

@qdm12
Copy link
Contributor

@qdm12 qdm12 commented Feb 28, 2025

Why this should be merged

Direct or indirect imports of libevm packages could execute first (depending on compilation/import oder) and register metrics "in libevm", and the coreth defined global metrics would fail silently at registering.

How this works

Use ava-labs/libevm#159 which:

  • has all metrics.New* constructors using their corresponding metrics.GetOrRegister* function. That way the metrics, whether registered first in coreth or in libevm, are shared between the two, and we don't missing metric changes from the one of the two sides.
  • Use the new metrics.GetOrRegisterOrOverrideCounter function for metrics defined as counters in coreth but defined as another type (timer) in libevm, such that it unregisters the libevm metric and replaces it with the coreth metric of another type. Note we could, if we want, replace it with just OverrideCounter where it would not even attempt to get the already registered metric and check its type, let me know.

The side effect is that some tests in warp/ had to be changed a tiny bit to clear metrics, since these are now shared between subtest even after calling a metrics.New* constructor.

How this was tested

CI passing

Need to be documented?

No

Need to update RELEASES.md?

No

@qdm12 qdm12 force-pushed the qdm12/libevm/metrics-reg branch from 13501af to bb89ae2 Compare March 5, 2025 15:21
@qdm12 qdm12 changed the title fix(plugin/evm): gatherer uses its own registry fix(metrics): coreth uses its own registry Mar 5, 2025
@qdm12 qdm12 force-pushed the qdm12/libevm/metrics-reg branch from bb89ae2 to 328f2e6 Compare March 5, 2025 16:26
@qdm12 qdm12 changed the title fix(metrics): coreth uses its own registry fix(metrics): coreth metrics do not conflict with libevm metrics Mar 6, 2025
qdm12 added a commit to ava-labs/libevm that referenced this pull request Mar 6, 2025
- Avoid conflicts for metrics used both in consumers and in libevm
- See ava-labs/coreth#848
qdm12 added 2 commits March 6, 2025 09:33
- Define global `Registry` in metrics/
- All metrics in coreth uses this registry to avoid potential conflicts
- plugin/evm initializeMetrics uses this registry
@qdm12 qdm12 force-pushed the qdm12/libevm/metrics-reg branch 2 times, most recently from b190459 to ce3dfaf Compare March 6, 2025 11:36
@qdm12 qdm12 force-pushed the qdm12/libevm/metrics-reg branch from ce3dfaf to fdc7354 Compare March 6, 2025 12:07
@qdm12
Copy link
Contributor Author

qdm12 commented Mar 6, 2025

Closed in favor of #860

@qdm12 qdm12 closed this Mar 6, 2025
@qdm12 qdm12 deleted the qdm12/libevm/metrics-reg branch March 6, 2025 17:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant