noop
v1.47.0
Documentation
pkg.go.dev ↗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.
Types
Span
type Span struct {
embedded.Span
// contains filtered or unexported fields
}
Span is an OpenTelemetry No-Op Span.
Span.AddEvent
func (Span) AddEvent(string, ...trace.EventOption)
AddEvent does nothing.
Span.AddLink
func (Span) AddLink(trace.Link)
AddLink does nothing.
Span.End
func (Span) End(...trace.SpanEndOption)
End does nothing.
Span.IsRecording
func (Span) IsRecording() bool
IsRecording always returns false.
Span.RecordError
func (Span) RecordError(error, ...trace.EventOption)
RecordError does nothing.
Span.SetAttributes
func (Span) SetAttributes(...attribute.KeyValue)
SetAttributes does nothing.
Span.SetName
func (Span) SetName(string)
SetName does nothing.
Span.SetStatus
func (Span) SetStatus(codes.Code, string)
SetStatus does nothing.
Span.SpanContext
func (s Span) SpanContext() trace.SpanContext
SpanContext returns an empty span context.
Span.TracerProvider
func (Span) TracerProvider() trace.TracerProvider
TracerProvider returns a No-Op TracerProvider.
Tracer
type Tracer struct{ embedded.Tracer }
Tracer is an OpenTelemetry No-Op Tracer.
Tracer.Start
func (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.
TracerProvider
type TracerProvider struct{ embedded.TracerProvider }
TracerProvider is an OpenTelemetry No-Op TracerProvider.
NewTracerProvider
func NewTracerProvider() TracerProvider
NewTracerProvider returns a TracerProvider that does not record any telemetry.
TracerProvider.Tracer
func (TracerProvider) Tracer(string, ...trace.TracerOption) trace.Tracer
Tracer returns an OpenTelemetry Tracer that does not record any telemetry.