otel

package
v0.27.83 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2026 License: Apache-2.0, MIT Imports: 18 Imported by: 0

Documentation

Overview

Package otel provides OpenTelemetry integration for Skipper.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Init

func Init(ctx context.Context, o *Options) (shutdown func(context.Context) error, err error)

Init bootstraps the OpenTelemetry pipeline using environment variables and provided options. Make sure to call shutdown for proper cleanup if err is nil.

Supported environment variables:

  • OTEL_TRACES_EXPORTER
  • OTEL_EXPORTER_OTLP_PROTOCOL
  • OTEL_EXPORTER_OTLP_ENDPOINT
  • OTEL_EXPORTER_OTLP_HEADERS
  • OTEL_RESOURCE_ATTRIBUTES
  • OTEL_PROPAGATORS
  • OTEL_TRACES_SAMPLER
  • OTEL_TRACES_SAMPLER_ARG
  • OTEL_BSP_MAX_QUEUE_SIZE
  • OTEL_BSP_MAX_EXPORT_BATCH_SIZE
  • OTEL_BSP_SCHEDULE_DELAY
  • OTEL_BSP_EXPORT_TIMEOUT

See:

Types

type BatchSpanProcessor

type BatchSpanProcessor struct {
	ScheduleDelay      time.Duration `yaml:"scheduleDelay"`
	ExportTimeout      time.Duration `yaml:"exportTimeout"`
	MaxQueueSize       int           `yaml:"maxQueueSize"`
	MaxExportBatchSize int           `yaml:"maxExportBatchSize"`
}

type ExporterOtlp

type ExporterOtlp struct {
	Protocol string            `yaml:"protocol"`
	Endpoint string            `yaml:"endpoint"`
	Headers  map[string]string `yaml:"headers"`
}

type Options

type Options struct {
	// Initialized indicates whether the OpenTelemetry pipeline has been initialized externally.
	// If true [Init] returns immediately without doing anything.
	Initialized bool `yaml:"-"`

	TracesExporter     string             `yaml:"tracesExporter"`
	ExporterOtlp       ExporterOtlp       `yaml:"exporterOtlp"`
	ResourceAttributes map[string]string  `yaml:"resourceAttributes"`
	Propagators        []string           `yaml:"propagators"`
	BatchSpanProcessor BatchSpanProcessor `yaml:"batchSpanProcessor"`

	// Sampler configures the Sampler used by the TracerProvider to decide
	// whether a span is recorded and marked as sampled.
	//
	// Supported values, matching the OTEL_TRACES_SAMPLER environment variable:
	//
	//   - always_on
	//   - always_off
	//   - traceidratio
	//   - parentbased_always_on (default)
	//   - parentbased_always_off
	//   - parentbased_traceidratio
	//
	// If empty, the sampler is taken from the OTEL_TRACES_SAMPLER (and
	// OTEL_TRACES_SAMPLER_ARG) environment variables, falling back to the SDK
	// default of parentbased_always_on if those are not set either.
	//
	// Note that "parentbased_*" samplers respect the sampled flag of an
	// incoming traceparent header and will stop sampling (and therefore stop
	// propagating sampled=1) for the rest of the trace once an upstream hop
	// marks it as not sampled. Use "always_on" to make skipper always record
	// and always propagate sampled=1 regardless of the incoming trace context.
	Sampler string `yaml:"sampler"`

	// SamplerArg configures the argument for the Sampler, if applicable.
	// Only used by the "traceidratio" and "parentbased_traceidratio" samplers,
	// where it is the sampling ratio in the range [0.0, 1.0].
	//
	// If empty, the argument is taken from the OTEL_TRACES_SAMPLER_ARG
	// environment variable.
	SamplerArg string `yaml:"samplerArg"`
}

Options configure OpenTelemetry pipeline.

Jump to

Keyboard shortcuts

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