discovery

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2022 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type SDTargets

type SDTargets struct {
	// Job if the jobName of this target
	Job string
	// ShardTarget is the target for shard sidecar to generate prometheus config
	ShardTarget *target.Target
	// PromTarget is the target of prometheus lib
	PromTarget *scrape.Target
}

SDTargets represent a target has be processed with job relabel_configs every SDTargets contains a target use for shard sidecar to generate prometheus config and a prometheus scrape target for api /api/v1/targets

type TargetsDiscovery

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

TargetsDiscovery manager the active targets and dropped targets use SD manager from prometheus lib it will maintains shard.Target and scrape.Target together

func New

New create a new TargetsDiscovery

func (*TargetsDiscovery) ActiveTargets

func (m *TargetsDiscovery) ActiveTargets() map[string][]*SDTargets

ActiveTargets return a copy map of global active targets the

func (*TargetsDiscovery) ActiveTargetsByHash added in v0.0.5

func (m *TargetsDiscovery) ActiveTargetsByHash() map[uint64]*SDTargets

ActiveTargetsByHash return a map that with the key of target hash

func (*TargetsDiscovery) ActiveTargetsChan

func (m *TargetsDiscovery) ActiveTargetsChan() <-chan map[string][]*SDTargets

ActiveTargetsChan return an channel for notify active SDTargets updated

func (*TargetsDiscovery) ApplyConfig

func (m *TargetsDiscovery) ApplyConfig(cfg *prom.ConfigInfo) error

ApplyConfig save new scrape config

func (*TargetsDiscovery) DropTargets

func (m *TargetsDiscovery) DropTargets() map[string][]*SDTargets

DropTargets return a copy map of global dropped targets the

func (*TargetsDiscovery) Run

func (m *TargetsDiscovery) Run(ctx context.Context, sdChan <-chan map[string][]*targetgroup.Group) error

Run receive prometheus service discovery result and update global active SDTargets and dropped SDTargets the active SDTargets of one process will be send to activeTargetsChan

func (*TargetsDiscovery) WaitInit added in v0.0.3

func (m *TargetsDiscovery) WaitInit(ctx context.Context) error

WaitInit block until all job's sd done

Jump to

Keyboard shortcuts

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