Skip to content

Commit

Permalink
Additional logging for ODD notifications (#38)
Browse files Browse the repository at this point in the history
  • Loading branch information
XDex committed Sep 7, 2023
1 parent 3056747 commit 550bd60
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -203,11 +204,16 @@ private void HandleDetails(

private void SendNotifications(TargetDeliveryRequest request, TargetDeliveryResponse targetResponse, List<Notification> 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> { telemetryEntry }) : null;
Expand Down
1 change: 1 addition & 0 deletions Source/Adobe.Target.Client/Service/TargetService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down

0 comments on commit 550bd60

Please sign in to comment.