Skip to content

Commit

Permalink
Merge pull request #2024 from CatherineF-dev/set-contentType
Browse files Browse the repository at this point in the history
Only use OpenMetrics and Text in contentType
  • Loading branch information
k8s-ci-robot authored Mar 16, 2023
2 parents b11ec2b + d46edde commit a577a59
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pkg/metricshandler/metrics_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,10 @@ func (m *MetricsHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {

contentType := expfmt.NegotiateIncludingOpenMetrics(r.Header)

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

if m.enableGZIPEncoding {
Expand Down

0 comments on commit a577a59

Please sign in to comment.