trace

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2026 License: MIT Imports: 4 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	// TraceIDHeader is the HTTP header name for trace IDs (X-Trace-ID for simplicity)
	TraceIDHeader = "X-Trace-ID"
)

Variables

This section is empty.

Functions

func FromContext

func FromContext(ctx context.Context) string

FromContext extracts the trace ID from the context. Returns "unknown" if no trace ID is found, making missing trace IDs obvious.

func NewTraceID

func NewTraceID() string

NewTraceID generates a new unique trace ID using crypto/rand. Format: 16 bytes of random data encoded as 32 character hex string.

func WithTraceID

func WithTraceID(ctx context.Context, traceID string) context.Context

WithTraceID returns a new context with the given trace ID attached. Use this at entry points to create a new trace.

Types

This section is empty.

Jump to

Keyboard shortcuts

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