tracing

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2025 License: MIT Imports: 7 Imported by: 10

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ClientIP

func ClientIP(req *http.Request) string

func Key

func Key() interface{}

func Service

func Service() string

func Setup

func Setup(opt ...Option)

func With

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

func WithTrace

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

Types

type IpHeader added in v0.2.0

type IpHeader func(req *http.Request) (string, bool)

func FixedIp added in v0.2.0

func FixedIp(ip string) IpHeader

func Forwarded added in v0.2.0

func Forwarded() IpHeader

func RemoteAddr added in v0.2.0

func RemoteAddr() IpHeader

func XEnvoyExternalAddress added in v0.2.0

func XEnvoyExternalAddress() IpHeader

func XForwardedFor added in v0.2.0

func XForwardedFor() IpHeader

func XRealIp added in v0.2.0

func XRealIp() IpHeader

type IpHeaders added in v0.2.0

type IpHeaders []IpHeader

func DefaultIpHeaders added in v0.2.0

func DefaultIpHeaders() IpHeaders

func (IpHeaders) Append added in v0.2.0

func (h IpHeaders) Append(header IpHeader) IpHeaders

func (IpHeaders) Get added in v0.2.0

func (h IpHeaders) Get(req *http.Request) (string, bool)

func (IpHeaders) Prepend added in v0.2.0

func (h IpHeaders) Prepend(header IpHeader) IpHeaders

type NewFunc

type NewFunc func(ctx context.Context, req *http.Request) Tracing

type Option added in v0.2.0

type Option func()

func ServiceName added in v0.2.0

func ServiceName(name string) Option

func TraceOption added in v0.2.0

func TraceOption(f1 TraceFunc, f ...TraceFunc) Option

func WithIpHeaders added in v0.2.0

func WithIpHeaders(keys ...IpHeader) Option

type TraceFunc

type TraceFunc func(ctx context.Context, event *zerolog.Event) *zerolog.Event

type Tracing

type Tracing interface {
	WithTrace(ctx context.Context, event *zerolog.Event) *zerolog.Event
	Dump(ctx context.Context, log *zerolog.Event) *zerolog.Event
}

Jump to

Keyboard shortcuts

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