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;
}
Aggregations