sampling

package
v0.19.0-alpha Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// Samplers is a map of sampler IDs to their configuration.
	Samplers map[SamplerID]SamplerConfig
	// ActiveSampler is the ID of the currently active sampler.
	// The active sampler id must be one of the keys in the samplers map.
	// Each sampler can reference other samplers in their configuration by their ID.
	// When referencing another sampler, the ID must be one of the keys in the samplers map.
	ActiveSampler SamplerID
}

Config holds the configuration for the eBPF samplers.

func DefaultConfig

func DefaultConfig() *Config

type Manager

type Manager struct {
	ActiveSamplerMap *ebpf.Map
	// contains filtered or unexported fields
}

Manager is used to configure the samplers used by eBPF.

func NewSamplingManager

func NewSamplingManager(c *ebpf.Collection, conf *Config) (*Manager, error)

NewSamplingManager creates a new Manager from the given eBPF collection with the given configuration.

type ParentBasedConfig

type ParentBasedConfig struct {
	Root             SamplerID
	RemoteSampled    SamplerID
	RemoteNotSampled SamplerID
	LocalSampled     SamplerID
	LocalNotSampled  SamplerID
}

ParentBasedConfig holds the configuration for the ParentBased sampler.

func DefaultParentBasedSampler

func DefaultParentBasedSampler() ParentBasedConfig

type SamplerConfig

type SamplerConfig struct {
	SamplerType SamplerType
	Config      any
}

SamplerConfig holds the configuration for a specific sampler. data for samplers is a union of all possible sampler configurations. the size of the data is fixed, and the actual configuration is stored in the first part of the data. the rest of the data is padding to make sure the size is fixed.

func (*SamplerConfig) MarshalBinary

func (sc *SamplerConfig) MarshalBinary() ([]byte, error)

func (*SamplerConfig) UnmarshalBinary

func (sc *SamplerConfig) UnmarshalBinary(data []byte) error

type SamplerID

type SamplerID uint32

SamplerID is a unique identifier for a sampler. It is used as a key in the samplers config map, and as a value in the active sampler map. In addition samplers can reference other samplers in their configuration by their ID.

const (
	AlwaysOnID     SamplerID = 0
	AlwaysOffID    SamplerID = 1
	TraceIDRatioID SamplerID = 2
	ParentBasedID  SamplerID = 3
)

The spec-defined samplers have a constant ID, and are always available.

type SamplerType

type SamplerType uint64

SamplerType defines the type of a sampler.

const (
	SamplerAlwaysOn SamplerType = iota
	SamplerAlwaysOff
	SamplerTraceIDRatio
	SamplerParentBased
)

OpenTelemetry spec-defined samplers.

type TraceIDRatioConfig

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

func NewTraceIDRatioConfig

func NewTraceIDRatioConfig(ratio float64) (TraceIDRatioConfig, error)

Jump to

Keyboard shortcuts

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