Search in sources :

Example 11 with SpanWrapper

use of org.apache.synapse.aspects.flow.statistics.opentracing.models.SpanWrapper in project wso2-synapse by wso2.

the class MessageFlowRepresentationBasedParentResolver method getLatestEligibleParent.

/**
 * Gets the latest eligible span wrapper,
 * which is either a flow continuable mediator, or a For Each mediator.
 * Unlike in the LatestActiveParentResolver, the resolved span wrapper doesn't have to be active.
 * @param spanStore Span store object.
 * @return          Resolved parent span wrapper object.
 */
private static SpanWrapper getLatestEligibleParent(SpanStore spanStore) {
    Object[] spanWrapperKeys = spanStore.getSpanWrappers().keySet().toArray();
    for (int i = spanWrapperKeys.length - 1; i >= 0; i--) {
        String key = (String) spanWrapperKeys[i];
        SpanWrapper spanWrapper = spanStore.getSpanWrapper(key);
        if (isFlowContinuableMediator(spanWrapper.getStatisticDataUnit()) || isForeachMediator(spanWrapper.getStatisticDataUnit())) {
            // Only a flow continuable mediator, or a for each mediator can be the parent
            return spanWrapper;
        }
    }
    return null;
}
Also used : SpanWrapper(org.apache.synapse.aspects.flow.statistics.opentracing.models.SpanWrapper)

Aggregations

SpanWrapper (org.apache.synapse.aspects.flow.statistics.opentracing.models.SpanWrapper)11 StatisticDataUnit (org.apache.synapse.aspects.flow.statistics.data.raw.StatisticDataUnit)2 Span (io.opentracing.Span)1 SpanContext (io.opentracing.SpanContext)1 TextMapExtractAdapter (io.opentracing.propagation.TextMapExtractAdapter)1 TextMapInjectAdapter (io.opentracing.propagation.TextMapInjectAdapter)1 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1 Map (java.util.Map)1 BasicStatisticDataUnit (org.apache.synapse.aspects.flow.statistics.data.raw.BasicStatisticDataUnit)1 TracingScope (org.apache.synapse.aspects.flow.statistics.opentracing.management.scoping.TracingScope)1 Axis2MessageContext (org.apache.synapse.core.axis2.Axis2MessageContext)1