/** * Explicitly creates a new trace. The result will be a root span (no parent span ID). * * <p>To implicitly create a new trace, or a span within an existing one, use {@link * #nextSpan()}. */ public Span newTrace() { return _toSpan(newRootContext()); }
/** * Explicitly creates a child within an existing trace. The result will be have its parent ID set * to the input's span ID. If a sampling decision has not yet been made, one will happen here. * * <p>To implicitly create a new trace, or a span within an existing one, use {@link * #nextSpan()}. */ public Span newChild(TraceContext parent) { if (parent == null) throw new NullPointerException("parent == null"); return _toSpan(nextContext(parent)); }
/** Converts the context to a Span object after decorating it for propagation */ public Span toSpan(TraceContext context) { if (context == null) throw new NullPointerException("context == null"); if (alwaysSampleLocal) { int flags = InternalPropagation.instance.flags(context); if ((flags & FLAG_SAMPLED_LOCAL) != FLAG_SAMPLED_LOCAL) { context = InternalPropagation.instance.withFlags(context, flags | FLAG_SAMPLED_LOCAL); } } // decorating here addresses join, new traces or children and ad-hoc trace contexts return _toSpan(propagationFactory.decorate(context)); }
context.extra() ); return _toSpan(propagationFactory.decorate(context));
/** * Explicitly creates a new trace. The result will be a root span (no parent span ID). * * <p>To implicitly create a new trace, or a span within an existing one, use {@link * #nextSpan()}. */ public Span newTrace() { return _toSpan(newRootContext()); }
/** * Explicitly creates a child within an existing trace. The result will be have its parent ID set * to the input's span ID. If a sampling decision has not yet been made, one will happen here. * * <p>To implicitly create a new trace, or a span within an existing one, use {@link * #nextSpan()}. */ public Span newChild(TraceContext parent) { if (parent == null) throw new NullPointerException("parent == null"); return _toSpan(nextContext(parent)); }
/** Converts the context to a Span object after decorating it for propagation */ public Span toSpan(TraceContext context) { if (context == null) throw new NullPointerException("context == null"); if (alwaysSampleLocal) { int flags = InternalPropagation.instance.flags(context); if ((flags & FLAG_SAMPLED_LOCAL) != FLAG_SAMPLED_LOCAL) { context = InternalPropagation.instance.withFlags(context, flags | FLAG_SAMPLED_LOCAL); } } // decorating here addresses join, new traces or children and ad-hoc trace contexts return _toSpan(propagationFactory.decorate(context)); }
context.extra() ); return _toSpan(propagationFactory.decorate(context));