target

package
v0.136.0 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2025 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LabelsHashWithJobName added in v0.127.0

func LabelsHashWithJobName(ls labels.Labels, jobName string) uint64

LabelsHashWithJobName computes a hash of the labels and the job name. Same logic as Prometheus labels.Hash: https://github.com/prometheus/prometheus/blob/8fd46f74aa0155e4d5aa30654f9c02e564e03743/model/labels/labels.go#L72 but adds in the job name since this is not in the labelset from the discovery manager. The scrape manager adds it later. Address is already included in the labels, so it is not needed here.

Types

type Discoverer

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

func NewDiscoverer

func NewDiscoverer(log logr.Logger, manager *discovery.Manager, hook discoveryHook, scrapeConfigsUpdater scrapeConfigsUpdater, setTargets func(targets []*Item)) (*Discoverer, error)

func (*Discoverer) ApplyConfig

func (m *Discoverer) ApplyConfig(source allocatorWatcher.EventSource, scrapeConfigs []*promconfig.ScrapeConfig) error

func (*Discoverer) Close

func (m *Discoverer) Close()

func (*Discoverer) Reload

func (m *Discoverer) Reload()

Reload triggers a reload of the scrape configs. This will process the target groups and update the targets concurrently.

func (*Discoverer) Run

func (m *Discoverer) Run() error

func (*Discoverer) UpdateTsets

func (m *Discoverer) UpdateTsets(tsets map[string][]*targetgroup.Group)

UpdateTsets updates the target sets to be scraped.

type Item

type Item struct {
	JobName       string
	TargetURL     string
	Labels        labels.Labels
	CollectorName string
	// contains filtered or unexported fields
}

Item represents a target to be scraped.

func NewItem

func NewItem(jobName string, targetURL string, labels labels.Labels, collectorName string) *Item

NewItem Creates a new target item. INVARIANTS: * Item fields must not be modified after creation.

func (*Item) GetEndpointSliceName added in v0.129.1

func (t *Item) GetEndpointSliceName() string

GetEndpointSliceName returns the name of the EndpointSlice that the target is part of. If the target is not part of an EndpointSlice, it returns an empty string.

func (*Item) GetNodeName

func (t *Item) GetNodeName() string

func (*Item) Hash

func (t *Item) Hash() ItemHash

type ItemHash added in v0.121.0

type ItemHash uint64

func (ItemHash) String added in v0.129.1

func (h ItemHash) String() string

Jump to

Keyboard shortcuts

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