From 5fc9e5a0b9fa83f925b62e68783e047b6106869c Mon Sep 17 00:00:00 2001 From: ZverGuy Date: Thu, 5 Nov 2026 02:33:22 +0700 Subject: [PATCH] fix(observability-proxy): pass on only the limit text of a lookup 422 The series-limit refusal of a lookup reached the client with all of cluster vmselect's wrapping, and that context can name vmstorage nodes, the leak the generic 502 had just closed for other errors. The client now gets the message from the limit on. Assisted-by: LLM Signed-off-by: ZverGuy --- internal/observabilityproxy/appscope.go | 5 ++++- internal/observabilityproxy/server_app_test.go | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/internal/observabilityproxy/appscope.go b/internal/observabilityproxy/appscope.go index 561a92ab8..526bd0b52 100644 --- a/internal/observabilityproxy/appscope.go +++ b/internal/observabilityproxy/appscope.go @@ -196,7 +196,10 @@ func lookupRefusal(label string, body io.Reader) *HTTPError { _ = json.NewDecoder(io.LimitReader(body, 64<<10)).Decode(&answer) switch { case strings.Contains(answer.Error, seriesLimitError): - return errorf(http.StatusUnprocessableEntity, "the application's %s lookup: %s", label, answer.Error) + // From the limit on: what precedes it is cluster vmselect's context, + // which can name vmstorage nodes. + limit := answer.Error[strings.Index(answer.Error, seriesLimitError):] + return errorf(http.StatusUnprocessableEntity, "the application's %s lookup: %s", label, limit) case strings.Contains(answer.Error, "timeout exceeded"): return errorf(http.StatusGatewayTimeout, "the application's %s lookup did not answer in time", label) default: diff --git a/internal/observabilityproxy/server_app_test.go b/internal/observabilityproxy/server_app_test.go index 9a56e9e18..52cfaa255 100644 --- a/internal/observabilityproxy/server_app_test.go +++ b/internal/observabilityproxy/server_app_test.go @@ -487,7 +487,7 @@ func TestServerApplicationLookupStoreErrors(t *testing.T) { } // Other store errors may name vmstorage nodes; only the limit // message, which the client can act on, is passed on. - if tc.want != http.StatusUnprocessableEntity && strings.Contains(string(body), "vmstorage") { + if strings.Contains(string(body), "vmstorage") { t.Errorf("the store's error text reached the client: %q", body) } }