tracing

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2025 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package tracing provides OpenTelemetry tracing support for GoCacheX.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type NoOpTracer

type NoOpTracer struct{}

NoOpTracer is a no-operation tracer for when tracing is disabled.

func (*NoOpTracer) AddEvent

func (n *NoOpTracer) AddEvent(ctx context.Context, name string, attributes ...trace.EventOption)

AddEvent is a no-op implementation.

func (*NoOpTracer) Close

func (n *NoOpTracer) Close() error

Close is a no-op implementation.

func (*NoOpTracer) GetServiceName

func (n *NoOpTracer) GetServiceName() string

GetServiceName returns empty string for no-op tracer.

func (*NoOpTracer) IsEnabled

func (n *NoOpTracer) IsEnabled() bool

IsEnabled returns false for no-op tracer.

func (*NoOpTracer) RecordError

func (n *NoOpTracer) RecordError(ctx context.Context, err error)

RecordError is a no-op implementation.

func (*NoOpTracer) SetAttributes

func (n *NoOpTracer) SetAttributes(ctx context.Context, attributes ...trace.SpanStartEventOption)

SetAttributes is a no-op implementation.

func (*NoOpTracer) SpanFromContext

func (n *NoOpTracer) SpanFromContext(ctx context.Context) trace.Span

SpanFromContext is a no-op implementation.

func (*NoOpTracer) StartSpan

func (n *NoOpTracer) StartSpan(ctx context.Context, operationName string) (context.Context, trace.Span)

StartSpan is a no-op implementation.

func (*NoOpTracer) TraceBatchOperation

func (n *NoOpTracer) TraceBatchOperation(ctx context.Context, operation, backend string, keyCount int, fn func(ctx context.Context) error) error

TraceBatchOperation is a no-op implementation.

func (*NoOpTracer) TraceOperation

func (n *NoOpTracer) TraceOperation(ctx context.Context, operation, backend string, fn func(ctx context.Context) error) error

TraceOperation is a no-op implementation.

type Tracer

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

Tracer wraps OpenTelemetry tracing functionality.

func New

func New(cfg config.TracingConfig) (*Tracer, error)

New creates a new tracer instance.

func (*Tracer) AddEvent

func (t *Tracer) AddEvent(ctx context.Context, name string, attributes ...trace.EventOption)

AddEvent adds an event to the current span.

func (*Tracer) Close

func (t *Tracer) Close() error

Close closes the tracer and flushes any pending spans.

func (*Tracer) GetServiceName

func (t *Tracer) GetServiceName() string

GetServiceName returns the service name for tracing.

func (*Tracer) IsEnabled

func (t *Tracer) IsEnabled() bool

IsEnabled returns whether tracing is enabled.

func (*Tracer) RecordError

func (t *Tracer) RecordError(ctx context.Context, err error)

RecordError records an error on the current span.

func (*Tracer) SetAttributes

func (t *Tracer) SetAttributes(ctx context.Context, attributes ...trace.SpanStartEventOption)

SetAttributes sets attributes on the current span.

func (*Tracer) SpanFromContext

func (t *Tracer) SpanFromContext(ctx context.Context) trace.Span

SpanFromContext returns the span from the context.

func (*Tracer) StartSpan

func (t *Tracer) StartSpan(ctx context.Context, operationName string) (context.Context, trace.Span)

StartSpan starts a new tracing span.

func (*Tracer) TraceBatchOperation

func (t *Tracer) TraceBatchOperation(ctx context.Context, operation, backend string, keyCount int, fn func(ctx context.Context) error) error

TraceBatchOperation traces a batch cache operation.

func (*Tracer) TraceOperation

func (t *Tracer) TraceOperation(ctx context.Context, operation, backend string, fn func(ctx context.Context) error) error

TraceOperation traces a cache operation.

Jump to

Keyboard shortcuts

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