Incorporate review-feedback

Signed-off-by: Goutham Veeramachaneni <cs14btech11014@iith.ac.in>
This commit is contained in:
Goutham Veeramachaneni 2017-12-05 10:26:06 -06:00
parent 311edc5a38
commit f0599d4dbf
2 changed files with 19 additions and 8 deletions

View file

@ -398,25 +398,33 @@ POST /api/v1/admin/tsdb/snapshot
```json ```json
$ curl -XPOST http://localhost:9090/api/v1/admin/tsdb/snapshot $ 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 `<data-dir>/snapshots/2017-11-30T15:31:59Z-2366f0a55106d6e1` The snapshot now exists at `<data-dir>/snapshots/2017-11-30T15:31:59Z-2366f0a55106d6e1`
*New in v2.1*
### Delete Series ### 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. 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: URL query parameters:
- `match[]=<series_selector>`: Repeated label matcher argument that selects the series to delete. At least one `match[]` argument must be provided. - `match[]=<series_selector>`: Repeated label matcher argument that selects the series to delete. At least one `match[]` argument must be provided.
- `start=<rfc3339 | unix_timestamp>`: Start timestamp. - `start=<rfc3339 | unix_timestamp>`: Start timestamp. Optional and defaults to minimum possible time.
- `end=<rfc3339 | unix_timestamp>`: End timestamp. - `end=<rfc3339 | unix_timestamp>`: 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: Example:
@ -424,12 +432,13 @@ Example:
$ curl -X DELETE \ $ curl -X DELETE \
-g 'http://localhost:9090/api/v1/series?match[]=up&match[]=process_start_time_seconds{job="prometheus"}' -g 'http://localhost:9090/api/v1/series?match[]=up&match[]=process_start_time_seconds{job="prometheus"}'
``` ```
*New in v2.1*
### Clean Tombstones ### 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. 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 POST /api/v1/admin/tsdb/clean_tombstones
``` ```
@ -438,4 +447,6 @@ This takes no parameters or body.
```json ```json
$ curl -XPOST http://localhost:9090/api/v1/admin/tsdb/clean_tombstones $ curl -XPOST http://localhost:9090/api/v1/admin/tsdb/clean_tombstones
``` ```
*New in v2.1*

View file

@ -183,7 +183,7 @@ func (api *API) Register(r *route.Router) {
r.Post("/read", api.ready(prometheus.InstrumentHandler("read", http.HandlerFunc(api.remoteRead)))) r.Post("/read", api.ready(prometheus.InstrumentHandler("read", http.HandlerFunc(api.remoteRead))))
// Admin APIs // 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/clean_tombstones", instr("clean_tombstones", api.cleanTombstones))
r.Post("/admin/tsdb/snapshot", instr("snapshot", api.snapshot)) r.Post("/admin/tsdb/snapshot", instr("snapshot", api.snapshot))
} }