discovery

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2020 License: Apache-2.0 Imports: 18 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 {
	// 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) 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 *config.Config) 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