Skip to content

Commit

Permalink
add metrics
Browse files Browse the repository at this point in the history
  • Loading branch information
marcindsobczak committed Oct 23, 2024
1 parent 5bddd2e commit 732155a
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,17 @@ 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);
}

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; }
}
}

0 comments on commit 732155a

Please sign in to comment.