Skip to content

Commit a577a59

Browse files
authored
Merge pull request #2024 from CatherineF-dev/set-contentType
Only use OpenMetrics and Text in contentType
2 parents b11ec2b + d46edde commit a577a59

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

pkg/metricshandler/metrics_handler.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,10 @@ func (m *MetricsHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
187187

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

190+
// 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
191+
if contentType != expfmt.FmtOpenMetrics {
192+
contentType = expfmt.FmtText
193+
}
190194
resHeader.Set("Content-Type", string(contentType))
191195

192196
if m.enableGZIPEncoding {

0 commit comments

Comments
 (0)