From a4e40917c01f1355e58033a6cbfc9e58766dc6c0 Mon Sep 17 00:00:00 2001 From: Roger Johansson Date: Wed, 24 Jan 2024 10:55:01 +0100 Subject: [PATCH] gossip logging --- src/Proto.Cluster/ClusterConfig.cs | 6 ++++++ src/Proto.Cluster/Gossip/GossipActor.cs | 5 +++++ 2 files changed, 11 insertions(+) diff --git a/src/Proto.Cluster/ClusterConfig.cs b/src/Proto.Cluster/ClusterConfig.cs index 68f233f600..b194daf8e2 100644 --- a/src/Proto.Cluster/ClusterConfig.cs +++ b/src/Proto.Cluster/ClusterConfig.cs @@ -328,6 +328,12 @@ public ClusterConfig WithClusterContextProducer(Func p /// public ClusterConfig WithGossipRequestTimeout(TimeSpan timeout) => this with { GossipRequestTimeout = timeout }; + /// + /// Enables debug logging for the gossip protocol. + /// + /// + /// + public ClusterConfig WithGossipDebugLogging(bool enabled = true) => this with { GossipDebugLogging = enabled }; /// /// TTL for remote PID cache. Default is 15min. Set to to disable. /// diff --git a/src/Proto.Cluster/Gossip/GossipActor.cs b/src/Proto.Cluster/Gossip/GossipActor.cs index 0d17a29896..1514e4f414 100644 --- a/src/Proto.Cluster/Gossip/GossipActor.cs +++ b/src/Proto.Cluster/Gossip/GossipActor.cs @@ -134,6 +134,11 @@ private Task OnGossipRequest(IContext context, GossipRequest gossipRequest) ReceiveState(context, gossipRequest.State); + + if (context.Cluster().Config.GossipDebugLogging) + { + Logger.LogInformation("Responding to GossipRequest {Request} to {MemberId}", gossipRequest, gossipRequest.MemberId); + } context.Respond(new GossipResponse());