scrape

package
v0.0.0-...-398e186 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2023 License: BSD-3-Clause, Apache-2.0 Imports: 33 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Appendable

type Appendable interface {
	Appender() (storage.Appender, error)
}

Appendable returns an Appender.

type Manager

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

Manager maintains a set of scrape pools and manages start/stop cycles when receiving new target groups form the discovery manager.

func NewManager

func NewManager(logger log.Logger, app Appendable) *Manager

NewManager is the Manager constructor

func (*Manager) ApplyConfig

func (m *Manager) ApplyConfig(cfg *config.Config) error

ApplyConfig resets the manager's target providers and job configurations as defined by the new cfg.

func (*Manager) Run

func (m *Manager) Run(tsets <-chan map[string][]*targetgroup.Group) error

Run starts background processing to handle target updates and reload the scraping loops.

func (*Manager) Stop

func (m *Manager) Stop()

Stop cancels all running scrape pools and blocks until all have exited.

func (*Manager) TargetsActive

func (m *Manager) TargetsActive() []*Target

TargetsActive returns the active targets currently being scraped.

func (*Manager) TargetsAll

func (m *Manager) TargetsAll() map[string][]*Target

TargetsAll returns active and dropped targets grouped by job_name.

func (*Manager) TargetsDropped

func (m *Manager) TargetsDropped() []*Target

TargetsDropped returns the dropped targets during relabelling.

type Target

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

Target refers to a singular HTTP or HTTPS endpoint.

func NewTarget

func NewTarget(labels, discoveredLabels labels.Labels, params url.Values) *Target

NewTarget creates a reasonably configured target for querying.

func (*Target) DiscoveredLabels

func (t *Target) DiscoveredLabels() labels.Labels

DiscoveredLabels returns a copy of the target's labels before any processing.

func (*Target) Health

func (t *Target) Health() TargetHealth

Health returns the last known health state of the target.

func (*Target) Labels

func (t *Target) Labels() labels.Labels

Labels returns a copy of the set of all public labels of the target.

func (*Target) LastError

func (t *Target) LastError() error

LastError returns the error encountered during the last scrape.

func (*Target) LastScrape

func (t *Target) LastScrape() time.Time

LastScrape returns the time of the last scrape.

func (*Target) SetDiscoveredLabels

func (t *Target) SetDiscoveredLabels(l labels.Labels)

SetDiscoveredLabels sets new DiscoveredLabels

func (*Target) String

func (t *Target) String() string

func (*Target) URL

func (t *Target) URL() *url.URL

URL returns a copy of the target's URL.

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 Targets

type Targets []*Target

Targets is a sortable list of targets.

func (Targets) Len

func (ts Targets) Len() int

func (Targets) Less

func (ts Targets) Less(i, j int) bool

func (Targets) Swap

func (ts Targets) Swap(i, j int)

Jump to

Keyboard shortcuts

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