target

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: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// PrefixForInvalidLabelName is a prefix string for mark invalid label name become valid
	PrefixForInvalidLabelName = model.ReservedLabelPrefix + "invalid_label_"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ScrapeStatus

type ScrapeStatus struct {
	// LastError save the error string if last scraping is error
	LastError string `json:"lastError"`
	// LastScrape save the time of last scraping
	LastScrape time.Time `json:"lastScrape"`
	// LastScrapeDuration save the seconds duration last scraping spend
	LastScrapeDuration float64 `json:"lastScrapeDuration"`
	// Health it the status of last scraping
	Health scrape.TargetHealth `json:"health"`
	// Series is the avg sample of last 3 times scraping, metrics_relabel_configs will be process
	Series int64 `json:"series"`
	// contains filtered or unexported fields
}

ScrapeStatus contains last scraping status of the target

func NewScrapeStatus

func NewScrapeStatus(series int64) *ScrapeStatus

NewScrapeStatus create a new ScrapeStatus with referential Series

func (*ScrapeStatus) SetScrapeErr

func (t *ScrapeStatus) SetScrapeErr(start time.Time, err error)

SetScrapeErr mark the result of this scraping health will be down if err is not nil health will be up if err is nil

func (*ScrapeStatus) UpdateSamples

func (t *ScrapeStatus) UpdateSamples(s int64)

UpdateSamples statistic target samples info

type Target

type Target struct {
	// Hash is calculated from origin labels before relabel_configs process and the URL of this target
	// see prometheus scrape.Target.hash
	Hash uint64 `json:"hash"`
	// Labels is result of relabel_configs process
	Labels labels.Labels `json:"labels"`
	// Series is reference series of this target, may from target explorer
	Series int64 `json:"series"`
}

Target is a target generate prometheus config

func (*Target) Address

func (t *Target) Address() string

Address return the address from labels

func (*Target) NoParamURL

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

NoParamURL return a url without params

func (*Target) NoReservedLabel

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

NoReservedLabel return the labels without reserved prefix "__"

func (*Target) URL

func (t *Target) URL(cfg *config.ScrapeConfig) *url.URL

URL return the full url of this target, the params of cfg will be add to url

Jump to

Keyboard shortcuts

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