Documentation ¶
Overview ¶
Package prometheus contains code to access prometheus api.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AlertFilterFunc ¶
AlertFilterFunc is a function to filter alerts. If function returns true service is selected else omitted.
func AlertByJob ¶
func AlertByJob(r *regexp.Regexp) AlertFilterFunc
AlertByJob filters Alerts by job.
func AlertByName ¶
func AlertByName(r *regexp.Regexp) AlertFilterFunc
AlertByName filters Alerts by job.
func AlertByServer ¶
func AlertByServer(r *regexp.Regexp) AlertFilterFunc
AlertByServer filters Alerts by prometheus server.
func AlertByState ¶
func AlertByState(state v1.AlertState) AlertFilterFunc
AlertByState filters Alerts by health.
type Alerts ¶
type Alerts []Alert
Alerts is a slice of prometheus alerts.
func (Alerts) Filter ¶
func (a Alerts) Filter(filters ...AlertFilterFunc) Alerts
Filter filters Alerts with AlertFilterFunc.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a prometheus API client·
type TargetFilterFunc ¶
TargetFilterFunc is a function to filter targets. If function returns true service is selected else omitted.
func TargetByHealth ¶
func TargetByHealth(health v1.HealthStatus) TargetFilterFunc
TargetByHealth filters Targets by health.
func TargetByJob ¶
func TargetByJob(r *regexp.Regexp) TargetFilterFunc
TargetByJob filters Targets by job.
func TargetByScrapeURL ¶
func TargetByScrapeURL(r *regexp.Regexp) TargetFilterFunc
TargetByScrapeURL filters Targets by scrape url.
func TargetBySelector ¶
func TargetBySelector(selector labels.Selector) TargetFilterFunc
TargetBySelector filters Services by Selector.
func TargetByServer ¶
func TargetByServer(r *regexp.Regexp) TargetFilterFunc
TargetByServer filters Targets by prometheus server.
type Targets ¶
type Targets []Target
Targets is a slice of prometheus targets.
func (Targets) Active ¶
func (t Targets) Active() []*v1.ActiveTarget
Active returns the active targets.
func (Targets) Compact ¶
func (t Targets) Compact()
Compact removes labels and last error information.
func (Targets) Deduplicate ¶
Deduplicate deduplicates targets by scrape url. If identical targets have different health status, then HealthBad status has highest priority. Multiple sources are appended in the sourceLabelName label.
func (Targets) Filter ¶
func (t Targets) Filter(filters ...TargetFilterFunc) Targets
Filter filters Targets with TargetFilterFunc.