Search in sources :

Example 16 with AnalyticsException

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

the class SuccessRequestDataCollector method collectData.

public void collectData() throws AnalyticsException {
    log.debug("Handling success analytics types");
    long requestInTime = provider.getRequestTime();
    String offsetDateTime = getTimeInISO(requestInTime);
    Event event = new Event();
    API api = provider.getApi();
    Operation operation = provider.getOperation();
    Target target = provider.getTarget();
    Application application;
    if (provider.isAnonymous()) {
        application = getAnonymousApp();
    } else {
        application = provider.getApplication();
    }
    Latencies latencies = provider.getLatencies();
    MetaInfo metaInfo = provider.getMetaInfo();
    String userAgent = provider.getUserAgentHeader();
    String userIp = provider.getEndUserIP();
    if (userIp == null) {
        userIp = Constants.UNKNOWN_VALUE;
    }
    event.setApi(api);
    event.setOperation(operation);
    event.setTarget(target);
    event.setApplication(application);
    event.setLatencies(latencies);
    event.setProxyResponseCode(provider.getProxyResponseCode());
    event.setRequestTimestamp(offsetDateTime);
    event.setMetaInfo(metaInfo);
    event.setUserAgentHeader(userAgent);
    event.setUserIp(userIp);
    this.processor.publish(event);
}
Also used : Target(org.wso2.carbon.apimgt.common.analytics.publishers.dto.Target) Latencies(org.wso2.carbon.apimgt.common.analytics.publishers.dto.Latencies) MetaInfo(org.wso2.carbon.apimgt.common.analytics.publishers.dto.MetaInfo) Event(org.wso2.carbon.apimgt.common.analytics.publishers.dto.Event) API(org.wso2.carbon.apimgt.common.analytics.publishers.dto.API) Operation(org.wso2.carbon.apimgt.common.analytics.publishers.dto.Operation) 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