Documentation
¶
Index ¶
- type ActiveTarget
- type Alert
- type Client
- func (c *Client) Alerts() ([]Alert, error)
- func (c *Client) LabelValues(label string, match []string) ([]string, error)
- func (c *Client) Labels(match []string) ([]string, error)
- func (c *Client) Query(query string, evalTime time.Time) ([]VectorSample, error)
- func (c *Client) QueryRange(query string, start, end time.Time, step time.Duration) ([]MatrixSeries, error)
- func (c *Client) Targets(state string) ([]ActiveTarget, error)
- func (c *Client) TestConnection() error
- type MatrixSeries
- type VectorSample
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ActiveTarget ¶
type ActiveTarget struct {
Labels map[string]string `json:"labels"`
DiscoveredLabels map[string]string `json:"discoveredLabels"`
ScrapePool string `json:"scrapePool"`
ScrapeURL string `json:"scrapeUrl"`
LastError string `json:"lastError"`
LastScrape time.Time `json:"lastScrape"`
LastScrapeDuration float64 `json:"lastScrapeDuration"`
Health string `json:"health"`
}
ActiveTarget represents a Prometheus scrape target
type Alert ¶
type Alert struct {
Labels map[string]string `json:"labels"`
Annotations map[string]string `json:"annotations"`
State string `json:"state"`
ActiveAt time.Time `json:"activeAt"`
Value string `json:"value"`
}
Alert represents a Prometheus alert
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client wraps the Prometheus HTTP API
func NewProbeClient ¶
NewProbeClient creates a Prometheus client with a short timeout for connectivity checks
func (*Client) LabelValues ¶
LabelValues returns all values for a given label name.
func (*Client) Labels ¶
Labels returns all label names. Match selectors are optional (e.g. `up{job="foo"}`).
func (*Client) Query ¶
Query executes an instant PromQL query. evalTime may be zero (defaults to server now).
func (*Client) QueryRange ¶
func (c *Client) QueryRange(query string, start, end time.Time, step time.Duration) ([]MatrixSeries, error)
QueryRange executes a range PromQL query.
func (*Client) Targets ¶
func (c *Client) Targets(state string) ([]ActiveTarget, error)
Targets returns scrape targets. State filter can be "active", "dropped", or "any".
func (*Client) TestConnection ¶
TestConnection verifies the Prometheus instance is ready.
type MatrixSeries ¶
type MatrixSeries struct {
Metric map[string]string `json:"metric"`
Values [][2]interface{} `json:"values"`
}
MatrixSeries is a single range-query result (resultType "matrix")
type VectorSample ¶
type VectorSample struct {
Metric map[string]string `json:"metric"`
Value [2]interface{} `json:"value"` // [unix_ts, "string_value"]
}
VectorSample is a single instant-query result (resultType "vector")