From 16e4cf748425fd4b4e2c0a1dd560bc8871464d73 Mon Sep 17 00:00:00 2001 From: Katherine Chen Date: Wed, 16 Jul 2025 13:38:34 +1000 Subject: [PATCH 1/4] Log participant in GenericFailureHandler --- .../operator/vertx/GenericFailureHandler.java | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/uid2/operator/vertx/GenericFailureHandler.java b/src/main/java/com/uid2/operator/vertx/GenericFailureHandler.java index 855ea1187..51d30af8a 100644 --- a/src/main/java/com/uid2/operator/vertx/GenericFailureHandler.java +++ b/src/main/java/com/uid2/operator/vertx/GenericFailureHandler.java @@ -1,5 +1,8 @@ package com.uid2.operator.vertx; +import com.uid2.shared.auth.IAuthorizable; +import com.uid2.shared.auth.OperatorKey; +import com.uid2.shared.middleware.AuthMiddleware; import io.vertx.core.Handler; import io.vertx.core.http.HttpClosedException; import io.vertx.core.http.HttpServerResponse; @@ -19,16 +22,23 @@ public void handle(RoutingContext ctx) { String url = ctx.normalizedPath(); Throwable t = ctx.failure(); + final IAuthorizable profile = AuthMiddleware.getAuthClient(ctx); + final OperatorKey operatorKey = profile instanceof OperatorKey ? (OperatorKey) profile : null; + String participant = "unknown"; + if (operatorKey != null) { + participant = operatorKey.getName(); + } + if (t != null) { // Because Vert.x swallows stack traces so cannot log stack trace // And we want to ignore HttpClosedException errors as it is (usually) caused by users and no impact if (t instanceof HttpClosedException) { - LOGGER.warn("Ignoring exception - URL: [{}] - Error:", url, t); + LOGGER.warn("Ignoring exception - URL: [{}], Participant: [{}] - Error:", url, participant, t); response.end(); } else if (statusCode >= 500 && statusCode < 600) { // 5xx is server error, so error - LOGGER.error("URL: [{}] - Error response code: [{}] - Error:", url, statusCode, t); + LOGGER.error("URL: [{}], Participant: [{}] - Error response code: [{}] - Error:", url, participant, statusCode, t); } else if (statusCode >= 400 && statusCode < 500) { // 4xx is user error, so just warn - LOGGER.warn("URL: [{}] - Error response code: [{}] - Error:", url, statusCode, t); + LOGGER.warn("URL: [{}], Participant: [{}] - Error response code: [{}] - Error:", url, participant, statusCode, t); } } From e96a35fe480b4a189b1ab4d4be6b0686fdd7da60 Mon Sep 17 00:00:00 2001 From: Katherine Chen Date: Wed, 16 Jul 2025 14:17:54 +1000 Subject: [PATCH 2/4] Use contact to get participant name --- .../uid2/operator/vertx/GenericFailureHandler.java | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/src/main/java/com/uid2/operator/vertx/GenericFailureHandler.java b/src/main/java/com/uid2/operator/vertx/GenericFailureHandler.java index 51d30af8a..9e680064c 100644 --- a/src/main/java/com/uid2/operator/vertx/GenericFailureHandler.java +++ b/src/main/java/com/uid2/operator/vertx/GenericFailureHandler.java @@ -22,23 +22,18 @@ public void handle(RoutingContext ctx) { String url = ctx.normalizedPath(); Throwable t = ctx.failure(); - final IAuthorizable profile = AuthMiddleware.getAuthClient(ctx); - final OperatorKey operatorKey = profile instanceof OperatorKey ? (OperatorKey) profile : null; - String participant = "unknown"; - if (operatorKey != null) { - participant = operatorKey.getName(); - } + final String contact = AuthMiddleware.getAuthClient(ctx).getContact(); if (t != null) { // Because Vert.x swallows stack traces so cannot log stack trace // And we want to ignore HttpClosedException errors as it is (usually) caused by users and no impact if (t instanceof HttpClosedException) { - LOGGER.warn("Ignoring exception - URL: [{}], Participant: [{}] - Error:", url, participant, t); + LOGGER.warn("Ignoring exception - URL: [{}], Participant: [{}] - Error:", url, contact, t); response.end(); } else if (statusCode >= 500 && statusCode < 600) { // 5xx is server error, so error - LOGGER.error("URL: [{}], Participant: [{}] - Error response code: [{}] - Error:", url, participant, statusCode, t); + LOGGER.error("URL: [{}], Participant: [{}] - Error response code: [{}] - Error:", url, contact, statusCode, t); } else if (statusCode >= 400 && statusCode < 500) { // 4xx is user error, so just warn - LOGGER.warn("URL: [{}], Participant: [{}] - Error response code: [{}] - Error:", url, participant, statusCode, t); + LOGGER.warn("URL: [{}], Participant: [{}] - Error response code: [{}] - Error:", url, contact, statusCode, t); } } From d9af915298b850d17f5094495df2b8161c0893b1 Mon Sep 17 00:00:00 2001 From: Katherine Chen Date: Wed, 16 Jul 2025 15:39:59 +1000 Subject: [PATCH 3/4] Handle cases where the client key is unknown --- .../com/uid2/operator/vertx/GenericFailureHandler.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/uid2/operator/vertx/GenericFailureHandler.java b/src/main/java/com/uid2/operator/vertx/GenericFailureHandler.java index 9e680064c..caa1b886e 100644 --- a/src/main/java/com/uid2/operator/vertx/GenericFailureHandler.java +++ b/src/main/java/com/uid2/operator/vertx/GenericFailureHandler.java @@ -3,6 +3,7 @@ import com.uid2.shared.auth.IAuthorizable; import com.uid2.shared.auth.OperatorKey; import com.uid2.shared.middleware.AuthMiddleware; +import com.uid2.shared.auth.ClientKey; import io.vertx.core.Handler; import io.vertx.core.http.HttpClosedException; import io.vertx.core.http.HttpServerResponse; @@ -22,7 +23,11 @@ public void handle(RoutingContext ctx) { String url = ctx.normalizedPath(); Throwable t = ctx.failure(); - final String contact = AuthMiddleware.getAuthClient(ctx).getContact(); + String contact = "unknown"; + final ClientKey clientKey = (ClientKey) AuthMiddleware.getAuthClient(ctx); + if (clientKey != null) { + contact = clientKey.getContact(); + } if (t != null) { // Because Vert.x swallows stack traces so cannot log stack trace From eafaec3c86c2322a379defdeb03973d4c42cf7c1 Mon Sep 17 00:00:00 2001 From: Release Workflow Date: Wed, 16 Jul 2025 05:42:15 +0000 Subject: [PATCH 4/4] [CI Pipeline] Released Snapshot version: 5.56.42-alpha-200-SNAPSHOT --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index b754792d9..4bf985226 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ com.uid2 uid2-operator - 5.56.58 + 5.56.42-alpha-200-SNAPSHOT UTF-8