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

Add metrics for engine_getBlobsV1 #7646

Merged
merged 3 commits into from
Oct 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
14 changes: 11 additions & 3 deletions src/Nethermind/Nethermind.Merge.Plugin/Handlers/GetBlobsHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,19 @@ public Task<ResultWrapper<GetBlobsV1Result>> HandleAsync(byte[][] request)

private IEnumerable<BlobAndProofV1?> GetBlobsAndProofs(byte[][] request)
{
Metrics.NumberOfRequestedBlobs += request.Length;

foreach (byte[] requestedBlobVersionedHash in request)
{
yield return txPool.TryGetBlobAndProof(requestedBlobVersionedHash, out byte[]? blob, out byte[]? proof)
? new BlobAndProofV1(blob, proof)
: null;
if (txPool.TryGetBlobAndProof(requestedBlobVersionedHash, out byte[]? blob, out byte[]? proof))
{
Metrics.NumberOfSentBlobs++;
yield return new BlobAndProofV1(blob, proof);
}
else
{
yield return null;
}
}
}
}
8 changes: 8 additions & 0 deletions src/Nethermind/Nethermind.Merge.Plugin/Metrics.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,13 @@ public static class Metrics
[GaugeMetric]
[Description("Number of Transactions included in the Last GetPayload Request")]
public static int NumberOfTransactionsInGetPayload { get; set; }

[GaugeMetric]
[Description("Number of Blobs requested by engine_getBlobsV1")]
public static int NumberOfRequestedBlobs { get; set; }

[GaugeMetric]
[Description("Number of Blobs sent by engine_getBlobsV1")]
public static int NumberOfSentBlobs { get; set; }
}
}