Documentation ¶
Index ¶
- func Relabel(labels clientmodel.LabelSet, cfgs ...*config.RelabelConfig) (clientmodel.LabelSet, error)
- type StaticProvider
- type Target
- func (t *Target) BaseLabels() clientmodel.LabelSet
- func (t *Target) Ingest(s clientmodel.Samples) error
- func (t *Target) InstanceIdentifier() string
- func (t *Target) RunScraper(sampleAppender storage.SampleAppender)
- func (t *Target) Status() *TargetStatus
- func (t *Target) StopScraper()
- func (t *Target) String() string
- func (t *Target) URL() string
- func (t *Target) Update(cfg *config.ScrapeConfig, baseLabels clientmodel.LabelSet)
- type TargetHealth
- type TargetManager
- type TargetProvider
- type TargetStatus
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Relabel ¶
func Relabel(labels clientmodel.LabelSet, cfgs ...*config.RelabelConfig) (clientmodel.LabelSet, error)
Relabel returns a relabeled copy of the given label set. The relabel configurations are applied in order of input. If a label set is dropped, nil is returned.
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(ch chan<- *config.TargetGroup)
Run implements the TargetProvider interface.
func (*StaticProvider) Sources ¶
func (sd *StaticProvider) Sources() (srcs []string)
TargetGroups returns the provider's target groups.
func (*StaticProvider) Stop ¶
func (sd *StaticProvider) Stop()
Stop implements the TargetProvider interface.
type Target ¶
type Target struct { // Mutex protects the members below. sync.RWMutex // contains filtered or unexported fields }
Target refers to a singular HTTP or HTTPS endpoint.
func NewTarget ¶
func NewTarget(cfg *config.ScrapeConfig, baseLabels clientmodel.LabelSet) *Target
NewTarget creates a reasonably configured target for querying.
func (*Target) BaseLabels ¶
func (t *Target) BaseLabels() clientmodel.LabelSet
BaseLabels returns a copy of the target's base labels.
func (*Target) Ingest ¶
func (t *Target) Ingest(s clientmodel.Samples) error
Ingest implements an extraction.Ingester.
func (*Target) InstanceIdentifier ¶
InstanceIdentifier returns the identifier for the target.
func (*Target) RunScraper ¶
func (t *Target) RunScraper(sampleAppender storage.SampleAppender)
RunScraper implements Target.
func (*Target) Status ¶
func (t *Target) Status() *TargetStatus
Status returns the status of the target.
func (*Target) Update ¶
func (t *Target) Update(cfg *config.ScrapeConfig, baseLabels clientmodel.LabelSet)
Update overwrites settings in the target that are derived from the job config it belongs to.
type TargetHealth ¶
type TargetHealth int
TargetHealth describes the health state of a target.
const ( // Unknown is the state of a Target before it is first scraped. HealthUnknown TargetHealth = iota // Healthy is the state of a Target that has been successfully scraped. HealthGood // Unhealthy is the state of a Target that was scraped unsuccessfully. HealthBad )
func (TargetHealth) String ¶
func (t TargetHealth) String() string
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(sampleAppender storage.SampleAppender) *TargetManager
NewTargetManager creates a new TargetManager.
func (*TargetManager) ApplyConfig ¶
func (tm *TargetManager) ApplyConfig(cfg *config.Config)
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][]*Target
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 { // Sources returns the source identifiers the provider is currently aware of. Sources() []string // 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. Run(chan<- *config.TargetGroup) // Stop terminates any potential computation of the target provider. The // channel received on Run must be closed afterwards. Stop() }
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. On startup it sends all TargetGroups it can see.
func ProvidersFromConfig ¶
func ProvidersFromConfig(cfg *config.ScrapeConfig) []TargetProvider
ProvidersFromConfig returns all TargetProviders configured in cfg.
type TargetStatus ¶
type TargetStatus struct {
// contains filtered or unexported fields
}
TargetStatus contains information about the current status of a scrape target.
func (*TargetStatus) Health ¶
func (ts *TargetStatus) Health() TargetHealth
Health returns the last known health state of the target.
func (*TargetStatus) LastError ¶
func (ts *TargetStatus) LastError() error
LastError returns the error encountered during the last scrape.
func (*TargetStatus) LastScrape ¶
func (ts *TargetStatus) LastScrape() time.Time
LastScrape returns the time of the last scrape.