Search in sources :

Example 1 with SamplingService

use of org.apache.skywalking.apm.agent.core.sampling.SamplingService in project incubator-skywalking by apache.

the class ContextManager method createEntrySpan.

public static AbstractSpan createEntrySpan(String operationName, ContextCarrier carrier) {
    SamplingService samplingService = ServiceManager.INSTANCE.findService(SamplingService.class);
    AbstractSpan span;
    AbstractTracerContext context;
    if (carrier != null && carrier.isValid()) {
        samplingService.forceSampled();
        context = getOrCreate(operationName, true);
        span = context.createEntrySpan(operationName);
        context.extract(carrier);
    } else {
        context = getOrCreate(operationName, false);
        span = context.createEntrySpan(operationName);
    }
    return span;
}
Also used : SamplingService(org.apache.skywalking.apm.agent.core.sampling.SamplingService) AbstractSpan(org.apache.skywalking.apm.agent.core.context.trace.AbstractSpan)

Aggregations

AbstractSpan (org.apache.skywalking.apm.agent.core.context.trace.AbstractSpan)1 SamplingService (org.apache.skywalking.apm.agent.core.sampling.SamplingService)1