Documentation ¶
Index ¶
- Constants
- func Bool(ctx context.Context, key string) bool
- func CtxFromGinContext(c *gin.Context) (context.Context, bool)
- func GinCtxWithCtx(c *gin.Context, ctx context.Context)
- func Int64(ctx context.Context, key string) int64
- func NewContext(ctx context.Context, md MD) context.Context
- func NewContext4Gin() context.Context
- func String(ctx context.Context, key string) string
- func Value(ctx context.Context, key string) interface{}
- func WithContext(c context.Context) context.Context
- type MD
Constants ¶
View Source
const ( RemoteIP = "remote_ip" RemotePort = "remote_port" ServerAddr = "server_addr" ClientAddr = "client_addr" Color = "color" Trace = "trace" Caller = "caller" // Log Notice = "notice" Timeout = "timeout" CPUUsage = "cpu_usage" Errors = "errors" Requests = "requests" Mirror = "mirror" Mid = "mid" Uid = "uid" Username = "username" // Device Device = "device" // Cluster cluster info key Cluster = "cluster" )
metadata common key
Variables ¶
This section is empty.
Functions ¶
func NewContext ¶
NewContext creates a new context with md attached.
func NewContext4Gin ¶
Types ¶
type MD ¶
type MD map[string]interface{}
MD is a mapping from metadata keys to values.
func FromContext ¶
FromContext returns the incoming metadata in ctx if it exists. The returned MD should not be modified. Writing to it may cause races. Modification should be made to copies of the returned MD.
func Join ¶
Join joins any number of mds into a single MD. The order of values for each key is determined by the order in which the mds containing those values are presented to Join.
Click to show internal directories.
Click to hide internal directories.