telemetry

package
v0.0.48 Latest Latest
Warning

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

Go to latest
Published: May 11, 2026 License: GPL-3.0 Imports: 5 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrTraceExporterInitialization is an error that occurs when the traces exporter fails to start.
	ErrTraceExporterInitialization = errors.New("failed to start traces exporter")
)

Functions

func GetCurrentSpan

func GetCurrentSpan(ctx context.Context, tracerName string, opts ...trace.TracerOption) trace.Span

GetCurrentSpan returns a span instance.

func GetMeter

func GetMeter(meterName string, opts ...metric.MeterOption) metric.Meter

GetMeter returns a meter instance

func GetTracer

func GetTracer(tracerName string, opts ...trace.TracerOption) trace.Tracer

GetTracer returns a tracer instance.

func NewSpan added in v0.0.13

func NewSpan(ctx context.Context, traceName string, opts ...trace.SpanStartOption) (context.Context, trace.Span)

NewSpan creates and starts a new trace span with the provided context, trace name, and optional span start options.

func RecordError added in v0.0.48

func RecordError(ctx context.Context, err error)

RecordError records an error in the current span associated with the provided context.

Types

type OTELConfigs

type OTELConfigs struct {
	Service struct {
		Name        string
		Version     string
		Environment string
	}
	Endpoints struct {
		Traces  string
		Metrics string
		Logs    string
	}
	Enabled bool
}

func NewDefaultCfg added in v0.0.14

func NewDefaultCfg() *OTELConfigs

func (*OTELConfigs) IsEnabled

func (t *OTELConfigs) IsEnabled() bool

type Option

type Option func(*OTELConfigs)

Option defines a telemetry configuration option.

func WithLogsEndpoint added in v0.0.29

func WithLogsEndpoint(endpoint string) Option

WithLogsEndpoint sets the endpoint for the logs exporter.

func WithMetricEndpoint added in v0.0.13

func WithMetricEndpoint(endpoint string) Option

WithMetricEndpoint sets the endpoint for the metrics exporter.

func WithOtelEnabled added in v0.0.13

func WithOtelEnabled(enabled bool) Option

WithOtelEnabled enables or disables telemetry.

func WithService

func WithService(name, version, env string) Option

WithService sets the service name, version and environment.

func WithTraceEndpoint added in v0.0.13

func WithTraceEndpoint(endpoint string) Option

WithTraceEndpoint sets the endpoint for the traces exporter.

type TracingIDs added in v0.0.13

type TracingIDs struct {
	TraceID string
	SpanID  string
}

TracingIDs represents the tracing IDs (TraceID and SpanID) associated with a span.

func GetSpanDataFromContext added in v0.0.13

func GetSpanDataFromContext(ctx context.Context) TracingIDs

GetSpanDataFromContext extracts tracing IDs (TraceID and SpanID) from the given context and returns them as TracingIDs.

Jump to

Keyboard shortcuts

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