From ac0b7e042152572f47e72d70de5293ed81149f8b Mon Sep 17 00:00:00 2001 From: Aliaksandr Valialkin Date: Fri, 11 Aug 2023 05:04:13 -0700 Subject: [PATCH] Revert "vmui: change the response for active queries (#4782)" This reverts commit 252643d10069efddcd133aa8a58111227caf6034. Reason for revert: the commit incorrectly fixes the the issue. The `remoteAddr` must be properly quoted inside lib/httpserver.GetQuotedRemoteAddr(). It isn't quoted properly if the request contains X-Forwarded-For header. The proper fix will be included in the follow-up commit. Updates https://github.com/VictoriaMetrics/VictoriaMetrics/pull/4676 --- app/vmselect/promql/active_queries.go | 7 +------ docs/CHANGELOG.md | 1 - 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/app/vmselect/promql/active_queries.go b/app/vmselect/promql/active_queries.go index 2ef261b49b..d66058e53b 100644 --- a/app/vmselect/promql/active_queries.go +++ b/app/vmselect/promql/active_queries.go @@ -4,7 +4,6 @@ import ( "fmt" "net/http" "sort" - "strings" "sync" "sync/atomic" "time" @@ -24,12 +23,8 @@ func ActiveQueriesHandler(w http.ResponseWriter, r *http.Request) { fmt.Fprintf(w, `{"status":"ok","data":[`) for i, aqe := range aqes { d := now.Sub(aqe.startTime) - addr := aqe.quotedRemoteAddr - if n := strings.IndexByte(aqe.quotedRemoteAddr, ','); n != -1 { - addr = aqe.quotedRemoteAddr[:n] - } fmt.Fprintf(w, `{"duration":"%.3fs","id":"%016X","remote_addr":%s,"query":%q,"start":%d,"end":%d,"step":%d}`, - d.Seconds(), aqe.qid, addr, aqe.q, aqe.start, aqe.end, aqe.step) + d.Seconds(), aqe.qid, aqe.quotedRemoteAddr, aqe.q, aqe.start, aqe.end, aqe.step) if i+1 < len(aqes) { fmt.Fprintf(w, `,`) } diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index b45c226f0a..eb89962775 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -46,7 +46,6 @@ The following `tip` changes can be tested by building VictoriaMetrics components * BUGFIX: [vmalert](https://docs.victoriametrics.com/vmalert.html): properly set `vmalert_config_last_reload_successful` value on configuration updates or rollbacks. The bug was introduced in [v1.92.0](https://github.com/VictoriaMetrics/VictoriaMetrics/releases/tag/v1.92.0) in [this PR](https://github.com/VictoriaMetrics/VictoriaMetrics/pull/4543). * BUGFIX: [vmalert](https://docs.victoriametrics.com/vmalert.html): fix `vmalert_remotewrite_send_duration_seconds_total` value, before it didn't count in the real time spending on remote write requests. See [this pr](https://github.com/VictoriaMetrics/VictoriaMetrics/pull/4801) for details. * BUGFIX: [vmbackupmanager](https://docs.victoriametrics.com/vmbackupmanager.html): fix panic when creating a backup to a local filesystem on Windows. See [this issue](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/4704). -* BUGFIX: [vmui](https://docs.victoriametrics.com/#vmui): fix the response of active queries to valid JSON. See [this pull request](https://github.com/VictoriaMetrics/VictoriaMetrics/pull/4782). * BUGFIX: [vmagent](https://docs.victoriametrics.com/vmagent.html): keep unmatched series when `remoteWrite.streamAggr.dropInput` is set to `false` to match intended behaviour introduced at [v1.92.0](https://github.com/VictoriaMetrics/VictoriaMetrics/releases/tag/v1.92.0). See [this issue](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/4804).