API provides bindings for Prometheus's v1 API.
| 250 | |
| 251 | // API provides bindings for Prometheus's v1 API. |
| 252 | type API interface { |
| 253 | // Alerts returns a list of all active alerts. |
| 254 | Alerts(ctx context.Context) (AlertsResult, error) |
| 255 | // AlertManagers returns an overview of the current state of the Prometheus alert manager discovery. |
| 256 | AlertManagers(ctx context.Context) (AlertManagersResult, error) |
| 257 | // CleanTombstones removes the deleted data from disk and cleans up the existing tombstones. |
| 258 | CleanTombstones(ctx context.Context) error |
| 259 | // Config returns the current Prometheus configuration. |
| 260 | Config(ctx context.Context) (ConfigResult, error) |
| 261 | // DeleteSeries deletes data for a selection of series in a time range. |
| 262 | DeleteSeries(ctx context.Context, matches []string, startTime time.Time, endTime time.Time) error |
| 263 | // Flags returns the flag values that Prometheus was launched with. |
| 264 | Flags(ctx context.Context) (FlagsResult, error) |
| 265 | // LabelNames returns all the unique label names present in the block in sorted order. |
| 266 | LabelNames(ctx context.Context) ([]string, Warnings, error) |
| 267 | // LabelValues performs a query for the values of the given label. |
| 268 | LabelValues(ctx context.Context, label string, matches []string) (model.LabelValues, Warnings, error) |
| 269 | // Query performs a query for the given time. |
| 270 | Query(ctx context.Context, query string, ts time.Time) (model.Value, Warnings, error) |
| 271 | // QueryRange performs a query for the given range. |
| 272 | QueryRange(ctx context.Context, query string, r Range) (model.Value, Warnings, error) |
| 273 | // Series finds series by label matchers. |
| 274 | Series(ctx context.Context, matches []string, startTime time.Time, endTime time.Time) ([]model.LabelSet, Warnings, error) |
| 275 | // Snapshot creates a snapshot of all current data into snapshots/<datetime>-<rand> |
| 276 | // under the TSDB's data directory and returns the directory as response. |
| 277 | Snapshot(ctx context.Context, skipHead bool) (SnapshotResult, error) |
| 278 | // Rules returns a list of alerting and recording rules that are currently loaded. |
| 279 | Rules(ctx context.Context) (RulesResult, error) |
| 280 | // Targets returns an overview of the current state of the Prometheus target discovery. |
| 281 | Targets(ctx context.Context) (TargetsResult, error) |
| 282 | // TargetsMetadata returns metadata about metrics currently scraped by the target. |
| 283 | TargetsMetadata(ctx context.Context, matchTarget string, metric string, limit string) ([]MetricMetadata, error) |
| 284 | // Metadata returns metadata about metrics currently scraped by the metric name. |
| 285 | Metadata(ctx context.Context, metric string, limit string) (map[string][]Metadata, error) |
| 286 | } |
| 287 | |
| 288 | // AlertsResult contains the result from querying the alerts endpoint. |
| 289 | type AlertsResult struct { |
no outgoing calls
no test coverage detected