Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NPE in the AnalyticsMetricsHandler when invoking unavailable method #3377

Closed
Methma opened this issue Nov 22, 2024 · 0 comments · Fixed by wso2/carbon-apimgt#12723 or wso2/wso2-synapse#2259

Comments

@Methma
Copy link

Methma commented Nov 22, 2024

Description

The following NPE is thrown when invoke an unavailable resource when Analytics is enabled.

ERROR - AnalyticsMetricsHandler Error Occurred when collecting data
java.lang.NullPointerException: null
	at org.wso2.carbon.apimgt.gateway.handlers.analytics.SynapseAnalyticsDataProvider.getBackendLatency_aroundBody54(SynapseAnalyticsDataProvider.java:404) ~[org.wso2.carbon.apimgt.gateway_9.20.74.300.jar:?]
	at org.wso2.carbon.apimgt.gateway.handlers.analytics.SynapseAnalyticsDataProvider.getBackendLatency(SynapseAnalyticsDataProvider.java:399) ~[org.wso2.carbon.apimgt.gateway_9.20.74.300.jar:?]
	at org.wso2.carbon.apimgt.gateway.handlers.analytics.SynapseAnalyticsDataProvider.getLatencies_aroundBody18(SynapseAnalyticsDataProvider.java:217) ~[org.wso2.carbon.apimgt.gateway_9.20.74.300.jar:?]
	at org.wso2.carbon.apimgt.gateway.handlers.analytics.SynapseAnalyticsDataProvider.getLatencies(SynapseAnalyticsDataProvider.java:215) ~[org.wso2.carbon.apimgt.gateway_9.20.74.300.jar:?]
	at org.wso2.carbon.apimgt.common.analytics.collectors.impl.SuccessRequestDataCollector.collectData(SuccessRequestDataCollector.java:71) ~[org.wso2.carbon.apimgt.common.analytics_9.20.74.289.jar:?]
	at org.wso2.carbon.apimgt.common.analytics.collectors.impl.GenericRequestDataCollector.collectData(GenericRequestDataCollector.java:46) ~[org.wso2.carbon.apimgt.common.analytics_9.20.74.289.jar:?]
	at org.wso2.carbon.apimgt.gateway.handlers.analytics.AnalyticsMetricsHandler.handleResponseOutFlow_aroundBody8(AnalyticsMetricsHandler.java:95) ~[org.wso2.carbon.apimgt.gateway_9.20.74.300.jar:?]
	at org.wso2.carbon.apimgt.gateway.handlers.analytics.AnalyticsMetricsHandler.handleResponseOutFlow(AnalyticsMetricsHandler.java:81) ~[org.wso2.carbon.apimgt.gateway_9.20.74.300.jar:?]
	at org.apache.synapse.core.axis2.Axis2Sender.sendBack(Axis2Sender.java:188) ~[synapse-core_2.1.7.wso2v271_66.jar:2.1.7-wso2v271.66] 

To reproduce,

  1. Enable Analytics
[apim.analytics]
enable = true
type = "elk"
  1. Create an API having few methods
  2. Invoke an unavailable method

Thanks
Methma

Steps to Reproduce

Invoke an resource having mediations after enabling analytics.

Affected Component

APIM

Version

4.1.0

Environment Details (with versions)

No response

Relevant Log Output

No response

Related Issues

No response

Suggested Labels

No response

@Methma Methma changed the title NPE error in the AnalyticsMetricsHandler when invoking unavailable method NPE in the AnalyticsMetricsHandler when invoking unavailable method Nov 22, 2024
@dakshina99 dakshina99 self-assigned this Dec 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment