/** * Should we sample this request or not? True means sample, false means don't, null means we defer * decision to someone further down in the stack. */ @Nullable public final Boolean sampled() { if (debug()) return true; return (flags & FLAG_SAMPLING_SET) == FLAG_SAMPLING_SET ? (flags & FLAG_SAMPLED) == FLAG_SAMPLED : null; }
Span(SpanId context) { this.context = context; trace_id_high = context.traceIdHigh; trace_id = context.traceId; parent_id = context.nullableParentId(); id = context.spanId; name = ""; // avoid NPE on equals if (context.debug()) debug = true; }
/** * Should we sample this request or not? True means sample, false means don't, null means we defer * decision to someone further down in the stack. */ @Nullable public final Boolean sampled() { if (debug()) return true; return (flags & FLAG_SAMPLING_SET) == FLAG_SAMPLING_SET ? (flags & FLAG_SAMPLED) == FLAG_SAMPLED : null; }
public static TraceContext toTraceContext(SpanId spanId) { // visible for testing if (spanId == null) throw new NullPointerException("spanId == null"); return TraceContext.newBuilder() .traceIdHigh(spanId.traceIdHigh) .traceId(spanId.traceId) .parentId(spanId.nullableParentId()) .spanId(spanId.spanId) .debug(spanId.debug()) .sampled(spanId.sampled()).build(); }