Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type StaticProvider ¶
type StaticProvider struct {
TargetGroups []*config.TargetGroup
}
StaticProvider holds a list of target groups that never change.
func NewStaticProvider ¶
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 Target ¶
type Target struct {
// contains filtered or unexported fields
}
Target refers to a singular HTTP or HTTPS endpoint.
func (*Target) Health ¶
func (t *Target) Health() TargetHealth
Health returns the last known health state of the target.
func (*Target) LastScrape ¶
LastScrape returns the time of the last scrape.
func (*Target) MetaLabels ¶
MetaLabels returns a copy of the target's labels before any processing.
type TargetHealth ¶
type TargetHealth string
TargetHealth describes the health state of a target.
const ( HealthUnknown TargetHealth = "unknown" HealthGood TargetHealth = "up" HealthBad TargetHealth = "down" )
The possible health states of a target based on the last performed scrape.
type TargetManager ¶
type TargetManager struct {
// contains filtered or unexported fields
}
TargetManager maintains a set of targets, starts and stops their scraping and creates the new targets based on the target groups it receives from various target providers.
func NewTargetManager ¶
func NewTargetManager(app storage.SampleAppender) *TargetManager
NewTargetManager creates a new TargetManager.
func (*TargetManager) ApplyConfig ¶
func (tm *TargetManager) ApplyConfig(cfg *config.Config) error
ApplyConfig resets the manager's target providers and job configurations as defined by the new cfg. The state of targets that are valid in the new configuration remains unchanged.
func (*TargetManager) Pools ¶
func (tm *TargetManager) Pools() map[string]Targets
Pools returns the targets currently being scraped bucketed by their job name.
func (*TargetManager) Run ¶
func (tm *TargetManager) Run()
Run starts background processing to handle target updates.
type TargetProvider ¶
type TargetProvider interface { // Run hands a channel to the target provider through which it can send // updated target groups. The channel must be closed by the target provider // if no more updates will be sent. // On receiving from done Run must return. 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.
Providers must initially send all known target groups as soon as it can.