Documentation
¶
Index ¶
- type Client
- func (c *Client) LabelNames(ctx context.Context) ([]string, error)
- func (c *Client) LabelValues(ctx context.Context, label string) ([]string, error)
- func (c *Client) Query(ctx context.Context, query string, ts time.Time) (*QueryResult, error)
- func (c *Client) QueryRange(ctx context.Context, query string, start, end time.Time, step time.Duration) (*QueryResult, error)
- type MetricResult
- type QueryData
- type QueryResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client wraps the Prometheus API client
func NewClient ¶
NewClient creates a new Prometheus client with the given URL and HTTP client. httpClient is required so callers cannot silently inherit client_golang's default transport (which has no SSRF dial/redirect policy).
func (*Client) LabelNames ¶
LabelNames returns all label names from Prometheus
func (*Client) LabelValues ¶
LabelValues returns all values for a given label name from Prometheus
type MetricResult ¶
type MetricResult struct {
Metric map[string]string `json:"metric"`
Values [][]interface{} `json:"values"`
}
MetricResult represents a single metric with its values
type QueryData ¶
type QueryData struct {
ResultType string `json:"resultType"`
Result []MetricResult `json:"result"`
}
QueryData contains the result type and values
type QueryResult ¶
type QueryResult struct {
Status string `json:"status"`
Data *QueryData `json:"data,omitempty"`
Error string `json:"error,omitempty"`
}
QueryResult represents the result of a Prometheus query
Click to show internal directories.
Click to hide internal directories.