telemetry

package
v0.3.28-beta Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package telemetry provides OpenTelemetry tracing for Kodelet

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddEvent

func AddEvent(ctx context.Context, name string, attrs ...attribute.KeyValue)

AddEvent adds an event to the current span

func InitTracer

func InitTracer(ctx context.Context, cfg Config) (shutdown func(context.Context) error, err error)

InitTracer initializes the OpenTelemetry tracer provider Returns a shutdown function to be called before application termination

func RecordError

func RecordError(ctx context.Context, err error, opts ...trace.EventOption)

RecordError records an error on the current span

func SetAttributes

func SetAttributes(ctx context.Context, attrs ...attribute.KeyValue)

SetAttributes adds attributes to the current span

func Tracer

func Tracer(name string) trace.Tracer

Tracer returns a named tracer from the global provider If the name is empty, it uses "kodelet" as the default

func WithSpan

func WithSpan(ctx context.Context, name string, f func(context.Context) error, attrs ...attribute.KeyValue) error

WithSpan wraps a function with a span It automatically sets the status and records errors

func WithSpanFunc

func WithSpanFunc(ctx context.Context, name string, f func(context.Context), attrs ...attribute.KeyValue)

WithSpanFunc is like WithSpan but for functions that don't return errors

Types

type Config

type Config struct {
	// Enabled determines if tracing is enabled
	Enabled bool
	// ServiceName is the name of the service in traces
	ServiceName string
	// ServiceVersion is the version of the service in traces
	ServiceVersion string
	// SamplerType is the type of sampler to use (always, never, ratio)
	SamplerType string
	// SamplerRatio is the sampling ratio when using ratio sampler
	SamplerRatio float64
}

Config represents the configuration for the telemetry system

Jump to

Keyboard shortcuts

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