/** @deprecated do not use object variant.. only set when you have a sampling decision */ @Deprecated public TraceContextOrSamplingFlags sampled(@Nullable Boolean sampled) { if (sampled != null) return sampled(sampled.booleanValue()); int flags = value.flags; flags &= ~FLAG_SAMPLED_SET; flags &= ~FLAG_SAMPLED; if (flags == value.flags) return this; // save effort if no change return withFlags(flags); }
/** Creates a potentially noop span representing this request */ // copy/pasted from HttpServerHandler.nextSpan Span nextSpan(TraceContextOrSamplingFlags extracted, HttpRequest request) { Boolean sampled = extracted.sampled(); // only recreate the context if the http sampler made a decision if (sampled == null && (sampled = sampler.trySample(adapter, request)) != null) { extracted = extracted.sampled(sampled.booleanValue()); } return extracted.context() != null ? tracer.joinSpan(extracted.context()) : tracer.nextSpan(extracted); }
/** Creates a potentially noop span representing this request */ Span nextSpan(TraceContextOrSamplingFlags extracted, Req request) { Boolean sampled = extracted.sampled(); // only recreate the context if the http sampler made a decision if (sampled == null && (sampled = sampler.trySample(adapter, request)) != null) { extracted = extracted.sampled(sampled.booleanValue()); } return extracted.context() != null ? tracer.joinSpan(extracted.context()) : tracer.nextSpan(extracted); }
/** @deprecated do not use object variant.. only set when you have a sampling decision */ @Deprecated public TraceContextOrSamplingFlags sampled(@Nullable Boolean sampled) { if (sampled != null) return sampled(sampled.booleanValue()); int flags = value.flags; flags &= ~FLAG_SAMPLED_SET; flags &= ~FLAG_SAMPLED; if (flags == value.flags) return this; // save effort if no change return withFlags(flags); }