Documentation
¶
Overview ¶
Package v1 provides bindings to the Prometheus HTTP API v1: http://prometheus.io/docs/querying/api/
Index ¶
Constants ¶
const ( // Possible values for ErrorType. ErrBadData ErrorType = "bad_data" ErrTimeout = "timeout" ErrCanceled = "canceled" ErrExec = "execution" ErrBadResponse = "bad_response" ErrServer = "server_error" ErrClient = "client_error" // Possible values for HealthStatus. HealthGood HealthStatus = "up" HealthUnknown HealthStatus = "unknown" HealthBad HealthStatus = "down" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type API ¶
type API interface {
// AlertManagers returns an overview of the current state of the Prometheus alert manager discovery.
AlertManagers(ctx context.Context) (AlertManagersResult, error)
// CleanTombstones removes the deleted data from disk and cleans up the existing tombstones.
CleanTombstones(ctx context.Context) error
// Config returns the current Prometheus configuration.
Config(ctx context.Context) (ConfigResult, error)
// DeleteSeries deletes data for a selection of series in a time range.
DeleteSeries(ctx context.Context, matches []string, startTime time.Time, endTime time.Time) error
// Flags returns the flag values that Prometheus was launched with.
Flags(ctx context.Context) (FlagsResult, error)
// LabelValues performs a query for the values of the given label.
LabelValues(ctx context.Context, label string) (model.LabelValues, error)
// Query performs a query for the given time.
Query(ctx context.Context, query string, ts time.Time) (model.Value, error)
// QueryRange performs a query for the given range.
QueryRange(ctx context.Context, query string, r Range) (model.Value, error)
// Series finds series by label matchers.
Series(ctx context.Context, matches []string, startTime time.Time, endTime time.Time) ([]model.LabelSet, error)
// Snapshot creates a snapshot of all current data into snapshots/<datetime>-<rand>
// under the TSDB's data directory and returns the directory as response.
Snapshot(ctx context.Context, skipHead bool) (SnapshotResult, error)
// Targets returns an overview of the current state of the Prometheus target discovery.
Targets(ctx context.Context) (TargetsResult, error)
}
API provides bindings for Prometheus's v1 API.
type ActiveTarget ¶
type ActiveTarget struct {
DiscoveredLabels model.LabelSet `json:"discoveredLabels"`
Labels model.LabelSet `json:"labels"`
ScrapeURL string `json:"scrapeUrl"`
LastError string `json:"lastError"`
LastScrape time.Time `json:"lastScrape"`
Health HealthStatus `json:"health"`
}
ActiveTarget models an active Prometheus scrape target.
type AlertManager ¶
type AlertManager struct {
URL string `json:"url"`
}
AlertManager models a configured Alert Manager.
type AlertManagersResult ¶
type AlertManagersResult struct {
Active []AlertManager `json:"activeAlertManagers"`
Dropped []AlertManager `json:"droppedAlertManagers"`
}
AlertManagersResult contains the result from querying the alertmanagers endpoint.
type ConfigResult ¶
type ConfigResult struct {
YAML string `json:"yaml"`
}
ConfigResult contains the result from querying the config endpoint.
type DroppedTarget ¶
DroppedTarget models a dropped Prometheus scrape target.
type FlagsResult ¶
FlagsResult contains the result from querying the flag endpoint.
type HealthStatus ¶
type HealthStatus string
HealthStatus models the health status of a scrape target.
type Range ¶
type Range struct {
// The boundaries of the time range.
Start, End time.Time
// The maximum time between two slices within the boundaries.
Step time.Duration
}
Range represents a sliced time range.
type SnapshotResult ¶
type SnapshotResult struct {
Name string `json:"name"`
}
SnapshotResult contains the result from querying the snapshot endpoint.
type TargetsResult ¶
type TargetsResult struct {
Active []ActiveTarget `json:"activeTargets"`
Dropped []DroppedTarget `json:"droppedTargets"`
}
TargetsResult contains the result from querying the targets endpoint.