...

Package noop

import "go.opentelemetry.io/otel/trace/noop"
Overview
Index

Overview ▾

Package noop provides an implementation of the OpenTelemetry trace API that produces no telemetry and minimizes used computation resources.

Using this package to implement the OpenTelemetry trace API will effectively disable OpenTelemetry.

This implementation can be embedded in other implementations of the OpenTelemetry trace API. Doing so will mean the implementation defaults to no operation for methods it does not implement.

type Span

Span is an OpenTelemetry No-Op Span.

type Span struct {
    embedded.Span
    // contains filtered or unexported fields
}

func (Span) AddEvent

func (Span) AddEvent(string, ...trace.EventOption)

AddEvent does nothing.

func (Span) End

func (Span) End(...trace.SpanEndOption)

End does nothing.

func (Span) IsRecording

func (Span) IsRecording() bool

IsRecording always returns false.

func (Span) RecordError

func (Span) RecordError(error, ...trace.EventOption)

RecordError does nothing.

func (Span) SetAttributes

func (Span) SetAttributes(...attribute.KeyValue)

SetAttributes does nothing.

func (Span) SetName

func (Span) SetName(string)

SetName does nothing.

func (Span) SetStatus

func (Span) SetStatus(codes.Code, string)

SetStatus does nothing.

func (Span) SpanContext

func (s Span) SpanContext() trace.SpanContext

SpanContext returns an empty span context.

func (Span) TracerProvider

func (Span) TracerProvider() trace.TracerProvider

TracerProvider returns a No-Op TracerProvider.

type Tracer

Tracer is an OpenTelemetry No-Op Tracer.

type Tracer struct{ embedded.Tracer }

func (Tracer) Start

func (t Tracer) Start(ctx context.Context, _ string, _ ...trace.SpanStartOption) (context.Context, trace.Span)

Start creates a span. The created span will be set in a child context of ctx and returned with the span.

If ctx contains a span context, the returned span will also contain that span context. If the span context in ctx is for a non-recording span, that span instance will be returned directly.

type TracerProvider

TracerProvider is an OpenTelemetry No-Op TracerProvider.

type TracerProvider struct{ embedded.TracerProvider }

func NewTracerProvider

func NewTracerProvider() TracerProvider

NewTracerProvider returns a TracerProvider that does not record any telemetry.

func (TracerProvider) Tracer

func (TracerProvider) Tracer(string, ...trace.TracerOption) trace.Tracer

Tracer returns an OpenTelemetry Tracer that does not record any telemetry.