Skip to content

Commit 2a06c45

Browse files
committed
fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fix: fallback to gauge for protofmt-based negotiations
1 parent 8e7b38d commit 2a06c45

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

pkg/metricshandler/metrics_handler.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,8 +188,8 @@ func (m *MetricsHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
188188

189189
contentType := expfmt.NegotiateIncludingOpenMetrics(r.Header)
190190

191-
// Assume text/plain if no Content-Type header is set.
192-
if contentType == expfmt.FmtUnknown {
191+
// We do not support protobuf at the moment. Fall back to FmtText if the negotiated exposition format is not FmtOpenMetrics See: https://github.com/kubernetes/kube-state-metrics/issues/2022.
192+
if contentType != expfmt.FmtOpenMetrics_1_0_0 && contentType != expfmt.FmtOpenMetrics_0_0_1 {
193193
contentType = expfmt.FmtText
194194
}
195195
resHeader.Set("Content-Type", string(contentType))

0 commit comments

Comments
 (0)