From 31c48e2ef0b7a02d7f815b1e5067ea03366efac1 Mon Sep 17 00:00:00 2001 From: SungJin1212 Date: Sun, 12 Oct 2025 16:09:12 +0900 Subject: [PATCH 1/2] Change prw2 push success response code Signed-off-by: SungJin1212 --- CHANGELOG.md | 1 + pkg/util/push/push.go | 1 + pkg/util/push/push_test.go | 10 +++++----- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9880c3c6d2b..3c98ee31b7b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ * [CHANGE] StoreGateway/Alertmanager: Add default 5s connection timeout on client. #6603 * [CHANGE] Ingester: Remove EnableNativeHistograms config flag and instead gate keep through new per-tenant limit at ingestion. #6718 * [CHANGE] Validate a tenantID when to use a single tenant resolver. #6727 +* [CHANGE] Distributor: Change remote write 2.0 push success response code to 204. # 7050 * [FEATURE] Distributor: Add an experimental `-distributor.otlp.enable-type-and-unit-labels` flag to add `__type__` and `__unit__` labels for OTLP metrics. #6969 * [FEATURE] Distributor: Add an experimental `-distributor.otlp.allow-delta-temporality` flag to ingest delta temporality otlp metrics. #6934 * [FEATURE] Query Frontend: Add dynamic interval size for query splitting. This is enabled by configuring experimental flags `querier.max-shards-per-query` and/or `querier.max-fetched-data-duration-per-query`. The split interval size is dynamically increased to maintain a number of shards and total duration fetched below the configured values. #6458 diff --git a/pkg/util/push/push.go b/pkg/util/push/push.go index f380c4eb9b6..aea9e1ad796 100644 --- a/pkg/util/push/push.go +++ b/pkg/util/push/push.go @@ -114,6 +114,7 @@ func Handler(remoteWrite2Enabled bool, maxRecvMsgSize int, sourceIPs *middleware http.Error(w, string(resp.Body), int(resp.Code)) } else { setPRW2RespHeader(w, resp.Samples, resp.Histograms, resp.Exemplars) + w.WriteHeader(http.StatusNoContent) } } diff --git a/pkg/util/push/push_test.go b/pkg/util/push/push_test.go index 03d94d92dc2..9d06987c1cb 100644 --- a/pkg/util/push/push_test.go +++ b/pkg/util/push/push_test.go @@ -231,7 +231,7 @@ func TestHandler_remoteWrite(t *testing.T) { req := createRequest(t, createPrometheusRemoteWriteV2Protobuf(t), true) resp := httptest.NewRecorder() handler.ServeHTTP(resp, req) - assert.Equal(t, http.StatusOK, resp.Code) + assert.Equal(t, http.StatusNoContent, resp.Code) // test header value respHeader := resp.Header() @@ -258,7 +258,7 @@ func TestHandler_ContentTypeAndEncoding(t *testing.T) { "Content-Encoding": "snappy", remoteWriteVersionHeader: "2.0.0", }, - expectedCode: http.StatusOK, + expectedCode: http.StatusNoContent, isV2: true, }, { @@ -321,7 +321,7 @@ func TestHandler_ContentTypeAndEncoding(t *testing.T) { "Content-Type": appProtoV2ContentType, remoteWriteVersionHeader: "2.0.0", }, - expectedCode: http.StatusOK, + expectedCode: http.StatusNoContent, isV2: true, }, { @@ -330,7 +330,7 @@ func TestHandler_ContentTypeAndEncoding(t *testing.T) { "Content-Type": appProtoV2ContentType, "Content-Encoding": "snappy", }, - expectedCode: http.StatusOK, + expectedCode: http.StatusNoContent, isV2: true, }, { @@ -375,7 +375,7 @@ func TestHandler_cortexWriteRequest(t *testing.T) { req := createRequest(t, createCortexRemoteWriteV2Protobuf(t, false, cortexpb.API), true) resp := httptest.NewRecorder() handler.ServeHTTP(resp, req) - assert.Equal(t, 200, resp.Code) + assert.Equal(t, http.StatusNoContent, resp.Code) }) } From e59f7e1853d5b522b3ab9b1b44d5ab999575a895 Mon Sep 17 00:00:00 2001 From: SungJin1212 Date: Sun, 12 Oct 2025 16:10:03 +0900 Subject: [PATCH 2/2] delete change log Signed-off-by: SungJin1212 --- CHANGELOG.md | 1 - 1 file changed, 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3c98ee31b7b..9880c3c6d2b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,6 @@ * [CHANGE] StoreGateway/Alertmanager: Add default 5s connection timeout on client. #6603 * [CHANGE] Ingester: Remove EnableNativeHistograms config flag and instead gate keep through new per-tenant limit at ingestion. #6718 * [CHANGE] Validate a tenantID when to use a single tenant resolver. #6727 -* [CHANGE] Distributor: Change remote write 2.0 push success response code to 204. # 7050 * [FEATURE] Distributor: Add an experimental `-distributor.otlp.enable-type-and-unit-labels` flag to add `__type__` and `__unit__` labels for OTLP metrics. #6969 * [FEATURE] Distributor: Add an experimental `-distributor.otlp.allow-delta-temporality` flag to ingest delta temporality otlp metrics. #6934 * [FEATURE] Query Frontend: Add dynamic interval size for query splitting. This is enabled by configuring experimental flags `querier.max-shards-per-query` and/or `querier.max-fetched-data-duration-per-query`. The split interval size is dynamically increased to maintain a number of shards and total duration fetched below the configured values. #6458