mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-05-16 04:56:36 +00:00
eth/catalyst: fix getBlobsV3 partial/complete metrics (#34666)
In b2843a11d, metrics check len(res) == len(hashes) but res is
pre-allocated with make(), so length is always equal. Partial hit metric
never fires. Count non-nil elements instead.
---------
Co-authored-by: Bosul Mun <bsbs8645@snu.ac.kr>
This commit is contained in:
parent
d446676fc4
commit
ab28bda83e
1 changed files with 4 additions and 2 deletions
|
|
@ -646,6 +646,7 @@ func (api *ConsensusAPI) getBlobs(hashes []common.Hash, v2 bool) ([]*engine.Blob
|
||||||
return nil, engine.InvalidParams.With(err)
|
return nil, engine.InvalidParams.With(err)
|
||||||
}
|
}
|
||||||
// Validate the blobs from the pool and assemble the response
|
// Validate the blobs from the pool and assemble the response
|
||||||
|
filled := 0
|
||||||
res := make([]*engine.BlobAndProofV2, len(hashes))
|
res := make([]*engine.BlobAndProofV2, len(hashes))
|
||||||
for i := range blobs {
|
for i := range blobs {
|
||||||
// The blob has been evicted since the last AvailableBlobs call.
|
// The blob has been evicted since the last AvailableBlobs call.
|
||||||
|
|
@ -666,10 +667,11 @@ func (api *ConsensusAPI) getBlobs(hashes []common.Hash, v2 bool) ([]*engine.Blob
|
||||||
Blob: blobs[i][:],
|
Blob: blobs[i][:],
|
||||||
CellProofs: cellProofs,
|
CellProofs: cellProofs,
|
||||||
}
|
}
|
||||||
|
filled++
|
||||||
}
|
}
|
||||||
if len(res) == len(hashes) {
|
if filled == len(hashes) {
|
||||||
getBlobsRequestCompleteHit.Inc(1)
|
getBlobsRequestCompleteHit.Inc(1)
|
||||||
} else if len(res) > 0 {
|
} else if filled > 0 {
|
||||||
getBlobsRequestPartialHit.Inc(1)
|
getBlobsRequestPartialHit.Inc(1)
|
||||||
} else {
|
} else {
|
||||||
getBlobsRequestMiss.Inc(1)
|
getBlobsRequestMiss.Inc(1)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue