// NewRemoteChild creates a new span as a child of s.
//
// Some labels in the span are set from the outgoing *http.Request r.
//
// A header is set in r so that the trace context is propagated to the
// destination.  The parent span ID in that header is set as follows:
// - If the request is being traced, then the ID of s is used.
// - If the request is not being traced, but there was a trace context header
//   in the incoming request for this trace (the request passed to
//   SpanFromRequest), the parent span ID in that header is used.
// - Otherwise, the parent span ID is zero.
// The tracing bit in the options is set if tracing is enabled, or if it was
// set in the incoming request.
//
// If s is nil, does nothing and returns nil.
NewRemoteChild creates a new span as a child of s.

Some labels in the span are set from the outgoing *http.Request r.

A header is set in r so that the trace context is propagated to the
destination.  The parent span ID in that header is set as follows:
- If the request is being traced, then the ID of s is used.
- If the request is not being traced, but there was a trace context header
in the incoming request for this trace (the request passed to
SpanFromRequest), the parent span ID in that header is used.
- Otherwise, the parent span ID is zero.
The tracing bit in the options is set if tracing is enabled, or if it was
set in the incoming request.

If s is nil, does nothing and returns nil.
// NewRemoteChild creates a new span as a child of s . // // Some labels in the span are set from the outgoing * http . Request r . // // A header is set in r so that the trace context is propagated to the // destination . The parent span ID in that header is set as follows : // - If the request is being traced then the ID of s is used . // - If the request is not being traced but there was a trace context header // in the incoming request for this trace ( the request passed to // SpanFromRequest ) the parent span ID in that header is used . // - Otherwise the parent span ID is zero . // The tracing bit in the options is set if tracing is enabled or if it was // set in the incoming request . // // If s is nil does nothing and returns nil .
func (s *Span) NewRemoteChild(r *http.Request) *Span {
	if s == nil {
		return nil
	}
	if !s.tracing() {
		r.Header[httpHeader] = []string{spanHeader(s.trace.traceID, s.span.ParentSpanId, s.trace.globalOptions)}
		return s
	}
	newSpan := startNewChildWithRequest(r, s.trace, s.span.SpanId)
	r.Header[httpHeader] = []string{spanHeader(s.trace.traceID, newSpan.span.SpanId, s.trace.globalOptions)}
	return newSpan
}
func ( s * Span ) NewRemoteChild ( r * http . Request ) * Span { if s == nil { return nil } if ! s . tracing ( ) { r . Header [ httpHeader ] = [ ] string { spanHeader ( s . trace . traceID , s . span . ParentSpanId , s . trace . globalOptions ) } return s } newSpan := startNewChildWithRequest ( r , s . trace , s . span . SpanId ) r . Header [ httpHeader ] = [ ] string { spanHeader ( s . trace . traceID , newSpan . span . SpanId , s . trace . globalOptions ) } return newSpan }
NewRemoteChild creates a new span as a child of s.
NewRemoteChild creates a new span as a child of s .