Skip to content

Commit 8cb9100

Browse files
Fix publishing 101 success requests
1 parent c95a8a7 commit 8cb9100

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

enforcer-parent/enforcer/src/main/java/org/wso2/choreo/connect/enforcer/analytics/ChoreoAnalyticsProvider.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,11 @@ public EventCategory getEventCategory() {
5959
logEntry.getResponse().getResponseCodeDetails())) {
6060
logger.debug("Is success event");
6161
return EventCategory.SUCCESS;
62+
} else if (logEntry.getResponse() != null && AnalyticsConstants.WEBSOCKET_101_STATUS.equals(
63+
String.valueOf(logEntry.getResponse().getResponseCode().getValue()))) {
64+
// TODO: (thushani) Need to handle the websocket success event with ChoreoAnalyticsForWSProvider.
65+
logger.debug("Is success websocket event");
66+
return EventCategory.SUCCESS;
6267
} else if (logEntry.getResponse() != null
6368
&& logEntry.getResponse().getResponseCode() != null
6469
&& logEntry.getResponse().getResponseCode().getValue() != 200
@@ -87,7 +92,10 @@ public boolean isAuthenticated() {
8792

8893
@Override
8994
public FaultCategory getFaultType() {
90-
if (isTargetFaultRequest()) {
95+
if (AnalyticsConstants.UPSTREAM_OVERFLOW_RESPONSE_DETAIL.
96+
equals(logEntry.getResponse().getResponseCodeDetails())) {
97+
return FaultCategory.THROTTLED;
98+
} else if (isTargetFaultRequest()) {
9199
return FaultCategory.TARGET_CONNECTIVITY;
92100
} else {
93101
return FaultCategory.OTHER;

enforcer-parent/enforcer/src/main/java/org/wso2/choreo/connect/enforcer/constants/AnalyticsConstants.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ public class AnalyticsConstants {
2929
public static final String EXT_AUTH_ERROR_RESPONSE_DETAIL = "ext_authz_error";
3030
public static final String ROUTE_NOT_FOUND_RESPONSE_DETAIL = "route_not_found";
3131
public static final String GATEWAY_LABEL = "ENVOY";
32+
public static final String WEBSOCKET_101_STATUS = "101";
33+
public static final String UPSTREAM_OVERFLOW_RESPONSE_DETAIL = "upstream_reset_before_response_started{overflow}";
3234

3335
public static final String TOKEN_ENDPOINT_PATH = "/testkey";
3436
public static final String HEALTH_ENDPOINT_PATH = "/health";

0 commit comments

Comments
 (0)