Skip to content

Commit b420f24

Browse files
committed
fix(distributor): relax content-type check
We used to allow content type == text/plain for Prometheus remote write v1 push. Let's continue to not impact users. Signed-off-by: György Krajcsovits <[email protected]>
1 parent dc13127 commit b420f24

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@
9595
* [BUGFIX] Querier: fix issue where `label_join` could incorrectly return multiple series with the same labels rather than failing with `vector cannot contain metrics with the same labelset`. https://github.com/prometheus/prometheus/pull/15975 #10826
9696
* [BUGFIX] Querier: fix issue where counter resets on native histograms could be incorrectly under- or over-counted when using subqueries. https://github.com/prometheus/prometheus/pull/15987 #10871
9797
* [BUGFIX] OTLP: Fix response body and Content-Type header to align with spec. #10852
98+
* [BUGFIX] Distributor: do not reject Prometheus remote write 1.0 with wrong content-type. #10916
9899

99100
### Mixin
100101

pkg/distributor/push.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,9 @@ func isRemoteWrite2(r *http.Request) (bool, error) {
251251
}
252252
parts := strings.Split(contentType, ";")
253253
if parts[0] != appProtoContentType {
254-
return false, fmt.Errorf("expected %v as the first (media) part, got %v content-type", appProtoContentType, contentType)
254+
// We didn't use to check the content type so if someone wrote for
255+
// example text/plain here, we'll accept and assume it is v1.
256+
return false, nil
255257
}
256258

257259
// Parse potential https://www.rfc-editor.org/rfc/rfc9110#parameter

0 commit comments

Comments
 (0)