context

package
v1.5.6 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2022 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Context

type Context interface {
	stdctx.Context
	Logger
	GetContext() stdctx.Context
	SetContext(ctx stdctx.Context)
	AddTag(keysAndValues ...interface{}) Context
	Fork(name string, exporters ...Exporter) Context
	Commit(msg string)
}

Context keep the trace info

func NewTraceContext

func NewTraceContext(ctx stdctx.Context, id string) Context

NewTraceContext new a TraceContext

type Exporter

type Exporter func(t *traceContext, duration float64)

Exporter export context info.

func DurationMetric

func DurationMetric(h func(v float64)) Exporter

DurationMetric export context duration metric.

type Logger

type Logger interface {
	InfoDepth(depth int, msg string, keysAndValues ...interface{})
	Info(msg string, keysAndValues ...interface{})
	Error(err error, msg string, keysAndValues ...interface{})
	ErrorDepth(depth int, err error, msg string, keysAndValues ...interface{})
	Printf(format string, args ...interface{})
	V(level int)
}

Logger represents the ability to log messages, both errors and not.

Jump to

Keyboard shortcuts

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