From 550bd60641ea011e9b41b10380ee1b657b38b21c Mon Sep 17 00:00:00 2001 From: Andrei Anischevici Date: Thu, 7 Sep 2023 19:49:42 +0300 Subject: [PATCH] Additional logging for ODD notifications (#38) --- .../Service/OnDeviceDecisioningService.cs | 6 ++++++ Source/Adobe.Target.Client/Service/TargetService.cs | 1 + 2 files changed, 7 insertions(+) diff --git a/Source/Adobe.Target.Client/Service/OnDeviceDecisioningService.cs b/Source/Adobe.Target.Client/Service/OnDeviceDecisioningService.cs index 86125e7..fe91243 100644 --- a/Source/Adobe.Target.Client/Service/OnDeviceDecisioningService.cs +++ b/Source/Adobe.Target.Client/Service/OnDeviceDecisioningService.cs @@ -87,6 +87,7 @@ public TargetDeliveryResponse ExecuteRequest(TargetDeliveryRequest deliveryReque var ruleSet = this.ruleLoader.GetLatestRules(); if (ruleSet == null) { + TargetClient.Logger?.LogWarning("Decisioning rules not loaded, returning empty response"); var deliveryResponse = new DeliveryResponse( (int)HttpStatusCode.ServiceUnavailable, deliveryRequest.DeliveryRequest.RequestId, @@ -203,11 +204,16 @@ private void HandleDetails( private void SendNotifications(TargetDeliveryRequest request, TargetDeliveryResponse targetResponse, List notifications, TelemetryEntry telemetryEntry) { + TargetClient.Logger?.LogDebug("Sending notifications for requestId: {requestId} sessionId: {sessionId}", request.DeliveryRequest.RequestId, request.SessionId); + if (notifications.Count == 0 && telemetryEntry == null) { + TargetClient.Logger?.LogDebug("No notifications to send"); return; } + TargetClient.Logger?.LogDebug("Notifications: {notifications}", string.Join(", ", notifications)); + var deliveryRequest = request.DeliveryRequest; var locationHint = request.LocationHint ?? this.clusterLocator.GetLocationHint(); var telemetry = telemetryEntry != null ? new Telemetry(new List { telemetryEntry }) : null; diff --git a/Source/Adobe.Target.Client/Service/TargetService.cs b/Source/Adobe.Target.Client/Service/TargetService.cs index bf95cb0..fbc578c 100644 --- a/Source/Adobe.Target.Client/Service/TargetService.cs +++ b/Source/Adobe.Target.Client/Service/TargetService.cs @@ -112,6 +112,7 @@ private TargetDeliveryResponse GetTargetDeliveryResponse(TargetDeliveryRequest r { if (response == null) { + this.logger?.LogWarning("Null response for requestId: {requestId}, sessionId: {sessionId}", request.DeliveryRequest.RequestId, request.SessionId); return new TargetDeliveryResponse(request, null, HttpStatusCode.ServiceUnavailable); }