discovery

package
v1.7.1 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2017 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ProvidersFromConfig added in v1.4.0

func ProvidersFromConfig(cfg config.ServiceDiscoveryConfig, logger log.Logger) map[string]TargetProvider

ProvidersFromConfig returns all TargetProviders configured in cfg.

Types

type StaticProvider

type StaticProvider struct {
	TargetGroups []*config.TargetGroup
}

StaticProvider holds a list of target groups that never change.

func NewStaticProvider added in v1.4.0

func NewStaticProvider(groups []*config.TargetGroup) *StaticProvider

NewStaticProvider returns a StaticProvider configured with the given target groups.

func (*StaticProvider) Run

func (sd *StaticProvider) Run(ctx context.Context, ch chan<- []*config.TargetGroup)

Run implements the TargetProvider interface.

type Syncer added in v1.4.0

type Syncer interface {
	Sync([]*config.TargetGroup)
}

Syncer receives updates complete sets of TargetGroups.

type TargetProvider added in v1.4.0

type TargetProvider interface {
	// Run hands a channel to the target provider through which it can send
	// updated target groups.
	// Must returns if the context gets canceled. It should not close the update
	// channel on returning.
	Run(ctx context.Context, up chan<- []*config.TargetGroup)
}

A TargetProvider provides information about target groups. It maintains a set of sources from which TargetGroups can originate. Whenever a target provider detects a potential change, it sends the TargetGroup through its provided channel.

The TargetProvider does not have to guarantee that an actual change happened. It does guarantee that it sends the new TargetGroup whenever a change happens.

TargetProviders should initially send a full set of all discoverable TargetGroups.

type TargetSet added in v1.4.0

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

TargetSet handles multiple TargetProviders and sends a full overview of their discovered TargetGroups to a Syncer.

func NewTargetSet added in v1.4.0

func NewTargetSet(s Syncer) *TargetSet

NewTargetSet returns a new target sending TargetGroups to the Syncer.

func (*TargetSet) Run added in v1.4.0

func (ts *TargetSet) Run(ctx context.Context)

Run starts the processing of target providers and their updates. It blocks until the context gets canceled.

func (*TargetSet) UpdateProviders added in v1.4.0

func (ts *TargetSet) UpdateProviders(p map[string]TargetProvider)

UpdateProviders sets new target providers for the target set.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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