telemetry

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2026 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ContextWithTracer

func ContextWithTracer(ctx context.Context, tracer trace.Tracer) context.Context

ContextWithTracer returns a new context.Context that contains the provided tracer.

func StartSpan

func StartSpan(
	ctx context.Context,
	name string,
	opts ...trace.SpanStartOption,
) (context.Context, trace.Span)

StartSpan creates a span and a context.Context containing the newly-created span.

If the context.Context provided in `ctx` contains a Span then the newly-created Span will be a child of that span, otherwise it will be a root span. This behavior can be overridden by providing `WithNewRoot()` as a SpanOption, causing the newly-created Span to be a root span even if `ctx` contains a Span.

When creating a Span it is recommended to provide all known span attributes using the `WithAttributes()` SpanOption as samplers will only have access to the attributes provided when a Span is created.

Any Span that is created MUST also be ended. This is the responsibility of the user. Implementations of this API may leak memory or other resources if Spans are not ended.

func TracerFromContext

func TracerFromContext(ctx context.Context) (trace.Tracer, bool)

TracerFromContext returns the tracer stored in the provided context.

Types

type Encoder

type Encoder interface {
	Encode(v any) error
}

Encoder encodes and outputs OpenTelemetry metric data-types as human-readable text.

type MetricFileExporter

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

func NewMetricFileExporter

func NewMetricFileExporter() *MetricFileExporter

func (*MetricFileExporter) Aggregation

func (*MetricFileExporter) Export

func (*MetricFileExporter) ForceFlush

func (m *MetricFileExporter) ForceFlush(ctx context.Context) error

func (*MetricFileExporter) Shutdown

func (m *MetricFileExporter) Shutdown(ctx context.Context) error

Shutdown replaces the encoder with a shutdownEncoder, which always returns errShutdown when Encode is called.

func (*MetricFileExporter) Temporality

type ShutdownFunc

type ShutdownFunc func(context.Context) error

func InitTracer

func InitTracer(ctx context.Context, attrs ...attribute.KeyValue) (trace.Tracer, ShutdownFunc, error)

type TraceRestorer

type TraceRestorer interface {
	RestoreTraces() []*coltracepb.ExportTraceServiceRequest
}

type TraceUploader

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

func NewTraceUploader

func NewTraceUploader(restorer TraceRestorer) *TraceUploader

func (*TraceUploader) Upload

func (t *TraceUploader) Upload(ctx context.Context) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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