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);
}
Aggregations