src/Zipkin/Tracer.php
public function newTrace(SamplingFlags $samplingFlags = null): Span
    {
        if ($samplingFlags === null) {
            $samplingFlags = DefaultSamplingFlags::createAsEmpty();
        }

        return $this->ensureSampled($this->newRootContext($samplingFlags));
    }
public function newTrace(SamplingFlags $samplingFlags = null): Span
    {
        if ($samplingFlags === null) {
            $samplingFlags = DefaultSamplingFlags::createAsEmpty();
        }

        return $this->ensureSampled($this->newRootContext($samplingFlags));
    }
Creates a new trace. If there is an existing trace, use {@link #newChild(TraceContext)}
instead.


For example, to sample all requests for a specific url:
<pre>{@code
function newTrace(Request $request) {
$uri = $request->getUri();
$flags = SamplingFlags::createAsEmpty();
if (strpos('/experimental', $uri) !== false) {
$flags = SamplingFlags::createAsSampled();
} else if (strpos('/static', $uri) !== false) {
$flags = SamplingFlags::createAsNotSampled();
}
return $this->tracer->newTrace($flags);
}
}</pre>

@param SamplingFlags $samplingFlags
@return Span