From 389815ea25d0c60cc197888779766c18174826d4 Mon Sep 17 00:00:00 2001 From: rusirijayodaillesinghe Date: Mon, 9 Oct 2023 10:59:27 +0530 Subject: [PATCH] Fix userName missing issue that occurs when ELK based Analytics is configured for a Public API Fixes : https://github.com/wso2/api-manager/issues/2200 --- .../handlers/analytics/SynapseAnalyticsDataProvider.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/handlers/analytics/SynapseAnalyticsDataProvider.java b/components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/handlers/analytics/SynapseAnalyticsDataProvider.java index 822d681a0cc3..41dbae64eb99 100644 --- a/components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/handlers/analytics/SynapseAnalyticsDataProvider.java +++ b/components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/handlers/analytics/SynapseAnalyticsDataProvider.java @@ -311,6 +311,9 @@ public String getUserName() { if (messageContext.getPropertyKeySet().contains(APIMgtGatewayConstants.END_USER_NAME)) { return (String) messageContext.getProperty(APIMgtGatewayConstants.END_USER_NAME); } + if (messageContext.getPropertyKeySet().contains(APIMgtGatewayConstants.USER_ID)) { + return (String) messageContext.getProperty(APIMgtGatewayConstants.USER_ID); + } return null; }