target

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2022 License: Apache-2.0 Imports: 8 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_"

	// StateNormal indicates this target is scraping normally
	StateNormal = ""
	// StateInTransfer indicate this target is in transfer process
	StateInTransfer = "in_transfer"
)

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 load of last 3 times scraping, metrics_relabel_configs will be process
	Series int64 `json:"series"`
	// TotalSeries is the total series in last scraping, without metrics_relabel_configs
	TotalSeries int64 `json:"totalSeries"`
	// TargetState indicate current state of this target
	TargetState string `json:"TargetState"`
	// ScrapeTimes is the times target scraped by this shard
	ScrapeTimes uint64 `json:"ScrapeTimes"`
	// Shards contains ID of shards that is scraping this target
	Shards []string `json:"shards"`
	// LastScrapeStatistics is samples statistics of last scrape
	LastScrapeStatistics *kscrape.StatisticsSeriesResult `json:"-"`
	// contains filtered or unexported fields
}

ScrapeStatus contains last scraping status of the target

func NewScrapeStatus

func NewScrapeStatus(series, total 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) UpdateScrapeResult added in v0.3.0

func (t *ScrapeStatus) UpdateScrapeResult(r *kscrape.StatisticsSeriesResult)

UpdateScrapeResult 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"`
	// TotalSeries is the total series in last scraping, without metrics_relabel_configs
	TotalSeries int64 `json:"totalSeries"`
	// TargetState indicate current state of this target
	TargetState string `json:"TargetState"`
}

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