// SpanFromHeader returns a new trace span, based on a provided request header
// value. See https://cloud.google.com/trace/docs/faq.
//
// It returns nil iff the client is nil.
//
// The trace information and identifiers will be read from the header value.
// Otherwise, a new trace ID is made and the parent span ID is zero.
//
// The name of the new span is provided as an argument.
//
// If a non-nil sampling policy has been set in the client, it can override
// the options set in the header and choose whether to trace the request.
//
// If the header doesn't have existing tracing information, then a *Span is
// returned anyway, but it will not be uploaded to the server, just as when
// calling SpanFromRequest on an untraced request.
//
// Most users using HTTP should use SpanFromRequest, rather than
// SpanFromHeader, since it provides additional functionality for HTTP
// requests. In particular, it will set various pieces of request information
// as labels on the *Span, which is not available from the header alone.
SpanFromHeader returns a new trace span, based on a provided request header
value.

It returns nil iff the client is nil.

The trace information and identifiers will be read from the header value.
Otherwise, a new trace ID is made and the parent span ID is zero.

The name of the new span is provided as an argument.

If a non-nil sampling policy has been set in the client, it can override
the options set in the header and choose whether to trace the request.

If the header doesn't have existing tracing information, then a *Span is
returned anyway, but it will not be uploaded to the server, just as when
calling SpanFromRequest on an untraced request.

Most users using HTTP should use SpanFromRequest, rather than
SpanFromHeader, since it provides additional functionality for HTTP
requests. In particular, it will set various pieces of request information
as labels on the *Span, which is not available from the header alone.
// SpanFromHeader returns a new trace span based on a provided request header // value . See https : // cloud . google . com / trace / docs / faq . // // It returns nil iff the client is nil . // // The trace information and identifiers will be read from the header value . // Otherwise a new trace ID is made and the parent span ID is zero . // // The name of the new span is provided as an argument . // // If a non - nil sampling policy has been set in the client it can override // the options set in the header and choose whether to trace the request . // // If the header doesn ' t have existing tracing information then a * Span is // returned anyway but it will not be uploaded to the server just as when // calling SpanFromRequest on an untraced request . // // Most users using HTTP should use SpanFromRequest rather than // SpanFromHeader since it provides additional functionality for HTTP // requests . In particular it will set various pieces of request information // as labels on the * Span which is not available from the header alone .
func (c *Client) SpanFromHeader(name string, header string) *Span {
	if c == nil {
		return nil
	}
	traceID, parentSpanID, options, ok := traceInfoFromHeader(header)
	if !ok {
		traceID = nextTraceID()
	}
	t := &trace{
		traceID:       traceID,
		client:        c,
		globalOptions: options,
		localOptions:  options,
	}
	span := startNewChild(name, t, parentSpanID)
	span.span.Kind = spanKindServer
	span.rootSpan = true
	configureSpanFromPolicy(span, c.policy, ok)
	return span
}
func ( c * Client ) SpanFromHeader ( name string , header string ) * Span { if c == nil { return nil } traceID , parentSpanID , options , ok := traceInfoFromHeader ( header ) if ! ok { traceID = nextTraceID ( ) } t := & trace { traceID : traceID , client : c , globalOptions : options , localOptions : options , } span := startNewChild ( name , t , parentSpanID ) span . span . Kind = spanKindServer span . rootSpan = true configureSpanFromPolicy ( span , c . policy , ok ) return span }
SpanFromHeader returns a new trace span, based on a provided request header
value.
SpanFromHeader returns a new trace span based on a provided request header value .