helpful debug

This commit is contained in:
Owen Williams 2024-01-09 13:20:21 -05:00
parent 4608aeeb51
commit 59ea1b115b
1 changed files with 5 additions and 0 deletions

View File

@ -160,11 +160,15 @@ func HandlerForTransactional(reg prometheus.TransactionalGatherer, opts HandlerO
}
var contentType expfmt.Format
if req.Header != nil {
fmt.Println("NEGOTIATE content type received: ", req.Header)
}
if opts.EnableOpenMetrics {
contentType = expfmt.NegotiateIncludingOpenMetrics(req.Header)
} else {
contentType = expfmt.Negotiate(req.Header)
}
fmt.Println("NEGOTIATE deduced content type: ", contentType)
header := rsp.Header()
header.Set(contentTypeHeader, string(contentType))
@ -207,6 +211,7 @@ func HandlerForTransactional(reg prometheus.TransactionalGatherer, opts HandlerO
}
for _, mf := range mfs {
// This is the place where the metric family is getting escaped on the receive side.
if handleError(enc.Encode(mf)) {
return
}