tracing

package
v0.28.0-alpha.0 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2023 License: Apache-2.0 Imports: 13 Imported by: 24

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ContextWithSpan added in v0.26.0

func ContextWithSpan(ctx context.Context, s *Span) context.Context

ContextWithSpan returns a context with the Span included in the context.

func Propagators

func Propagators() propagation.TextMapPropagator

Propagators returns the recommended set of propagators.

func WithTracing

func WithTracing(handler http.Handler, tp oteltrace.TracerProvider, serviceName string) http.Handler

WithTracing adds tracing to requests if the incoming request is sampled

func WrapperFor

WrapperFor can be used to add tracing to a *rest.Config. Example usage: tp := NewProvider(...) config, _ := rest.InClusterConfig() config.Wrap(WrapperFor(tp)) kubeclient, _ := clientset.NewForConfig(config)

Types

type Span added in v0.26.0

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

Span is a component part of a trace. It represents a single named and timed operation of a workflow being observed. This Span is a combination of an OpenTelemetry and k8s.io/utils/trace span to facilitate the migration to OpenTelemetry.

func SpanFromContext added in v0.26.0

func SpanFromContext(ctx context.Context) *Span

SpanFromContext returns the *Span from the current context. It is composed of the active OpenTelemetry and k8s.io/utils/trace spans.

func Start added in v0.26.0

func Start(ctx context.Context, name string, attributes ...attribute.KeyValue) (context.Context, *Span)

Start creates spans using both OpenTelemetry, and the k8s.io/utils/trace package. It only creates an OpenTelemetry span if the incoming context already includes a span.

func (*Span) AddEvent added in v0.26.0

func (s *Span) AddEvent(name string, attributes ...attribute.KeyValue)

AddEvent adds a point-in-time event with a name and attributes.

func (*Span) End added in v0.26.0

func (s *Span) End(logThreshold time.Duration)

End ends the span, and logs if the span duration is greater than the logThreshold.

type TracerProvider added in v0.26.0

type TracerProvider interface {
	oteltrace.TracerProvider
	Shutdown(context.Context) error
}

TracerProvider is an OpenTelemetry TracerProvider which can be shut down

func NewNoopTracerProvider added in v0.26.0

func NewNoopTracerProvider() TracerProvider

func NewProvider

func NewProvider(ctx context.Context,
	tracingConfig *v1.TracingConfiguration,
	addedOpts []otlptracegrpc.Option,
	resourceOpts []resource.Option,
) (TracerProvider, error)

NewProvider creates a TracerProvider in a component, and enforces recommended tracing behavior

Directories

Path Synopsis
api
v1

Jump to

Keyboard shortcuts

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