Search in sources :

Example 1 with TracingScope

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();
}
Also used : TracingScope(org.apache.synapse.aspects.flow.statistics.opentracing.management.scoping.TracingScope)

Example 2 with TracingScope

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());
        }
    }
}
Also used : SpanWrapper(org.apache.synapse.aspects.flow.statistics.opentracing.models.SpanWrapper) TracingScope(org.apache.synapse.aspects.flow.statistics.opentracing.management.scoping.TracingScope)

Example 3 with TracingScope

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();
    }
}
Also used : TracingScope(org.apache.synapse.aspects.flow.statistics.opentracing.management.scoping.TracingScope) ContinuationStateSequenceInfo(org.apache.synapse.aspects.flow.statistics.opentracing.models.ContinuationStateSequenceInfo)

Example 4 with TracingScope

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);
            }
        }
    }
}
Also used : SeqContinuationState(org.apache.synapse.continuation.SeqContinuationState) TracingScope(org.apache.synapse.aspects.flow.statistics.opentracing.management.scoping.TracingScope) ContinuationStateSequenceInfo(org.apache.synapse.aspects.flow.statistics.opentracing.models.ContinuationStateSequenceInfo)

Example 5 with TracingScope

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());
        }
    }
}
Also used : BasicStatisticDataUnit(org.apache.synapse.aspects.flow.statistics.data.raw.BasicStatisticDataUnit) StatisticDataUnit(org.apache.synapse.aspects.flow.statistics.data.raw.StatisticDataUnit) TracingScope(org.apache.synapse.aspects.flow.statistics.opentracing.management.scoping.TracingScope) ContinuationStateSequenceInfo(org.apache.synapse.aspects.flow.statistics.opentracing.models.ContinuationStateSequenceInfo)

Aggregations

TracingScope (org.apache.synapse.aspects.flow.statistics.opentracing.management.scoping.TracingScope)5 ContinuationStateSequenceInfo (org.apache.synapse.aspects.flow.statistics.opentracing.models.ContinuationStateSequenceInfo)3 BasicStatisticDataUnit (org.apache.synapse.aspects.flow.statistics.data.raw.BasicStatisticDataUnit)1 StatisticDataUnit (org.apache.synapse.aspects.flow.statistics.data.raw.StatisticDataUnit)1 SpanWrapper (org.apache.synapse.aspects.flow.statistics.opentracing.models.SpanWrapper)1 SeqContinuationState (org.apache.synapse.continuation.SeqContinuationState)1