Help us shape the future of Go! Take the 2026 Go Developer Survey

tracing

package
v1.63.0 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2026 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewLogger

func NewLogger(config TraceConfig, verbose ...logger.Verbose) middlewares.Middleware

func NewTracedTransport

func NewTracedTransport(config TraceConfig) *traceTransport

Types

type TraceConfig

type TraceConfig struct {
	// SpanName is an optional name for the span.
	// If not provided, the hostname of the requesting URL will be used.
	SpanName string

	// A list of patterns for headers which should be redacted in the trace.
	RedactedHeaders []string

	// MaxBodyLength is the max size of the body, in bytes, that will be traced.
	// If the response body is larger than this, it will not be traced at all.
	//
	//  Default: 4096 (4MB)
	MaxBodyLength int64

	// Body controls whether the request Body is traced
	Body bool

	// Response controls whether the Response body is traced
	Response bool

	// ResponseHeaders controls whether the response headers are traced
	ResponseHeaders bool

	// QueryParam controls whether the query parameters are traced
	QueryParam bool

	// FormParams controls whether application/x-www-form-urlencoded request
	// parameters are traced without enabling the raw request body.
	FormParams bool

	// Headers controls whether the Headers are traced
	Headers bool

	// TLS connection information
	TLS bool

	Timing bool

	// Auth controls whether auth middleware (AWS SigV4, OAuth) logs trace messages
	Auth bool

	// AccessLog enables single-line access log output: METHOD URL STATUS DURATION
	AccessLog bool

	// AccessLogErrorsOnly restricts the access log to failing requests: only
	// transport errors and responses with status >= 400 are logged (with their
	// body). Successful requests are silent. Set when the access log is enabled
	// one level below the trace base, so failures surface at -v=0 without the
	// per-request access spam full access logging produces.
	AccessLogErrorsOnly bool
}

func TraceConfigFromString

func TraceConfigFromString(s string) TraceConfig

Jump to

Keyboard shortcuts

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