Search in sources :

Example 1 with MetaInfo

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;
}
Also used : Target(org.wso2.carbon.apimgt.common.analytics.publishers.dto.Target) 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)

Example 2 with MetaInfo

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;
}
Also used : MetaInfo(org.wso2.carbon.apimgt.common.analytics.publishers.dto.MetaInfo)

Example 3 with 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);
}
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)

Example 4 with MetaInfo

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;
}
Also used : MetaInfo(org.wso2.carbon.apimgt.common.analytics.publishers.dto.MetaInfo)

Aggregations

MetaInfo (org.wso2.carbon.apimgt.common.analytics.publishers.dto.MetaInfo)4 API (org.wso2.carbon.apimgt.common.analytics.publishers.dto.API)2 Event (org.wso2.carbon.apimgt.common.analytics.publishers.dto.Event)2 Target (org.wso2.carbon.apimgt.common.analytics.publishers.dto.Target)2 Application (org.wso2.carbon.apimgt.common.analytics.publishers.dto.Application)1 Latencies (org.wso2.carbon.apimgt.common.analytics.publishers.dto.Latencies)1 Operation (org.wso2.carbon.apimgt.common.analytics.publishers.dto.Operation)1