Repository navigation
Conversation
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 59 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
gzliudan
requested review from
AnilChinchawale,
anunay-xin,
benjamin202410,
liam-lai and
wanwiset25
November 10, 2026 09:10
wanwiset25
approved these changes
Nov 12, 2026
gzliudan
force-pushed
the
port-handler-metrics
branch
2 times, most recently
from
November 12, 2026 12:03
a797879 to
f19ecd7
Compare
…#22581 Inbound eth packets had no serving-time signal, so there was no way to correlate slow message handling with the packet types that caused it. Port geth ethereum#22581 to record a microsecond histogram per protocol version and message code. The snap handler does not exist in this fork, and the histogram helper plus resetting sample were already ported, so only the metric name and the dispatcher instrumentation are needed. Ref: ethereum#22581
gzliudan
force-pushed
the
port-handler-metrics
branch
from
November 12, 2026 23:50
f19ecd7 to
f7cba8d
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Proposed changes
Port geth PR ethereum#22581: inbound eth packets had no serving-time signal, so slow handlers could not be correlated with the packet types that triggered them. This adds a microsecond histogram per protocol version and message code, aligned with current geth master (resetting sample,
Enabled()as a function).metrics.GetOrRegisterHistogramLazyandResettingSamplewere already ported here, and this fork has no snap protocol, so only the metric prefix and the eth dispatcher instrumentation are needed.Summary
p2p.HandleHistName = "p2p/handle"supplies the prefix.metrics.ResettingSample(metrics.NewExpDecaySample(1028, 0.015)), so rarely seen packets still refresh instead of pinning a stale histogram;GetOrRegisterHistogramLazyavoids constructing a sample on every request.metrics/histogram.goalready carries the lazy helper, so two files change.Ref: ethereum#22581
Evidence
git grep HandleHistName dev-upgradereturns nothing and nop2p/handle/*metric is registered.After: a temporary probe with metrics enabled and one inbound message at xdc/165 code
0xffreportshistogram "p2p/handle/eth/165/0xff" count=1 max=17us. The probe was removed after the run; the resetting sample resets on snapshot read, which the probe accounts for./tmp/verify-logs/port-handler-metrics-c54169f1fb-I3TWij.log):make all->make generate(No stale files detected.) ->make tidy(No untidy module files detected.) -> clean tree ->make lint(0 issues.) ->go vet ./...->make test, all pass atc54169f1fb.go test ./eth/protocols/eth/ ./p2p/ -count=1passes.Merge Danger
Door: two-way
Reverting the commit removes the histograms; there is no migration, state change or wire change to unwind.
Blast Radius: Network
Only inbound eth message handling is touched. With metrics disabled the added cost is one
metrics.Enabled()call per message; with metrics enabled each message registers or updates one histogram. No consensus, RPC or protocol-version behaviour changes.Types of changes
What types of changes does your code introduce to XDC network?
Put an
✅in the boxes that applyImpacted Components
Which parts of the codebase does this PR touch?
Put an
✅in the boxes that applyChecklist
Put an
✅in the boxes once you have confirmed below actions (or provide reasons on not doing so) thatUnchecked items: upstream ethereum#22581 ships no tests, and this port adds no test file. The existing
eth/protocols/ethsuite covers the metrics-disabled path, while the metrics-enabled path was verified with the temporary probe above. A private-network epoch run, mixed-version coexistence run and backwards-compatibility run do not apply because there is no consensus, state or wire change, and no documentation describes this metrics path.End-to-end test plan: start a node with
--metricsand a metrics sink, generate inbound eth traffic from a peer, and confirmp2p/handle/eth/<version>/<code>histograms appear with microsecond-scale latencies.