tracelog

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2025 License: MIT Imports: 6 Imported by: 7

Documentation

Index

Constants

View Source
const (
	SpanId  = "span_id"
	Id      = "trace_id"
	Sampled = "sampled"
)

Variables

This section is empty.

Functions

func New

func New() func(ctx context.Context, req *http.Request) tracing.Tracing

func Setup

func Setup(opt ...Option)

func WithContext

func WithContext(ctx context.Context, req *http.Request, f ...tracing.NewFunc) context.Context

func WithTrace

func WithTrace() tracing.LogFunc

Types

type Config

type Config struct {
	RequestIdHeader string
	RequestIdFunc
	tracing.NewFunc
}

func TraceConfig

func TraceConfig() *Config

func (*Config) GetRequestId

func (c *Config) GetRequestId(ctx context.Context, req *http.Request) string

type Option

type Option func(c *Config)

func WithNewFunc

func WithNewFunc(f tracing.NewFunc) Option

func WithRequestIdFunc

func WithRequestIdFunc(f RequestIdFunc) Option

func WithRequestIdHeader

func WithRequestIdHeader(header string) Option

type RequestIdFunc

type RequestIdFunc func(ctx context.Context, req *http.Request) string

type TracingContext

type TracingContext struct {
	Path      string
	ClientIP  string
	RequestID string
	Service   string
}

func Context

func Context(ctx context.Context) *TracingContext

func (*TracingContext) Dump

func (tc *TracingContext) Dump(ctx context.Context, log *zerolog.Event) *zerolog.Event

func (*TracingContext) WithTrace

func (tc *TracingContext) WithTrace(ctx context.Context, event *zerolog.Event) *zerolog.Event

Jump to

Keyboard shortcuts

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