diff --git a/docs/querying/api.md b/docs/querying/api.md index 4e5766c5cd..8ba9b02c63 100644 --- a/docs/querying/api.md +++ b/docs/querying/api.md @@ -694,6 +694,7 @@ It will optionally skip snapshotting data that is only present in the head block ``` POST /api/v1/admin/tsdb/snapshot?skip_head= +PUT /api/v1/admin/tsdb/snapshot?skip_head= ``` ```json @@ -705,10 +706,9 @@ $ curl -XPOST http://localhost:9090/api/v1/admin/tsdb/snapshot } } ``` - The snapshot now exists at `/snapshots/20171210T211224Z-2be650b6d019eb54` -*New in v2.1* +*New in v2.1 and supports PUT from v2.9* ### 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. @@ -717,6 +717,7 @@ If successful, a `204` is returned. ``` POST /api/v1/admin/tsdb/delete_series +PUT /api/v1/admin/tsdb/delete_series ``` URL query parameters: @@ -733,7 +734,7 @@ Example: $ curl -X POST \ -g 'http://localhost:9090/api/v1/admin/tsdb/delete_series?match[]=up&match[]=process_start_time_seconds{job="prometheus"}' ``` -*New in v2.1* +*New in v2.1 and supports PUT from v2.9* ### 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. @@ -742,6 +743,7 @@ If successful, a `204` is returned. ``` POST /api/v1/admin/tsdb/clean_tombstones +PUT /api/v1/admin/tsdb/clean_tombstones ``` This takes no parameters or body. @@ -750,4 +752,4 @@ This takes no parameters or body. $ curl -XPOST http://localhost:9090/api/v1/admin/tsdb/clean_tombstones ``` -*New in v2.1* +*New in v2.1 and supports PUT from v2.9* \ No newline at end of file diff --git a/web/api/v1/api.go b/web/api/v1/api.go index c8d0eb3427..07d31bc4b4 100644 --- a/web/api/v1/api.go +++ b/web/api/v1/api.go @@ -248,6 +248,11 @@ func (api *API) Register(r *route.Router) { r.Post("/admin/tsdb/delete_series", wrap(api.deleteSeries)) r.Post("/admin/tsdb/clean_tombstones", wrap(api.cleanTombstones)) r.Post("/admin/tsdb/snapshot", wrap(api.snapshot)) + + r.Put("/admin/tsdb/delete_series", wrap(api.deleteSeries)) + r.Put("/admin/tsdb/clean_tombstones", wrap(api.cleanTombstones)) + r.Put("/admin/tsdb/snapshot", wrap(api.snapshot)) + } type queryData struct { diff --git a/web/web.go b/web/web.go index 647a2e26b3..41f79e08ac 100644 --- a/web/web.go +++ b/web/web.go @@ -307,7 +307,9 @@ func New(logger log.Logger, o *Options) *Handler { if o.EnableLifecycle { router.Post("/-/quit", h.quit) + router.Put("/-/quit", h.quit) router.Post("/-/reload", h.reload) + router.Put("/-/reload", h.reload) } else { router.Post("/-/quit", func(w http.ResponseWriter, _ *http.Request) { w.WriteHeader(http.StatusForbidden) @@ -320,11 +322,11 @@ func New(logger log.Logger, o *Options) *Handler { } router.Get("/-/quit", func(w http.ResponseWriter, _ *http.Request) { w.WriteHeader(http.StatusMethodNotAllowed) - w.Write([]byte("Only POST requests allowed")) + w.Write([]byte("Only POST or PUT requests allowed")) }) router.Get("/-/reload", func(w http.ResponseWriter, _ *http.Request) { w.WriteHeader(http.StatusMethodNotAllowed) - w.Write([]byte("Only POST requests allowed")) + w.Write([]byte("Only POST or PUT requests allowed")) }) router.Get("/debug/*subpath", serveDebug)