From 50dcf7087e42b06c361723ec053a6b1a9c0c573f Mon Sep 17 00:00:00 2001 From: Gavin Bunney Date: Tue, 7 Nov 2023 11:56:45 -0800 Subject: [PATCH 1/3] Add StatusCategory reason --- .../zuul/stats/status/StatusCategory.java | 2 + .../zuul/stats/status/ZuulStatusCategory.java | 53 ++++++++++++------- 2 files changed, 35 insertions(+), 20 deletions(-) diff --git a/zuul-core/src/main/java/com/netflix/zuul/stats/status/StatusCategory.java b/zuul-core/src/main/java/com/netflix/zuul/stats/status/StatusCategory.java index 260da94fcb..570e5fbe17 100644 --- a/zuul-core/src/main/java/com/netflix/zuul/stats/status/StatusCategory.java +++ b/zuul-core/src/main/java/com/netflix/zuul/stats/status/StatusCategory.java @@ -27,5 +27,7 @@ public interface StatusCategory { StatusCategoryGroup getGroup(); + String getReason(); + String name(); } diff --git a/zuul-core/src/main/java/com/netflix/zuul/stats/status/ZuulStatusCategory.java b/zuul-core/src/main/java/com/netflix/zuul/stats/status/ZuulStatusCategory.java index 911b09e437..97ce44103e 100644 --- a/zuul-core/src/main/java/com/netflix/zuul/stats/status/ZuulStatusCategory.java +++ b/zuul-core/src/main/java/com/netflix/zuul/stats/status/ZuulStatusCategory.java @@ -39,38 +39,46 @@ * LOCAL */ public enum ZuulStatusCategory implements StatusCategory { - SUCCESS(ZuulStatusCategoryGroup.SUCCESS, 1), - SUCCESS_NOT_FOUND(ZuulStatusCategoryGroup.SUCCESS, 3), // This is set on for all 404 responses + SUCCESS(ZuulStatusCategoryGroup.SUCCESS, 1, "Successfully proxied"), + SUCCESS_NOT_FOUND( + ZuulStatusCategoryGroup.SUCCESS, + 3, + "Successful with no resource found"), // This is set on for all 404 responses - SUCCESS_LOCAL_NOTSET(ZuulStatusCategoryGroup.SUCCESS, 4), // This is set on the SessionContext as the default value. - SUCCESS_LOCAL_NO_ROUTE(ZuulStatusCategoryGroup.SUCCESS, 5), + SUCCESS_LOCAL_NOTSET( + ZuulStatusCategoryGroup.SUCCESS, + 4, + "Default status"), // This is set on the SessionContext as the default value. + SUCCESS_LOCAL_NO_ROUTE(ZuulStatusCategoryGroup.SUCCESS, 5, "Successful with no origin determined"), - FAILURE_LOCAL(ZuulStatusCategoryGroup.FAILURE, 1), + FAILURE_LOCAL(ZuulStatusCategoryGroup.FAILURE, 1, "Failed internally"), FAILURE_LOCAL_THROTTLED_ORIGIN_SERVER_MAXCONN( - ZuulStatusCategoryGroup.FAILURE, 7), // NIWS client throttling based on max connections per origin server. + ZuulStatusCategoryGroup.FAILURE, 7, "Throttled due to reaching max number of connections to origin"), FAILURE_LOCAL_THROTTLED_ORIGIN_CONCURRENCY( - ZuulStatusCategoryGroup.FAILURE, 8), // when zuul throttles for a vip because concurrency is too high. - FAILURE_LOCAL_IDLE_TIMEOUT(ZuulStatusCategoryGroup.FAILURE, 9), + ZuulStatusCategoryGroup.FAILURE, 8, "Throttled due to reaching concurrency limit to origin"), + FAILURE_LOCAL_IDLE_TIMEOUT(ZuulStatusCategoryGroup.FAILURE, 9, "Idle timeout due to channel inactivity"), - FAILURE_CLIENT_BAD_REQUEST(ZuulStatusCategoryGroup.FAILURE, 12), - FAILURE_CLIENT_CANCELLED( - ZuulStatusCategoryGroup.FAILURE, 13), // client abandoned/closed the connection before origin responded. - FAILURE_CLIENT_PIPELINE_REJECT(ZuulStatusCategoryGroup.FAILURE, 17), - FAILURE_CLIENT_TIMEOUT(ZuulStatusCategoryGroup.FAILURE, 18), + FAILURE_CLIENT_BAD_REQUEST(ZuulStatusCategoryGroup.FAILURE, 12, "Invalid request provided"), + FAILURE_CLIENT_CANCELLED(ZuulStatusCategoryGroup.FAILURE, 13, "Client abandoned/closed the connection"), + FAILURE_CLIENT_PIPELINE_REJECT(ZuulStatusCategoryGroup.FAILURE, 17, "Client rejected due to HTTP Pipelining"), + FAILURE_CLIENT_TIMEOUT(ZuulStatusCategoryGroup.FAILURE, 18, "Timeout reading the client request"), - FAILURE_ORIGIN(ZuulStatusCategoryGroup.FAILURE, 2), - FAILURE_ORIGIN_READ_TIMEOUT(ZuulStatusCategoryGroup.FAILURE, 3), - FAILURE_ORIGIN_CONNECTIVITY(ZuulStatusCategoryGroup.FAILURE, 4), - FAILURE_ORIGIN_THROTTLED(ZuulStatusCategoryGroup.FAILURE, 6), // Throttled by origin by returning 503 - FAILURE_ORIGIN_NO_SERVERS(ZuulStatusCategoryGroup.FAILURE, 14), // No UP origin servers available in Discovery. - FAILURE_ORIGIN_RESET_CONNECTION(ZuulStatusCategoryGroup.FAILURE, 15); + FAILURE_ORIGIN(ZuulStatusCategoryGroup.FAILURE, 2, "Origin returned an error status"), + FAILURE_ORIGIN_READ_TIMEOUT(ZuulStatusCategoryGroup.FAILURE, 3, "Timeout reading the response from origin"), + FAILURE_ORIGIN_CONNECTIVITY(ZuulStatusCategoryGroup.FAILURE, 4, "Connection to origin failed"), + FAILURE_ORIGIN_THROTTLED(ZuulStatusCategoryGroup.FAILURE, 6, "Throttled by origin returning 503 status"), + FAILURE_ORIGIN_NO_SERVERS(ZuulStatusCategoryGroup.FAILURE, 14, "No UP origin servers available in Discovery"), + FAILURE_ORIGIN_RESET_CONNECTION( + ZuulStatusCategoryGroup.FAILURE, 15, "Connection reset on an established origin connection"); private final StatusCategoryGroup group; private final String id; + private final String reason; - ZuulStatusCategory(StatusCategoryGroup group, int index) { + ZuulStatusCategory(StatusCategoryGroup group, int index, String reason) { this.group = group; this.id = (group.getId() + "_" + index).intern(); + this.reason = reason; } @Override @@ -82,4 +90,9 @@ public String getId() { public StatusCategoryGroup getGroup() { return group; } + + @Override + public String getReason() { + return reason; + } } From b542bb94d09f5bc4a5938d6394e9269a51334774 Mon Sep 17 00:00:00 2001 From: Gavin Bunney Date: Tue, 7 Nov 2023 15:31:06 -0800 Subject: [PATCH 2/3] Tweak `SUCCESS_LOCAL_NO_ROUTE` --- .../java/com/netflix/zuul/stats/status/ZuulStatusCategory.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zuul-core/src/main/java/com/netflix/zuul/stats/status/ZuulStatusCategory.java b/zuul-core/src/main/java/com/netflix/zuul/stats/status/ZuulStatusCategory.java index 97ce44103e..631363cbc7 100644 --- a/zuul-core/src/main/java/com/netflix/zuul/stats/status/ZuulStatusCategory.java +++ b/zuul-core/src/main/java/com/netflix/zuul/stats/status/ZuulStatusCategory.java @@ -49,7 +49,7 @@ public enum ZuulStatusCategory implements StatusCategory { ZuulStatusCategoryGroup.SUCCESS, 4, "Default status"), // This is set on the SessionContext as the default value. - SUCCESS_LOCAL_NO_ROUTE(ZuulStatusCategoryGroup.SUCCESS, 5, "Successful with no origin determined"), + SUCCESS_LOCAL_NO_ROUTE(ZuulStatusCategoryGroup.SUCCESS, 5, "Unable to determine an origin to handle request"), FAILURE_LOCAL(ZuulStatusCategoryGroup.FAILURE, 1, "Failed internally"), FAILURE_LOCAL_THROTTLED_ORIGIN_SERVER_MAXCONN( From dbc7f369287424165803d47d46334e57cbbac545 Mon Sep 17 00:00:00 2001 From: Gavin Bunney Date: Tue, 7 Nov 2023 15:51:35 -0800 Subject: [PATCH 3/3] Tweak `SUCCESS_NOT_FOUND` --- .../java/com/netflix/zuul/stats/status/ZuulStatusCategory.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zuul-core/src/main/java/com/netflix/zuul/stats/status/ZuulStatusCategory.java b/zuul-core/src/main/java/com/netflix/zuul/stats/status/ZuulStatusCategory.java index 631363cbc7..48f1864fd0 100644 --- a/zuul-core/src/main/java/com/netflix/zuul/stats/status/ZuulStatusCategory.java +++ b/zuul-core/src/main/java/com/netflix/zuul/stats/status/ZuulStatusCategory.java @@ -43,7 +43,7 @@ public enum ZuulStatusCategory implements StatusCategory { SUCCESS_NOT_FOUND( ZuulStatusCategoryGroup.SUCCESS, 3, - "Successful with no resource found"), // This is set on for all 404 responses + "Successfully proxied, origin responded with no resource found"), // This is set on for all 404 responses SUCCESS_LOCAL_NOTSET( ZuulStatusCategoryGroup.SUCCESS,