// ContextSpanID returns the span ID extracted from the given context if any,
// the empty string otherwise.
543853
func ContextSpanID(ctx context.Context) string {
	if s := ctx.Value(spanKey); s != nil {
		return s.(string)
	}
	return ""
}
236562
func (s *Span) Attach(ctx context.Context) context.Context {
	return opentracing.ContextWithSpan(ctx, s)
}
1332116
func NewContextRequestID(ctx context.Context, id string) context.Context {
	return context.WithValue(ctx, ctxKeyReqID, id)
}
841098
func (a *APIDefinition) Context() string {
	if a.Name != "" {
		return fmt.Sprintf("API %#v", a.Name)
	}
	return "unnamed API"
}
446499
func ContextRequestID(ctx context.Context) string {
	var reqID string
	id := ctx.Value(reqIDKey)
	if id != nil {
		reqID = id.(string)
	}
	return reqID
}
918538
func (c *BotEventsCall) Context(ctx context.Context) *BotEventsCall {
	c.ctx_ = ctx
	return c
}
244763
func (f *fs) getContext() context.Context {
	// TODO: Make timeout configurable
	c, _ := context.WithTimeout(context.Background(), 10*time.Second)
	c = metadata.NewContext(
		c,
		metadata.Pairs("fsid", f.fsid),
	)
	return c
}
720202
func (t *Tr) contextOrCachedNode(id ID, cache bool) (*Node, error) {
	if t.context != nil {
		n := t.context.getNode(id)
		if n != nil {
			return n, nil
		}
	}

	return t.cacher.getNode(t, id, cache)
}
73320
func (c *BotsCountCall) Context(ctx context.Context) *BotsCountCall {
	c.ctx_ = ctx
	return c
}
672722
func (c *UnitsSetCall) Context(ctx context.Context) *UnitsSetCall {
	c.ctx_ = ctx
	return c
}
1281246
func ContextFromString(value string) (SpanContext, error) {
	var context SpanContext
	if value == "" {
		return emptyContext, errEmptyTracerStateString
	}
	parts := strings.Split(value, ":")
	if len(parts) != 4 {
		return emptyContext, errMalformedTracerStateString
	}
	var err error
	if context.traceID, err = TraceIDFromString(parts[0]); err != nil {
		return emptyContext, err
	}
	if context.spanID, err = SpanIDFromString(parts[1]); err != nil {
		return emptyContext, err
	}
	if context.parentID, err = SpanIDFromString(parts[2]); err != nil {
		return emptyContext, err
	}
	flags, err := strconv.ParseUint(parts[3], 10, 8)
	if err != nil {
		return emptyContext, err
	}
	context.flags = byte(flags)
	return context, nil
}
959402
func (c *GroupRequestsVersionsRollupCall) Context(ctx context.Context) *GroupRequestsVersionsRollupCall {
	c.ctx_ = ctx
	return c
}
609464
func Context(th *starlark.Thread) context.Context {
	if ctx := th.Local(threadCtxKey); ctx != nil {
		return ctx.(context.Context)
	}
	panic("not an Interpreter thread, no context in its locals")
}
41017
func ContextHandlerFunc(h http.HandlerFunc, cap int) http.HandlerFunc {
	return ContextHandler(h, cap)
}
1278848
func ContextTraceID(ctx context.Context) string {
	if t := ctx.Value(traceKey); t != nil {
		return t.(string)
	}
	return ""
}
579453
func (sd *RelationalStoreDefinition) Context() string {
	if sd.Name != "" {
		return fmt.Sprintf("RelationalStore %#v", sd.Name)
	}
	return "unnamed RelationalStore"
}
798651
func (c *GroupInsertCall) Context(ctx context.Context) *GroupInsertCall {
	c.ctx_ = ctx
	return c
}