Search in sources :

Example 1 with StatisticsCloseEvent

use of org.apache.synapse.aspects.flow.statistics.log.templates.StatisticsCloseEvent in project wso2-synapse by wso2.

the class CloseEventCollector method closeEntryEvent.

/**
 * Enqueue statistics event to the event queue. This method receives statistics events from synapse mediation
 * engine for all the component types.
 *
 * @param messageContext    synapse message context.
 * @param componentName     name of the component reporting statistics.
 * @param componentType     component type of the reporting component.
 * @param currentIndex      component's level in this message flow.
 * @param isContentAltering true if content is altered
 * @param propertyValue     value of the property
 */
public static void closeEntryEvent(MessageContext messageContext, String componentName, ComponentType componentType, Integer currentIndex, boolean isContentAltering, String propertyValue) {
    if (shouldReportStatistic(messageContext)) {
        Boolean isCollectingTracing = (Boolean) messageContext.getProperty(StatisticsConstants.FLOW_TRACE_IS_COLLECTED);
        StatisticDataUnit statisticDataUnit = new StatisticDataUnit();
        if (propertyValue != null) {
            statisticDataUnit.setPropertyValue(propertyValue);
        }
        statisticDataUnit.setComponentName(componentName);
        statisticDataUnit.setComponentType(componentType);
        if (currentIndex == null) {
            statisticDataUnit.setShouldTrackParent(true);
            statisticDataUnit.setCurrentIndex(StatisticDataCollectionHelper.getParentFlowPosition(messageContext, null));
            statisticDataUnit.setContinuationCall(true);
        } else {
            statisticDataUnit.setCurrentIndex(currentIndex);
        }
        StatisticDataCollectionHelper.collectData(messageContext, isContentAltering, isCollectingTracing, statisticDataUnit);
        StatisticsCloseEvent closeEvent = new StatisticsCloseEvent(statisticDataUnit);
        if (currentIndex == null) {
            addEvent(messageContext, closeEvent);
        } else {
            addEventAndDecrementCount(messageContext, closeEvent);
        }
        if (isOpenTracingEnabled()) {
            OpenTracingManagerHolder.getOpenTracingManager().getHandler().handleCloseEntryEvent(statisticDataUnit, messageContext);
        }
    }
}
Also used : StatisticDataUnit(org.apache.synapse.aspects.flow.statistics.data.raw.StatisticDataUnit) BasicStatisticDataUnit(org.apache.synapse.aspects.flow.statistics.data.raw.BasicStatisticDataUnit) StatisticsCloseEvent(org.apache.synapse.aspects.flow.statistics.log.templates.StatisticsCloseEvent)

Aggregations

BasicStatisticDataUnit (org.apache.synapse.aspects.flow.statistics.data.raw.BasicStatisticDataUnit)1 StatisticDataUnit (org.apache.synapse.aspects.flow.statistics.data.raw.StatisticDataUnit)1 StatisticsCloseEvent (org.apache.synapse.aspects.flow.statistics.log.templates.StatisticsCloseEvent)1