diff --git a/enforcer-parent/enforcer/src/main/java/org/wso2/choreo/connect/enforcer/analytics/ChoreoAnalyticsProvider.java b/enforcer-parent/enforcer/src/main/java/org/wso2/choreo/connect/enforcer/analytics/ChoreoAnalyticsProvider.java index b155e85dd4..521a2a9270 100644 --- a/enforcer-parent/enforcer/src/main/java/org/wso2/choreo/connect/enforcer/analytics/ChoreoAnalyticsProvider.java +++ b/enforcer-parent/enforcer/src/main/java/org/wso2/choreo/connect/enforcer/analytics/ChoreoAnalyticsProvider.java @@ -59,6 +59,11 @@ public EventCategory getEventCategory() { logEntry.getResponse().getResponseCodeDetails())) { logger.debug("Is success event"); return EventCategory.SUCCESS; + } else if (logEntry.getResponse() != null && AnalyticsConstants.WEBSOCKET_101_STATUS.equals( + String.valueOf(logEntry.getResponse().getResponseCode().getValue()))) { + // TODO: (thushani) Need to handle the websocket success event with ChoreoAnalyticsForWSProvider. + logger.debug("Is success websocket event"); + return EventCategory.SUCCESS; } else if (logEntry.getResponse() != null && logEntry.getResponse().getResponseCode() != null && logEntry.getResponse().getResponseCode().getValue() != 200 @@ -87,7 +92,10 @@ public boolean isAuthenticated() { @Override public FaultCategory getFaultType() { - if (isTargetFaultRequest()) { + if (AnalyticsConstants.UPSTREAM_OVERFLOW_RESPONSE_DETAIL. + equals(logEntry.getResponse().getResponseCodeDetails())) { + return FaultCategory.THROTTLED; + } else if (isTargetFaultRequest()) { return FaultCategory.TARGET_CONNECTIVITY; } else { return FaultCategory.OTHER; diff --git a/enforcer-parent/enforcer/src/main/java/org/wso2/choreo/connect/enforcer/constants/AnalyticsConstants.java b/enforcer-parent/enforcer/src/main/java/org/wso2/choreo/connect/enforcer/constants/AnalyticsConstants.java index e985a89c00..0306c216d2 100644 --- a/enforcer-parent/enforcer/src/main/java/org/wso2/choreo/connect/enforcer/constants/AnalyticsConstants.java +++ b/enforcer-parent/enforcer/src/main/java/org/wso2/choreo/connect/enforcer/constants/AnalyticsConstants.java @@ -29,6 +29,8 @@ public class AnalyticsConstants { public static final String EXT_AUTH_ERROR_RESPONSE_DETAIL = "ext_authz_error"; public static final String ROUTE_NOT_FOUND_RESPONSE_DETAIL = "route_not_found"; public static final String GATEWAY_LABEL = "ENVOY"; + public static final String WEBSOCKET_101_STATUS = "101"; + public static final String UPSTREAM_OVERFLOW_RESPONSE_DETAIL = "upstream_reset_before_response_started{overflow}"; public static final String TOKEN_ENDPOINT_PATH = "/testkey"; public static final String HEALTH_ENDPOINT_PATH = "/health";