scope

package
v0.13.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 18, 2022 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	CarbonapiUUIDName  = "carbonapi_uuid"
	RequestHeadersName = "request_headers"
)
View Source
var Version string

Functions

func Bool added in v0.13.0

func Bool(ctx context.Context, key string) bool

Bool returns the true if particular key of the context is set

func ClickhouseUserAgent

func ClickhouseUserAgent(ctx context.Context) string

ClickhouseUserAgent ...

func Debug added in v0.13.0

func Debug(ctx context.Context, name string) bool

Debug returns true if debug-name should be enabled

func Grafana

func Grafana(ctx context.Context) string

func HttpRequest

func HttpRequest(r *http.Request) *http.Request

func Logger

func Logger(ctx context.Context) *zap.Logger

Logger returns zap.Logger instance

func LoggerWithHeaders added in v0.13.4

func LoggerWithHeaders(ctx context.Context, r *http.Request, headersToLog []string) *zap.Logger

Logger returns zap.Logger instance

func RequestID

func RequestID(ctx context.Context) string

RequestID ...

func String

func String(ctx context.Context, key string) string

String returns the string value associated with this context for key

func Table

func Table(ctx context.Context) string

Table ...

func With

func With(ctx context.Context, key string, value interface{}) context.Context

With returns a copy of parent in which the value associated with key is val.

func WithDebug added in v0.13.0

func WithDebug(ctx context.Context, name string) context.Context

WithDebug returns the context with debug-name

func WithLogger

func WithLogger(ctx context.Context, logger *zap.Logger) context.Context

WithLogger ...

func WithRequestID

func WithRequestID(ctx context.Context, requestID string) context.Context

WithRequestID ...

func WithTable

func WithTable(ctx context.Context, table string) context.Context

WithTable ...

Types

type Context

type Context struct {
	context.Context
}

Context wrapper for context.Context with chain constructor

func New

func New(ctx context.Context) *Context

New ...

func (*Context) With

func (c *Context) With(key string, value interface{}) *Context

With ...

func (*Context) WithLogger

func (c *Context) WithLogger(logger *zap.Logger) *Context

WithLogger ...

func (*Context) WithRequestID

func (c *Context) WithRequestID(requestID string) *Context

WithRequestID ...

func (*Context) WithTable

func (c *Context) WithTable(table string) *Context

WithTable ...

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL