use of org.wso2.carbon.apimgt.common.analytics.publishers.dto.MetaInfo in project carbon-apimgt by wso2.
the class FaultyRequestDataCollector method getFaultyEvent.
private Event getFaultyEvent() throws DataNotFoundException {
long requestInTime = provider.getRequestTime();
String offsetDateTime = getTimeInISO(requestInTime);
Event event = new Event();
API api = provider.getApi();
Target target = new Target();
target.setTargetResponseCode(Constants.UNKNOWN_INT_VALUE);
MetaInfo metaInfo = provider.getMetaInfo();
event.setApi(api);
event.setTarget(target);
event.setProxyResponseCode(provider.getProxyResponseCode());
event.setRequestTimestamp(offsetDateTime);
event.setMetaInfo(metaInfo);
return event;
}
use of org.wso2.carbon.apimgt.common.analytics.publishers.dto.MetaInfo in project carbon-apimgt by wso2.
the class SynapseAnalyticsDataProvider method getMetaInfo.
@Override
public MetaInfo getMetaInfo() {
MetaInfo metaInfo = new MetaInfo();
Object correlationId = ((Axis2MessageContext) messageContext).getAxis2MessageContext().getProperty(CorrelationConstants.CORRELATION_ID);
if (correlationId instanceof String) {
metaInfo.setCorrelationId((String) correlationId);
}
metaInfo.setGatewayType(APIMgtGatewayConstants.GATEWAY_TYPE);
Map<String, String> configMap = ServiceReferenceHolder.getInstance().getApiManagerConfigurationService().getAPIAnalyticsConfiguration().getReporterProperties();
String region;
if (System.getProperties().containsKey(Constants.REGION_ID_PROP)) {
region = System.getProperty(Constants.REGION_ID_PROP);
} else if (configMap != null && configMap.containsKey(Constants.REGION_ID_PROP)) {
region = configMap.get(Constants.REGION_ID_PROP);
} else {
region = Constants.DEFAULT_REGION_ID;
}
metaInfo.setRegionId(region);
return metaInfo;
}
use of org.wso2.carbon.apimgt.common.analytics.publishers.dto.MetaInfo 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);
}
use of org.wso2.carbon.apimgt.common.analytics.publishers.dto.MetaInfo in project carbon-apimgt by wso2.
the class WebSocketAnalyticsDataProvider method getMetaInfo.
@Override
public MetaInfo getMetaInfo() {
MetaInfo metaInfo = new MetaInfo();
metaInfo.setCorrelationId(UUID.randomUUID().toString());
metaInfo.setGatewayType(APIMgtGatewayConstants.GATEWAY_TYPE);
Map<String, String> configMap = ServiceReferenceHolder.getInstance().getApiManagerConfigurationService().getAPIAnalyticsConfiguration().getReporterProperties();
String region;
if (System.getProperties().containsKey(Constants.REGION_ID_PROP)) {
region = System.getProperty(Constants.REGION_ID_PROP);
} else if (configMap != null && configMap.containsKey(Constants.REGION_ID_PROP)) {
region = configMap.get(Constants.REGION_ID_PROP);
} else {
region = Constants.DEFAULT_REGION_ID;
}
metaInfo.setRegionId(region);
return metaInfo;
}
Aggregations