Skip to content

Commit

Permalink
metrics
Browse files Browse the repository at this point in the history
  • Loading branch information
dceleda committed May 2, 2022
1 parent 70df58b commit 09b080c
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 9 deletions.
11 changes: 7 additions & 4 deletions src/Nethermind/Nethermind.Synchronization/Metrics.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,14 @@ public static class Metrics
[Description("Synced bytecodes")]
public static long SyncedCodes;

[Description("Synced accounts via SNAP SYNC")]
public static long SyncedAccounts;
[Description("Synced accounts via SNAP Sync")]
public static long SnapSyncedAccounts;

[Description("Synced storage slots via SNAP SYNC")]
public static long SyncedStorageSlots;
[Description("Synced storage slots via SNAP Sync")]
public static long SnapSyncedStorageSlots;

[Description("Synced bytecodes via SNAP Sync")]
public static long SnapSyncedCodes;

[Description("Number of sync peers.")]
public static long SyncPeers;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -301,11 +301,11 @@ private void LogRequest(string reqType)

if (reqType != "NO REQUEST" || _testReqCount % 1000 == 0)
{
if (_testReqCount % 10 == 0)
if (_testReqCount % 100 == 0)
{
var progress = 100 * NextAccountPath.Bytes[0] / (double)256;

_logger.Warn($"SNAP - progres of State Ranges (Phase 1): {progress}% [{new string('*', (int)progress / 10)}{new string(' ', 10 - (int)progress / 10)}]");
_logger.Info($"SNAP - progres of State Ranges (Phase 1): {progress}% [{new string('*', (int)progress / 10)}{new string(' ', 10 - (int)progress / 10)}]");
}

if (_testReqCount % 1 == 0)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public AddRangeResult AddAccountRange(AccountRange request, AccountsAndProofs re

if (result == AddRangeResult.OK)
{
Interlocked.Add(ref Metrics.SyncedAccounts, response.PathAndAccounts.Length);
Interlocked.Add(ref Metrics.SnapSyncedAccounts, response.PathAndAccounts.Length);
}
}

Expand Down Expand Up @@ -168,9 +168,9 @@ public AddRangeResult AddStorageRange(StorageRange request, SlotsAndProofs respo
_progressTracker.ReportFullStorageRequestFinished();
}

if (slotCount > 0)
if (result == AddRangeResult.OK && slotCount > 0)
{
Interlocked.Add(ref Metrics.SyncedStorageSlots, slotCount);
Interlocked.Add(ref Metrics.SnapSyncedStorageSlots, slotCount);
}
}

Expand Down Expand Up @@ -308,6 +308,8 @@ public void AddCodes(Keccak[] requestedHashes, byte[][] codes)
}
}

Interlocked.Add(ref Metrics.SnapSyncedCodes, codes.Length);

_progressTracker.ReportCodeRequestFinished(set);
}

Expand Down

0 comments on commit 09b080c

Please sign in to comment.