use of org.apache.synapse.aspects.flow.statistics.opentracing.management.scoping.TracingScope in project wso2-synapse by wso2.
the class JaegerSpanHandler method handleAddCallback.
@Override
public void handleAddCallback(MessageContext messageContext, String callbackId) {
TracingScope tracingScope = tracingScopeManager.getTracingScope(messageContext);
tracingScope.addCallback();
}
use of org.apache.synapse.aspects.flow.statistics.opentracing.management.scoping.TracingScope in project wso2-synapse by wso2.
the class JaegerSpanHandler method handleCallbackFinishEvent.
private void handleCallbackFinishEvent(MessageContext messageContext) {
TracingScope tracingScope = tracingScopeManager.getTracingScope(messageContext);
tracingScope.removeCallback();
// The last callback received in a scope will finish the outer level span
if (tracingScope.isEventCollectionFinished(messageContext)) {
synchronized (tracingScope.getSpanStore()) {
cleanupContinuationStateSequences(tracingScope.getSpanStore());
SpanWrapper outerLevelSpanWrapper = tracingScope.getSpanStore().getOuterLevelSpanWrapper();
tracingScope.getSpanStore().finishSpan(outerLevelSpanWrapper);
tracingScopeManager.cleanupTracingScope(tracingScope.getTracingScopeId());
}
}
}
use of org.apache.synapse.aspects.flow.statistics.opentracing.management.scoping.TracingScope in project wso2-synapse by wso2.
the class JaegerSpanHandler method handleStateStackClearance.
@Override
public void handleStateStackClearance(MessageContext synCtx) {
TracingScope tracingScope = tracingScopeManager.getTracingScope(synCtx);
synchronized (tracingScope.getSpanStore()) {
List<ContinuationStateSequenceInfo> stackedSequences = tracingScope.getSpanStore().getContinuationStateSequenceInfos();
for (ContinuationStateSequenceInfo stackedSequence : stackedSequences) {
finishSpanForContinuationStateSequence(stackedSequence, tracingScope.getSpanStore());
}
stackedSequences.clear();
}
}
use of org.apache.synapse.aspects.flow.statistics.opentracing.management.scoping.TracingScope in project wso2-synapse by wso2.
the class JaegerSpanHandler method handleStateStackRemoval.
@Override
public void handleStateStackRemoval(ContinuationState continuationState, MessageContext synCtx) {
TracingScope tracingScope = tracingScopeManager.getTracingScope(synCtx);
synchronized (tracingScope.getSpanStore()) {
if (continuationState instanceof SeqContinuationState) {
// No other type will be kept track of
ContinuationStateSequenceInfo continuationStateSequenceInfo = findContinuationStateSequenceInfo(((SeqContinuationState) continuationState).getSeqType(), tracingScope.getSpanStore(), true);
if (continuationStateSequenceInfo != null) {
continuationStateSequenceInfo.setSpanActive(false);
finishSpanForContinuationStateSequence(continuationStateSequenceInfo, tracingScope.getSpanStore());
tracingScope.getSpanStore().getContinuationStateSequenceInfos().remove(continuationStateSequenceInfo);
}
}
}
}
use of org.apache.synapse.aspects.flow.statistics.opentracing.management.scoping.TracingScope in project wso2-synapse by wso2.
the class JaegerSpanHandler method handleStateStackInsertion.
@Override
public void handleStateStackInsertion(MessageContext synCtx, String seqName, SequenceType seqType) {
TracingScope tracingScope = tracingScopeManager.getTracingScope(synCtx);
synchronized (tracingScope.getSpanStore()) {
ContinuationStateSequenceInfo continuationStateSequenceInfo = findContinuationStateSequenceInfo(seqType, tracingScope.getSpanStore(), false);
if (continuationStateSequenceInfo != null) {
StatisticDataUnit statisticDataUnit = continuationStateSequenceInfo.getStatisticDataUnit();
continuationStateSequenceInfo.setSpanActive(true);
startSpan(statisticDataUnit, synCtx, tracingScope.getSpanStore());
}
}
}
Aggregations