diff --git a/enforcer-parent/enforcer/src/main/java/org/wso2/choreo/connect/enforcer/analytics/ChoreoFaultAnalyticsProvider.java b/enforcer-parent/enforcer/src/main/java/org/wso2/choreo/connect/enforcer/analytics/ChoreoFaultAnalyticsProvider.java index 3d995bd645..89661f77d0 100644 --- a/enforcer-parent/enforcer/src/main/java/org/wso2/choreo/connect/enforcer/analytics/ChoreoFaultAnalyticsProvider.java +++ b/enforcer-parent/enforcer/src/main/java/org/wso2/choreo/connect/enforcer/analytics/ChoreoFaultAnalyticsProvider.java @@ -112,6 +112,7 @@ public API getApi() { tenantDomain == null ? APIConstants.SUPER_TENANT_DOMAIN_NAME : tenantDomain); api.setOrganizationId(requestContext.getMatchedAPI().getOrganizationId()); api.setEnvironmentId(requestContext.getMatchedAPI().getEnvironmentId()); + api.setApiContext(requestContext.getRequestPath()); return api; } @@ -204,9 +205,7 @@ public String getUserName() { @Override public String getUserAgentHeader() { - // User agent is not required for fault scenario - logger.error("Internal Error: User agent header is not required for fault events"); - return null; + return requestContext.getHeaders().get("user-agent"); } @Override @@ -223,6 +222,7 @@ public Map getProperties() { String deploymentType = requestContext.getMatchedAPI().getDeploymentType(); map.put(AnalyticsConstants.GATEWAY_URL, gwURL); map.put(AnalyticsConstants.DEPLOYMENT_TYPE, deploymentType); + map.put(AnalyticsConstants.API_METHOD, requestContext.getRequestMethod()); return map; } } 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 80ca31d1e7..e985a89c00 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 @@ -39,6 +39,7 @@ public class AnalyticsConstants { public static final String GATEWAY_URL = "x-original-gw-url"; public static final String DEPLOYMENT_TYPE = "deployment-type"; + public static final String API_METHOD = "apiMethod"; public static final int API_THROTTLE_OUT_ERROR_CODE = 900800; public static final int HARD_LIMIT_EXCEEDED_ERROR_CODE = 900801;