Search in sources :

Example 6 with AnalyticsException

use of org.wso2.carbon.apimgt.common.analytics.exceptions.AnalyticsException in project carbon-apimgt by wso2.

the class SseResponseStreamInterceptor method publishAnalyticsData.

private void publishAnalyticsData(int eventCount, MessageContext axi2Ctx) throws AnalyticsException {
    Object responseEventProvider = axi2Ctx.getProperty(SSE_ANALYTICS_INFO);
    if (responseEventProvider == null) {
        log.error("SSE Analytics event provider is null.");
        return;
    }
    SseResponseEventDataProvider provider = (SseResponseEventDataProvider) responseEventProvider;
    provider.setResponseCode((int) axi2Ctx.getProperty(SynapseConstants.HTTP_SC));
    GenericRequestDataCollector dataCollector = new GenericRequestDataCollector(provider);
    for (int count = 0; count < eventCount; count++) {
        dataCollector.collectData();
    }
}
Also used : SseResponseEventDataProvider(org.wso2.carbon.apimgt.gateway.handlers.streaming.sse.analytics.SseResponseEventDataProvider) GenericRequestDataCollector(org.wso2.carbon.apimgt.common.analytics.collectors.impl.GenericRequestDataCollector) JSONObject(org.json.JSONObject)

Example 7 with AnalyticsException

use of org.wso2.carbon.apimgt.common.analytics.exceptions.AnalyticsException in project carbon-apimgt by wso2.

the class WebSocketAnalyticsMetricsHandler method collectData.

private void collectData(ChannelHandlerContext ctx) {
    AnalyticsDataProvider provider = new WebSocketAnalyticsDataProvider(ctx);
    GenericRequestDataCollector collector = new GenericRequestDataCollector(provider);
    try {
        collector.collectData();
    } catch (AnalyticsException e) {
        log.error("Error Occurred when collecting analytics data", e);
    }
}
Also used : GenericRequestDataCollector(org.wso2.carbon.apimgt.common.analytics.collectors.impl.GenericRequestDataCollector) AnalyticsException(org.wso2.carbon.apimgt.common.analytics.exceptions.AnalyticsException) AnalyticsDataProvider(org.wso2.carbon.apimgt.common.analytics.collectors.AnalyticsDataProvider)

Example 8 with AnalyticsException

use of org.wso2.carbon.apimgt.common.analytics.exceptions.AnalyticsException in project carbon-apimgt by wso2.

the class AuthFaultDataCollector method collectFaultData.

@Override
public void collectFaultData(Event faultyEvent) throws AnalyticsException {
    log.debug("handling auth failure analytics events");
    Application application = getUnknownApp();
    faultyEvent.setApplication(application);
    this.processRequest(faultyEvent);
}
Also used : Application(org.wso2.carbon.apimgt.common.analytics.publishers.dto.Application)

Example 9 with AnalyticsException

use of org.wso2.carbon.apimgt.common.analytics.exceptions.AnalyticsException in project carbon-apimgt by wso2.

the class ResourceNotFoundFaultDataCollector method collectFaultData.

@Override
public void collectFaultData(Event faultyEvent) throws AnalyticsException {
    log.debug("handling method not allowed failure analytics events");
    Application application = getUnknownApp();
    faultyEvent.setApplication(application);
    this.processRequest(faultyEvent);
}
Also used : Application(org.wso2.carbon.apimgt.common.analytics.publishers.dto.Application)

Example 10 with AnalyticsException

use of org.wso2.carbon.apimgt.common.analytics.exceptions.AnalyticsException in project carbon-apimgt by wso2.

the class ThrottledFaultDataCollector method collectFaultData.

@Override
public void collectFaultData(Event faultyEvent) throws AnalyticsException {
    log.debug("handling throttled failure analytics events");
    Application application;
    if (provider.isAuthenticated() && provider.isAnonymous()) {
        application = getAnonymousApp();
    } else {
        application = provider.getApplication();
    }
    faultyEvent.setApplication(application);
    this.processRequest(faultyEvent);
}
Also used : Application(org.wso2.carbon.apimgt.common.analytics.publishers.dto.Application)

Aggregations

Application (org.wso2.carbon.apimgt.common.analytics.publishers.dto.Application)7 GenericRequestDataCollector (org.wso2.carbon.apimgt.common.analytics.collectors.impl.GenericRequestDataCollector)3 AnalyticsException (org.wso2.carbon.apimgt.common.analytics.exceptions.AnalyticsException)3 ArrayList (java.util.ArrayList)2 Consumes (javax.ws.rs.Consumes)2 GET (javax.ws.rs.GET)2 Path (javax.ws.rs.Path)2 Produces (javax.ws.rs.Produces)2 JSONObject (org.json.JSONObject)2 AnalyticsDataAPI (org.wso2.carbon.analytics.api.AnalyticsDataAPI)2 AnalyticsDataResponse (org.wso2.carbon.analytics.dataservice.commons.AnalyticsDataResponse)2 SearchResultEntry (org.wso2.carbon.analytics.dataservice.commons.SearchResultEntry)2 SortByField (org.wso2.carbon.analytics.dataservice.commons.SortByField)2 AnalyticsException (org.wso2.carbon.analytics.datasource.commons.exception.AnalyticsException)2 Event (org.wso2.carbon.apimgt.common.analytics.publishers.dto.Event)2 DeviceIdentifier (org.wso2.carbon.device.mgt.common.DeviceIdentifier)2 DeviceAccessAuthorizationException (org.wso2.carbon.device.mgt.common.authorization.DeviceAccessAuthorizationException)2 SensorRecord (org.wso2.iot.sampledevice.api.dto.SensorRecord)2 Axis2MessageContext (org.apache.synapse.core.axis2.Axis2MessageContext)1 SensorRecord (org.coffeeking.api.util.SensorRecord)1