trace

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetSpan

func GetSpan(ctx context.Context) trace.Span

GetSpan retrieves span from context

func GetTracer

func GetTracer(name string) trace.Tracer

GetTracer returns a tracer for the given name

func InitTracer

func InitTracer(config Config) (trace.TracerProvider, error)

InitTracer initializes the global tracer

func WithSpan

func WithSpan(ctx context.Context, span trace.Span) context.Context

WithSpan adds a span to context

func WithTraceInfo

func WithTraceInfo(ctx context.Context, info *Info) context.Context

WithTraceInfo adds trace info to context

Types

type Config

type Config struct {
	ServiceName    string
	ServiceVersion string
	TracerProvider trace.TracerProvider
}

Config holds tracer configuration

type Info

type Info struct {
	TraceID   string    `json:"trace_id"`
	SpanID    string    `json:"span_id"`
	Timestamp time.Time `json:"timestamp"`
}

Info contains trace information for a request

func ExtractTraceInfo

func ExtractTraceInfo(spanCtx trace.SpanContext) *Info

ExtractTraceInfo extracts trace info from span context

func GetTraceInfo

func GetTraceInfo(ctx context.Context) *Info

GetTraceInfo retrieves trace info from context

Jump to

Keyboard shortcuts

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