Search in sources :

Example 1 with AsyncAnalyticsDataProvider

use of org.wso2.carbon.apimgt.gateway.handlers.streaming.AsyncAnalyticsDataProvider in project carbon-apimgt by wso2.

the class AnalyticsMetricsHandler method handleResponseOutFlow.

@Override
public boolean handleResponseOutFlow(MessageContext messageContext) {
    if (messageContext.getPropertyKeySet().contains(InboundWebsocketConstants.WEBSOCKET_SUBSCRIBER_PATH)) {
        return true;
    }
    AnalyticsDataProvider provider;
    Object skipPublishMetrics = messageContext.getProperty(Constants.SKIP_DEFAULT_METRICS_PUBLISHING);
    if (skipPublishMetrics != null && (Boolean) skipPublishMetrics) {
        provider = new AsyncAnalyticsDataProvider(messageContext);
    } else {
        provider = new SynapseAnalyticsDataProvider(messageContext);
    }
    GenericRequestDataCollector dataCollector = new GenericRequestDataCollector(provider);
    try {
        dataCollector.collectData();
    } catch (Exception e) {
        log.error("Error Occurred when collecting data", e);
    }
    return true;
}
Also used : GenericRequestDataCollector(org.wso2.carbon.apimgt.common.analytics.collectors.impl.GenericRequestDataCollector) AsyncAnalyticsDataProvider(org.wso2.carbon.apimgt.gateway.handlers.streaming.AsyncAnalyticsDataProvider) AnalyticsDataProvider(org.wso2.carbon.apimgt.common.analytics.collectors.AnalyticsDataProvider) AsyncAnalyticsDataProvider(org.wso2.carbon.apimgt.gateway.handlers.streaming.AsyncAnalyticsDataProvider) AnalyticsException(org.wso2.carbon.apimgt.common.analytics.exceptions.AnalyticsException)

Aggregations

AnalyticsDataProvider (org.wso2.carbon.apimgt.common.analytics.collectors.AnalyticsDataProvider)1 GenericRequestDataCollector (org.wso2.carbon.apimgt.common.analytics.collectors.impl.GenericRequestDataCollector)1 AnalyticsException (org.wso2.carbon.apimgt.common.analytics.exceptions.AnalyticsException)1 AsyncAnalyticsDataProvider (org.wso2.carbon.apimgt.gateway.handlers.streaming.AsyncAnalyticsDataProvider)1