telemetry

package
v0.6.17-beta Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2026 License: MIT Imports: 14 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 ContentEnabled

func ContentEnabled() bool

ContentEnabled reports whether this process opted in to recording content. This setting is local policy and is never accepted from a remote trace carrier.

func ErrorType

func ErrorType(err error, fallback string) string

ErrorType classifies cancellation and timeouts before using a caller-supplied fallback. Without a fallback, other errors are classified by their Go type.

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 InternalRPCSpansEnabled

func InternalRPCSpansEnabled() bool

InternalRPCSpansEnabled reports this process's internal transport tracing policy.

func RecordError

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

RecordError records an error on the current span

func RecordSpanError

func RecordSpanError(span trace.Span, err error, opts ...trace.EventOption)

RecordSpanError records an error without exporting arbitrary provider responses or tool output unless content capture is explicitly enabled in this process.

func RecordSpanErrorWithType

func RecordSpanErrorWithType(span trace.Span, err error, errorType string, opts ...trace.EventOption)

RecordSpanErrorWithType uses an already-classified error while retaining the same content-capture policy as RecordSpanError.

func SetAttributes

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

SetAttributes adds attributes to the current span

func SetSpanError

func SetSpanError(span trace.Span, errorType string)

SetSpanError records only a bounded classification, never exception text, regardless of the content-capture policy. An empty classification is a no-op.

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
	// CaptureContent opts in to recording prompts, messages, and tool payloads.
	CaptureContent bool
	// InternalRPCSpans includes routine lifecycle and housekeeping transport spans.
	InternalRPCSpans 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

Directories

Path Synopsis
Package telemetrytest provides tracing fixtures and assertions for tests.
Package telemetrytest provides tracing fixtures and assertions for tests.

Jump to

Keyboard shortcuts

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