tracing

package
v2.27.0 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2024 License: Apache-2.0 Imports: 33 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Tracer = otel.Tracer("compose")

Functions

func AddAttributeToSpan added in v2.26.0

func AddAttributeToSpan(ctx context.Context, attr ...attribute.KeyValue)

func EventWrapFuncForErrGroup added in v2.20.2

func EventWrapFuncForErrGroup(ctx context.Context, eventName string, opts SpanOptions, fn func(ctx context.Context) error) func() error

EventWrapFuncForErrGroup invokes a function and records an event, optionally including the returned error as the "exception message" on the event.

This is intended for lightweight usage to wrap errgroup.Group calls where a full span is not desired.

func KeyboardMetrics added in v2.26.0

func KeyboardMetrics(ctx context.Context, enabled, isDockerDesktopActive, isWatchConfigured bool)

func SpanWrapFunc added in v2.20.2

func SpanWrapFunc(spanName string, opts SpanOptions, fn func(ctx context.Context) error) func(context.Context) error

SpanWrapFunc wraps a function that takes a context with a trace.Span, marking the status as codes.Error if the wrapped function returns an error.

The context passed to the function is created from the span to ensure correct propagation.

NOTE: This function is nearly identical to SpanWrapFuncForErrGroup, except the latter is designed specially for convenience with errgroup.Group due to its prevalence throughout the codebase. The code is duplicated to avoid adding even more levels of function wrapping/indirection.

func SpanWrapFuncForErrGroup added in v2.20.2

func SpanWrapFuncForErrGroup(ctx context.Context, spanName string, opts SpanOptions, fn func(ctx context.Context) error) func() error

SpanWrapFuncForErrGroup wraps a function that takes a context with a trace.Span, marking the status as codes.Error if the wrapped function returns an error.

The context passed to the function is created from the span to ensure correct propagation.

NOTE: This function is nearly identical to SpanWrapFunc, except this function is designed specially for convenience with errgroup.Group due to its prevalence throughout the codebase. The code is duplicated to avoid adding even more levels of function wrapping/indirection.

Types

type Metrics added in v2.24.6

type Metrics struct {
	CountExtends        int
	CountIncludesLocal  int
	CountIncludesRemote int
}

type MetricsKey added in v2.24.6

type MetricsKey struct{}

type MuxExporter

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

func (MuxExporter) ExportSpans

func (m MuxExporter) ExportSpans(ctx context.Context, spans []sdktrace.ReadOnlySpan) error

func (MuxExporter) Shutdown

func (m MuxExporter) Shutdown(ctx context.Context) error

type OTLPConfig

type OTLPConfig struct {
	Endpoint string
}

OTLPConfig contains the necessary values to initialize an OTLP client manually.

This supports a minimal set of options based on what is necessary for automatic OTEL configuration from Docker context metadata.

func ConfigFromDockerContext

func ConfigFromDockerContext(st store.Store, name string) (OTLPConfig, error)

ConfigFromDockerContext inspects extra metadata included as part of the specified Docker context to try and extract a valid OTLP client configuration.

type ShutdownFunc

type ShutdownFunc func(ctx context.Context) error

ShutdownFunc flushes and stops an OTEL exporter.

func InitProvider

func InitProvider(dockerCli command.Cli) (ShutdownFunc, error)

func InitTracing

func InitTracing(dockerCli command.Cli) (ShutdownFunc, error)

type SpanOptions added in v2.20.2

type SpanOptions []trace.SpanStartEventOption

SpanOptions is a small helper type to make it easy to share the options helpers between downstream functions that accept slices of trace.SpanStartOption and trace.EventOption.

func ContainerOptions added in v2.20.2

func ContainerOptions(container moby.Container) SpanOptions

ContainerOptions returns common attributes from a Moby container.

For convenience, it's returned as a SpanOptions object to allow it to be passed directly to the wrapping helper methods in this package such as SpanWrapFunc.

func ProjectOptions added in v2.20.2

func ProjectOptions(ctx context.Context, proj *types.Project) SpanOptions

ProjectOptions returns common attributes from a Compose project.

For convenience, it's returned as a SpanOptions object to allow it to be passed directly to the wrapping helper methods in this package such as SpanWrapFunc.

func ServiceOptions added in v2.20.2

func ServiceOptions(service types.ServiceConfig) SpanOptions

ServiceOptions returns common attributes from a Compose service.

For convenience, it's returned as a SpanOptions object to allow it to be passed directly to the wrapping helper methods in this package such as SpanWrapFunc.

func (SpanOptions) EventOptions added in v2.20.2

func (s SpanOptions) EventOptions() []trace.EventOption

func (SpanOptions) SpanStartOptions added in v2.20.2

func (s SpanOptions) SpanStartOptions() []trace.SpanStartOption

Jump to

Keyboard shortcuts

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