tracing

package module
v0.2.7 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2026 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ContextWithTracingContext

func ContextWithTracingContext(ctx context.Context, tc *TracingContext) context.Context

ContextWithTracingContext stores the current tracing context in a context.

func DecorateStruct

func DecorateStruct[T any](obj T, opt TracingDecoratorOption) T

func NewTracer

func NewTracer(opt *TracerOption) error

Types

type Layer

type Layer int
const (
	LayerUnknown Layer = iota
	LayerHandler
	LayerService
	LayerRepo
)

func (Layer) String

func (l Layer) String() string

type MethodCall

type MethodCall struct {
	Layer Layer
	Name  string
}

type TracerOption

type TracerOption struct {
	URL                string
	Name               string
	Version            string
	Branch             string
	Revision           string
	Environment        string
	SamplingRate       float64
	MaxAttributes      int
	MaxAttributeLength int
	MaxEventsPerSpan   int
	MaxLinksPerSpan    int
	MaxQueueSize       int
	BatchTimeout       time.Duration
	ExportTimeout      time.Duration
	MaxExportBatchSize int
	TLSEnabled         bool
	InsecureSkipVerify bool
	TLSCertFile        string
	TLSKeyFile         string
	TLSCAFile          string
	Headers            map[string]string
}

type TracingContext

type TracingContext struct {
	// contains filtered or unexported fields
}

func NewTracingContext

func NewTracingContext(ctx context.Context, name string, maxAttrs int) *TracingContext

func TracingContextFromContext

func TracingContextFromContext(ctx context.Context) *TracingContext

TracingContextFromContext returns the tracing context stored in ctx.

func (*TracingContext) AddMethodCall

func (tc *TracingContext) AddMethodCall(layer Layer, name string)

func (*TracingContext) Context

func (tc *TracingContext) Context() context.Context

func (*TracingContext) End

func (tc *TracingContext) End()

func (*TracingContext) SetAttributes

func (tc *TracingContext) SetAttributes(attributes ...attribute.KeyValue)

func (*TracingContext) SetStatus

func (tc *TracingContext) SetStatus(code codes.Code, description string)

type TracingDecoratorOption

type TracingDecoratorOption struct {
	Layer                    Layer
	CreateSpanForEachMethod  bool
	RecordMethodParams       bool
	RecordMethodReturnValues bool
}

Jump to

Keyboard shortcuts

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