From f605002d94ae5a6059628b0200c8c25862444b7a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20B=C3=BCrgi?= Date: Mon, 2 Sep 2024 15:21:03 +0200 Subject: [PATCH 1/2] When not being to find a gateway, changed error to warning as this situation could occur when the client starts faster than the server --- src/Orleans.Core/Messaging/GatewayManager.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/Orleans.Core/Messaging/GatewayManager.cs b/src/Orleans.Core/Messaging/GatewayManager.cs index 1dff2b106b..bf4b768c4d 100644 --- a/src/Orleans.Core/Messaging/GatewayManager.cs +++ b/src/Orleans.Core/Messaging/GatewayManager.cs @@ -66,9 +66,10 @@ public async Task StartAsync(CancellationToken cancellationToken) var knownGateways = await this.gatewayListProvider.GetGateways(); if (knownGateways.Count == 0) { - var err = $"Could not find any gateway in {this.gatewayListProvider.GetType().FullName}. Orleans client cannot initialize."; - this.logger.LogError((int)ErrorCode.GatewayManager_NoGateways, err); - throw new SiloUnavailableException(err); + // this situation can occur if the client starts faster than the silos. + var warning = $"Could not find any gateway in {this.gatewayListProvider.GetType().FullName}. Orleans client cannot initialize until at least one gateway becomes available."; + this.logger.LogWarning((int)ErrorCode.GatewayManager_NoGateways, warning); + throw new SiloUnavailableException(warning); } this.logger.LogInformation( From 5db8eeb837876113141f8765488a759b38389418 Mon Sep 17 00:00:00 2001 From: Reuben Bond <203839+ReubenBond@users.noreply.github.com> Date: Mon, 30 Sep 2024 11:03:30 -0700 Subject: [PATCH 2/2] Use structured logging --- src/Orleans.Core/Messaging/GatewayManager.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/Orleans.Core/Messaging/GatewayManager.cs b/src/Orleans.Core/Messaging/GatewayManager.cs index bf4b768c4d..0e7b433839 100644 --- a/src/Orleans.Core/Messaging/GatewayManager.cs +++ b/src/Orleans.Core/Messaging/GatewayManager.cs @@ -67,9 +67,10 @@ public async Task StartAsync(CancellationToken cancellationToken) if (knownGateways.Count == 0) { // this situation can occur if the client starts faster than the silos. - var warning = $"Could not find any gateway in {this.gatewayListProvider.GetType().FullName}. Orleans client cannot initialize until at least one gateway becomes available."; - this.logger.LogWarning((int)ErrorCode.GatewayManager_NoGateways, warning); - throw new SiloUnavailableException(warning); + var providerName = this.gatewayListProvider.GetType().FullName; + this.logger.LogWarning((int)ErrorCode.GatewayManager_NoGateways, "Could not find any gateway in '{GatewayListProviderName}'. Orleans client cannot initialize until at least one gateway becomes available.", providerName); + var message = $"Could not find any gateway in '{providerName}'. Orleans client cannot initialize until at least one gateway becomes available."; + throw new SiloUnavailableException(message); } this.logger.LogInformation(