From f0599d4dbf6b0ca1e376e64386e426eb869f6820 Mon Sep 17 00:00:00 2001 From: Goutham Veeramachaneni Date: Tue, 5 Dec 2017 10:26:06 -0600 Subject: [PATCH] Incorporate review-feedback Signed-off-by: Goutham Veeramachaneni --- docs/querying/api.md | 25 ++++++++++++++++++------- web/api/v1/api.go | 2 +- 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/docs/querying/api.md b/docs/querying/api.md index 18bbff216..415ec1d30 100644 --- a/docs/querying/api.md +++ b/docs/querying/api.md @@ -398,25 +398,33 @@ POST /api/v1/admin/tsdb/snapshot ```json $ curl -XPOST http://localhost:9090/api/v1/admin/tsdb/snapshot { - "name": "2017-11-30T15:31:59Z-2366f0a55106d6e1" + "status": "success", + "data": { + "name": "2017-11-30T15:31:59Z-2366f0a55106d6e1" + } } ``` The snapshot now exists at `/snapshots/2017-11-30T15:31:59Z-2366f0a55106d6e1` +*New in v2.1* ### Delete Series DeleteSeries deletes data for a selection of series in a time range. The actual data still exists on disk and is cleaned up in future compactions or can be explicitly cleaned up by hitting the Clean Tombstones endpoint. +If successful, a `204` is returned. + ``` -DELETE /api/v1/admin/tsdb/delete_series +POST /api/v1/admin/tsdb/delete_series ``` URL query parameters: - `match[]=`: Repeated label matcher argument that selects the series to delete. At least one `match[]` argument must be provided. -- `start=`: Start timestamp. -- `end=`: End timestamp. +- `start=`: Start timestamp. Optional and defaults to minimum possible time. +- `end=`: End timestamp. Optional and defaults to maximum possible time. + +Not mentioning both start and end times would clear all the data for the matched series in the database. Example: @@ -424,12 +432,13 @@ Example: $ curl -X DELETE \ -g 'http://localhost:9090/api/v1/series?match[]=up&match[]=process_start_time_seconds{job="prometheus"}' ``` - - +*New in v2.1* ### Clean Tombstones CleanTombstones removes the deleted data from disk and cleans up the existing tombstones. This can be used after deleting series to free up space. +If successful, a `204` is returned. + ``` POST /api/v1/admin/tsdb/clean_tombstones ``` @@ -438,4 +447,6 @@ This takes no parameters or body. ```json $ curl -XPOST http://localhost:9090/api/v1/admin/tsdb/clean_tombstones -``` \ No newline at end of file +``` + +*New in v2.1* diff --git a/web/api/v1/api.go b/web/api/v1/api.go index 462e49226..d9a2c5f79 100644 --- a/web/api/v1/api.go +++ b/web/api/v1/api.go @@ -183,7 +183,7 @@ func (api *API) Register(r *route.Router) { r.Post("/read", api.ready(prometheus.InstrumentHandler("read", http.HandlerFunc(api.remoteRead)))) // Admin APIs - r.Del("/admin/tsdb/delete_series", instr("delete_series", api.deleteSeries)) + r.Post("/admin/tsdb/delete_series", instr("delete_series", api.deleteSeries)) r.Post("/admin/tsdb/clean_tombstones", instr("clean_tombstones", api.cleanTombstones)) r.Post("/admin/tsdb/snapshot", instr("snapshot", api.snapshot)) }