// FieldsFromContext returns a map of fields containing
// context information.  Currently, request ID field is
// included, if any.
518060
func FieldsFromContext(ctx context.Context) map[string]interface{} {
	m := make(map[string]interface{})
	v := ctx.Value(RequestIDContextKey)
	if v != nil {
		m[log.FnRequestID] = v.(string)
	}
	return m
}
109567
func (db *DB) GetContext(ctx context.Context, dest interface{}, keys ...interface{}) error {
	return getObject(ctx, db, db, dest, keys)
}
1345331
func GetContextFromRequest(req *protos.Request, serverID string) (context.Context, error) {
	ctx, err := pcontext.Decode(req.GetMetadata())
	if err != nil {
		return nil, err
	}
	if ctx == nil {
		return nil, constants.ErrNoContextFound
	}
	tags := opentracing.Tags{
		"local.id":     serverID,
		"span.kind":    "server",
		"peer.id":      pcontext.GetFromPropagateCtx(ctx, constants.PeerIDKey),
		"peer.service": pcontext.GetFromPropagateCtx(ctx, constants.PeerServiceKey),
		"request.id":   pcontext.GetFromPropagateCtx(ctx, constants.RequestIDKey),
	}
	parent, err := tracing.ExtractSpan(ctx)
	if err != nil {
		logger.Log.Warnf("failed to retrieve parent span: %s", err.Error())
	}
	ctx = tracing.StartSpan(ctx, req.GetMsg().GetRoute(), tags, parent)
	ctx = CtxWithDefaultLogger(ctx, req.GetMsg().GetRoute(), "")
	return ctx, nil
}
1364695
func ClientFromContext(ctx context.Context) (*Client, bool) {
	client, ok := ctx.Value(clientContextKey{}).(*Client)
	return client, ok
}
1210732
func HTMLFromContext(ctx context.Context) template.HTML {
	var h template.HTML
	ci, ok := FromContext(ctx)
	if ok {
		return ci.HTML()
	}
	return h
}
959407
func JSONContext(buffer Buffer, event *cue.Event) {
	fields := event.Context.Fields()
	marshaled, _ := json.Marshal(fields)
	buffer.Append(marshaled)
}
899847
func FromContext(ctx context.Context) (Reporter, bool) {
	h, ok := ctx.Value(reporterKey).(Reporter)
	return h, ok
}
879777
func (o *GetMapNameParams) WithContext(ctx context.Context) *GetMapNameParams {
	o.SetContext(ctx)
	return o
}
446299
func (o *GetIdentityParams) WithContext(ctx context.Context) *GetIdentityParams {
	o.SetContext(ctx)
	return o
}
674391
func (o *GetFqdnCacheIDParams) WithContext(ctx context.Context) *GetFqdnCacheIDParams {
	o.SetContext(ctx)
	return o
}
874051
func MetadataFromContext(ctx context.Context) Metadata {
	m := Metadata{"NA", "NA", "NA", "", ""} // batman

	if v := ctx.Value("remote"); v != nil {
		m.Remote = v.(string)
	}
	if v := ctx.Value("scheme"); v != nil {
		m.Scheme = v.(string)
	}
	if v := ctx.Value("local"); v != nil {
		m.Local = v.(string)
	}
	if v := ctx.Value("Origin"); v != nil {
		m.Origin = v.(string)
	}
	if v := ctx.Value("User-Agent"); v != nil {
		m.UserAgent = v.(string)
	}
	return m
}
701760
func (config *DirectClientConfig) getContext() (clientcmdapi.Context, error) {
	contexts := config.config.Contexts
	contextName, required := config.getContextName()

	mergedContext := clientcmdapi.NewContext()
	if configContext, exists := contexts[contextName]; exists {
		mergo.MergeWithOverwrite(mergedContext, configContext)
	} else if required {
		return clientcmdapi.Context{}, fmt.Errorf("context %q does not exist", contextName)
	}
	mergo.MergeWithOverwrite(mergedContext, config.overrides.Context)

	return *mergedContext, nil
}
943796
func (call *GetProfileCall) WithContext(ctx context.Context) *GetProfileCall {
	call.ctx = ctx
	return call
}
279621
func (q *Query) WithContext(ctx context.Context) *Query {
	q.ctx = ctx
	return q
}
280687
func (f *RelationalFieldDefinition) Context() string {
	if f.FieldName != "" {
		return fmt.Sprintf("RelationalField %#v", f.FieldName)
	}
	return "unnamed RelationalField"
}
844397
func (c *GetConfigByHashCall) Context(ctx context.Context) *GetConfigByHashCall {
	c.ctx_ = ctx
	return c
}
411679
func GroupFromContext(ctx context.Context) *Group {
	c, _ := ctx.Value(groupKey).(*Group)
	return c
}