Skip to content

Commit

Permalink
Handling null for tenant domain
Browse files Browse the repository at this point in the history
  • Loading branch information
piyumaldk committed Aug 16, 2023
1 parent c7be424 commit e2bdff3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ public class APIMgtGatewayConstants {
public static final String CUSTOM_ANALYTICS_RESPONSE_PROPERTIES = "apim.analytics.response.properties";
public static final String CUSTOM_ANALYTICS_PROPERTY_SEPARATOR = ",";
public static final String API_UUID_PROPERTY = "API_UUID";
public static final String TENANT_DOMAIN = "tenant.info.domain";

/**
* Constants for swagger schema validator
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,10 +139,11 @@ public boolean handleResponseOutFlow(MessageContext messageContext) {
if (responseLatencySpan != null) {
GatewayUtils.setAPIRelatedTags(responseLatencySpan, messageContext);
API api = GatewayUtils.getAPI(messageContext);
String tenantDomain = (String) messageContext.getProperty(APIMgtGatewayConstants.TENANT_DOMAIN);

Check warning on line 142 in components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/handlers/common/APIMgtLatencySynapseHandler.java

View check run for this annotation

Codecov / codecov/patch

components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/handlers/common/APIMgtLatencySynapseHandler.java#L142

Added line #L142 was not covered by tests
if (api != null) {
TelemetryUtil.updateOperation(responseLatencySpan,
api.getApiName().concat("--").concat(api.getApiVersion()).concat("--")
.concat(GatewayUtils.getTenantDomain()));
.concat(tenantDomain));

Check warning on line 146 in components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/handlers/common/APIMgtLatencySynapseHandler.java

View check run for this annotation

Codecov / codecov/patch

components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/handlers/common/APIMgtLatencySynapseHandler.java#L146

Added line #L146 was not covered by tests
}
TelemetryUtil.finishSpan(responseLatencySpan);
}
Expand All @@ -157,10 +158,11 @@ public boolean handleResponseOutFlow(MessageContext messageContext) {
if (responseLatencySpan != null) {
GatewayUtils.setAPIRelatedTags(responseLatencySpan, messageContext);
API api = GatewayUtils.getAPI(messageContext);
String tenantDomain = (String) messageContext.getProperty(APIMgtGatewayConstants.TENANT_DOMAIN);

Check warning on line 161 in components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/handlers/common/APIMgtLatencySynapseHandler.java

View check run for this annotation

Codecov / codecov/patch

components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/handlers/common/APIMgtLatencySynapseHandler.java#L161

Added line #L161 was not covered by tests
if (api != null) {
Util.updateOperation(responseLatencySpan,
api.getApiName().concat("--").concat(api.getApiVersion()).concat("--")
.concat(GatewayUtils.getTenantDomain()));
.concat(tenantDomain));

Check warning on line 165 in components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/handlers/common/APIMgtLatencySynapseHandler.java

View check run for this annotation

Codecov / codecov/patch

components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/handlers/common/APIMgtLatencySynapseHandler.java#L165

Added line #L165 was not covered by tests
}
if (responseLatencySpan != null) {
Util.finishSpan(responseLatencySpan);
Expand Down

0 comments on commit e2bdff3

Please sign in to comment.