fix undefined: expfmt.FmtText

This commit is contained in:
Ryan Hamphrey 2024-05-28 15:40:22 +00:00
parent 78f44e53d5
commit d70500c7bb
1 changed files with 2 additions and 2 deletions

View File

@ -153,14 +153,14 @@ func (m *Metrics) gatherPrometheus() (GatherResponse, error) {
buf := &bytes.Buffer{}
defer buf.Reset()
e := expfmt.NewEncoder(buf, expfmt.FmtText)
e := expfmt.NewEncoder(buf, expfmt.NewFormat(expfmt.TypeTextPlain))
for _, mf := range metricsFamilies {
if err := e.Encode(mf); err != nil {
return GatherResponse{}, fmt.Errorf("failed to encode prometheus metrics: %w", err)
}
}
return GatherResponse{ContentType: string(expfmt.FmtText), Metrics: buf.Bytes()}, nil
return GatherResponse{ContentType: string(expfmt.NewFormat(expfmt.TypeTextPlain)), Metrics: buf.Bytes()}, nil
}
func (m *Metrics) gatherGeneric() (GatherResponse, error) {