options

package
v0.14.5 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2026 License: Apache-2.0 Imports: 20 Imported by: 6

Documentation

Overview

Package options provides a shared interface to common probe options.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AdditionalLabel added in v0.10.5

type AdditionalLabel struct {
	Key string
	// contains filtered or unexported fields
}

AdditionalLabel encapsulates additional labels to attach to probe results.

func ParseAdditionalLabel added in v0.11.4

func ParseAdditionalLabel(alpb *configpb.AdditionalLabel) *AdditionalLabel

ParseAdditionalLabel parses an additional label proto message into an AdditionalLabel struct.

func (*AdditionalLabel) KeyValueForTarget added in v0.10.5

func (al *AdditionalLabel) KeyValueForTarget(ep endpoint.Endpoint) (key, val string)

KeyValueForTarget returns key, value pair for the given target.

func (*AdditionalLabel) UpdateForTarget added in v0.10.5

func (al *AdditionalLabel) UpdateForTarget(ep endpoint.Endpoint, ipAddr string, probePort int)

UpdateForTarget updates addtional label based on target's name and labels.

type Options

type Options struct {
	Name                string
	Targets             targets.Targets
	Interval, Timeout   time.Duration
	Logger              *logger.Logger
	ProbeConf           interface{} // Probe-type specific config
	LatencyDist         *metrics.Distribution
	LatencyUnit         time.Duration
	LatencyMetricName   string
	Validators          []*validators.Validator
	SourceIP            net.IP
	IPVersion           int
	StatsExportInterval time.Duration
	AdditionalLabels    []*AdditionalLabel
	Schedule            *Schedule
	NegativeTest        bool
	AlertHandlers       []*alerting.AlertHandler
	// TargetsUpdateInterval overrides the default scheduler target update
	// interval (1 minute). Set from probe's targets_update_sec if configured.
	TargetsUpdateInterval time.Duration
	// Prober config at the prober initialization time. This config is not
	// reliable for things that may change after initialization, e.g. probes
	// that can be added or removed through gRPC.
	ProberConfig *proberconfigpb.ProberConfig
	// contains filtered or unexported fields
}

Options encapsulates common probe options.

func BuildProbeOptions added in v0.10.2

func BuildProbeOptions(p *configpb.ProbeDef, ldLister endpoint.Lister, proberConfig *proberconfigpb.ProberConfig, l *logger.Logger) (*Options, error)

BuildProbeOptions builds probe's options using the provided config and some global params.

func DefaultOptions added in v0.11.4

func DefaultOptions() *Options

DefaultOptions returns default options, capturing default values for the various fields.

func ValidateProbeConfig added in v0.14.3

func ValidateProbeConfig(p *configpb.ProbeDef) (*Options, error)

ValidateProbeConfig validates the probe configuration fields without creating targets or other resources, and returns a partial Options with the fields that can be derived from the proto config alone. This is used by ConfigTest to catch config errors like improperly formatted duration strings, and by BuildProbeOptions to avoid re-parsing the same fields.

func (*Options) IsScheduled added in v0.13.3

func (opts *Options) IsScheduled() bool

func (*Options) LogMetrics added in v0.10.2

func (opts *Options) LogMetrics(em *metrics.EventMetrics)

func (*Options) RecordMetrics added in v0.13.0

func (opts *Options) RecordMetrics(ep endpoint.Endpoint, em *metrics.EventMetrics, dataChan chan<- *metrics.EventMetrics)

RecordMetrics updates EventMetrics with additional labels and pushes it to the data channel and alert handlers. It also logs EventMetrics if configured to do so in the options. Note: RecordMetrics doesn't clone the provided EventMetrics. It expects the caller to not modify it after calling this function.

func (*Options) StatsExportFrequency added in v0.14.0

func (opts *Options) StatsExportFrequency() int64

StatsExportFrequency returns how often to export metrics (in probe counts), initialized to statsExportInterval / p.opts.Interval. Metrics are exported when (runCnt % statsExportFrequency) == 0

type Schedule added in v0.13.3

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

func NewSchedule added in v0.13.3

func NewSchedule(scheds []*configpb.Schedule, l *logger.Logger) (*Schedule, error)

Jump to

Keyboard shortcuts

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