use of org.wso2.carbon.apimgt.common.analytics.exceptions.AnalyticsException in project carbon-apimgt by wso2.
the class MethodNotAllowedFaultDataCollector 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);
}
use of org.wso2.carbon.apimgt.common.analytics.exceptions.AnalyticsException in project carbon-apimgt by wso2.
the class TargetFaultDataCollector method collectFaultData.
@Override
public void collectFaultData(Event faultyEvent) throws AnalyticsException {
log.debug("handling target failure analytics events");
Application application;
if (provider.isAuthenticated() && provider.isAnonymous()) {
application = getAnonymousApp();
} else {
application = provider.getApplication();
}
faultyEvent.setApplication(application);
this.processRequest(faultyEvent);
}
use of org.wso2.carbon.apimgt.common.analytics.exceptions.AnalyticsException in project carbon-apimgt by wso2.
the class UnclassifiedFaultDataCollector method collectFaultData.
@Override
public void collectFaultData(Event faultyEvent) throws AnalyticsException {
log.debug("handling unclassified failure analytics events");
Application application;
if (provider.isAuthenticated()) {
if (provider.isAnonymous()) {
application = getAnonymousApp();
} else {
application = provider.getApplication();
}
} else {
application = getUnknownApp();
}
faultyEvent.setApplication(application);
this.processRequest(faultyEvent);
}
use of org.wso2.carbon.apimgt.common.analytics.exceptions.AnalyticsException in project carbon-apimgt by wso2.
the class SseResponseStreamInterceptor method handleThrottlingAndAnalytics.
private boolean handleThrottlingAndAnalytics(int eventCount, MessageContext axi2Ctx) {
Object throttleObject = axi2Ctx.getProperty(SSE_THROTTLE_DTO);
if (throttleObject != null) {
String messageId = UIDGenerator.generateURNString();
ThrottleInfo throttleInfo = (ThrottleInfo) throttleObject;
String remoteIP = throttleInfo.getRemoteIp();
JSONObject propertiesMap = new JSONObject();
Utils.setRemoteIp(propertiesMap, remoteIP);
boolean isThrottled = isThrottled(throttleInfo.getSubscriberTenantDomain(), throttleInfo.getResourceLevelThrottleKey(), throttleInfo.getSubscriptionLevelThrottleKey(), throttleInfo.getApplicationLevelThrottleKey());
if (isThrottled) {
log.warn("Request is throttled out");
return false;
}
throttlePublisherService.execute(() -> SseUtils.publishNonThrottledEvent(eventCount, messageId, throttleInfo, propertiesMap));
if (APIUtil.isAnalyticsEnabled()) {
try {
publishAnalyticsData(eventCount, axi2Ctx);
} catch (AnalyticsException e) {
log.error("Error while publishing analytics data", e);
}
}
return true;
} else {
log.error("Throttle object cannot be null.");
}
return true;
}
use of org.wso2.carbon.apimgt.common.analytics.exceptions.AnalyticsException in project carbon-apimgt by wso2.
the class FaultyRequestDataCollector method collectData.
public void collectData() throws AnalyticsException {
log.debug("Handling faulty analytics types");
Event faultyEvent = getFaultyEvent();
switch(provider.getFaultType()) {
case AUTH:
authDataCollector.collectFaultData(faultyEvent);
break;
case THROTTLED:
throttledDataCollector.collectFaultData(faultyEvent);
break;
case TARGET_CONNECTIVITY:
targetDataCollector.collectFaultData(faultyEvent);
break;
case OTHER:
unclassifiedFaultDataCollector.collectFaultData(faultyEvent);
break;
}
}
Aggregations