mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-11-21 14:44:00 +00:00
app/vmselect: protect /tags/delSeries
with -deleteAuthKey
in the same way as /api/v1/admin/tsdb/delete_series
This commit is contained in:
parent
fb8e56d8a2
commit
a724dde90a
1 changed files with 6 additions and 1 deletions
|
@ -23,7 +23,7 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
deleteAuthKey = flag.String("deleteAuthKey", "", "authKey for metrics' deletion via /api/v1/admin/tsdb/delete_series")
|
deleteAuthKey = flag.String("deleteAuthKey", "", "authKey for metrics' deletion via /api/v1/admin/tsdb/delete_series and /tags/delSeries")
|
||||||
maxConcurrentRequests = flag.Int("search.maxConcurrentRequests", getDefaultMaxConcurrentRequests(), "The maximum number of concurrent search requests. "+
|
maxConcurrentRequests = flag.Int("search.maxConcurrentRequests", getDefaultMaxConcurrentRequests(), "The maximum number of concurrent search requests. "+
|
||||||
"It shouldn't be high, since a single request can saturate all the CPU cores. See also -search.maxQueueDuration")
|
"It shouldn't be high, since a single request can saturate all the CPU cores. See also -search.maxQueueDuration")
|
||||||
maxQueueDuration = flag.Duration("search.maxQueueDuration", 10*time.Second, "The maximum time the request waits for execution when -search.maxConcurrentRequests "+
|
maxQueueDuration = flag.Duration("search.maxQueueDuration", 10*time.Second, "The maximum time the request waits for execution when -search.maxConcurrentRequests "+
|
||||||
|
@ -321,6 +321,11 @@ func RequestHandler(w http.ResponseWriter, r *http.Request) bool {
|
||||||
return true
|
return true
|
||||||
case "/tags/delSeries":
|
case "/tags/delSeries":
|
||||||
graphiteTagsDelSeriesRequests.Inc()
|
graphiteTagsDelSeriesRequests.Inc()
|
||||||
|
authKey := r.FormValue("authKey")
|
||||||
|
if authKey != *deleteAuthKey {
|
||||||
|
httpserver.Errorf(w, r, "invalid authKey %q. It must match the value from -deleteAuthKey command line flag", authKey)
|
||||||
|
return true
|
||||||
|
}
|
||||||
if err := graphite.TagsDelSeriesHandler(startTime, w, r); err != nil {
|
if err := graphite.TagsDelSeriesHandler(startTime, w, r); err != nil {
|
||||||
graphiteTagsDelSeriesErrors.Inc()
|
graphiteTagsDelSeriesErrors.Inc()
|
||||||
httpserver.Errorf(w, r, "error in %q: %s", r.URL.Path, err)
|
httpserver.Errorf(w, r, "error in %q: %s", r.URL.Path, err)
|
||||||
|
|
Loading…
Reference in a new issue