Skip to content

Commit

Permalink
Improved logging
Browse files Browse the repository at this point in the history
  • Loading branch information
sakno committed May 2, 2024
1 parent 55b3879 commit 3fc2809
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ internal ValueTask<Result<bool>> ReplicateAsync(IAuditTrail<IRaftLogEntry> audit
var startIndex = replicationIndex + 1L;
Debug.Assert(startIndex == Member.State.NextIndex);

logger.ReplicationStarted(Member.EndPoint, startIndex);
logger.ReplicationStarted(Member.EndPoint, startIndex, currentIndex);
return auditTrail.ReadAsync(this, startIndex, currentIndex, token);
}

Expand Down Expand Up @@ -168,7 +168,7 @@ private ConfiguredTaskAwaitable<Result<HeartbeatResult>>.ConfiguredTaskAwaiter R
{
Debug.Assert(snapshot.IsSnapshot);

logger.InstallingSnapshot(replicationIndex = snapshotIndex);
logger.InstallingSnapshot(Member.EndPoint, replicationIndex = snapshotIndex);
var result = Member.InstallSnapshotAsync(term, snapshot, snapshotIndex, token).ConfigureAwait(false).GetAwaiter();
fingerprint = Member.State.ConfigurationFingerprint; // keep local version unchanged
return result;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,10 @@ internal static partial class LogMessages
[LoggerMessage(
EventIdOffset + 12,
LogLevel.Debug,
"Replication of member {Member} started at log index {EntryIndex}",
"Replication of member {Member} started from {StartIndex} log index to {EndIndex}",
EventName = $"{EventIdPrefix}.{nameof(ReplicationStarted)}"
)]
public static partial void ReplicationStarted(this ILogger logger, EndPoint member, long entryIndex);
public static partial void ReplicationStarted(this ILogger logger, EndPoint member, long startIndex, long endIndex);

[LoggerMessage(
EventIdOffset + 13,
Expand Down Expand Up @@ -158,10 +158,10 @@ internal static partial class LogMessages
[LoggerMessage(
EventIdOffset + 18,
LogLevel.Information,
"Installing snapshot at index {EntryIndex}",
"Installing snapshot at index {EntryIndex} for member {Member}",
EventName = $"{EventIdPrefix}.{nameof(InstallingSnapshot)}"
)]
public static partial void InstallingSnapshot(this ILogger logger, long entryIndex);
public static partial void InstallingSnapshot(this ILogger logger, EndPoint member, long entryIndex);

public const string SnapshotInstallationFailed = "Critical error detected while installing snapshot of audit trail";

Expand Down

0 comments on commit 3fc2809

Please sign in to comment.