fix(inputs.prometheus): Initialize logger of parser (#15021)
This commit is contained in:
parent
71f999fd83
commit
fcb713a0a7
|
|
@ -492,6 +492,7 @@ func (p *Prometheus) gatherURL(u URLAndAddress, acc telegraf.Accumulator) (map[s
|
||||||
Header: resp.Header,
|
Header: resp.Header,
|
||||||
MetricVersion: p.MetricVersion,
|
MetricVersion: p.MetricVersion,
|
||||||
IgnoreTimestamp: p.IgnoreTimestamp,
|
IgnoreTimestamp: p.IgnoreTimestamp,
|
||||||
|
Log: p.Log,
|
||||||
}
|
}
|
||||||
metrics, err := metricParser.Parse(body)
|
metrics, err := metricParser.Parse(body)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,7 @@ func (p *Parser) Parse(data []byte) ([]telegraf.Metric, error) {
|
||||||
data = append(data, []byte("\n")...)
|
data = append(data, []byte("\n")...)
|
||||||
}
|
}
|
||||||
case expfmt.FmtUnknown:
|
case expfmt.FmtUnknown:
|
||||||
p.Log.Warnf("Unknown format %q... Trying to continue...", p.Header.Get("Content-Type"))
|
p.Log.Debugf("Unknown format %q... Trying to continue...", p.Header.Get("Content-Type"))
|
||||||
}
|
}
|
||||||
buf := bytes.NewBuffer(data)
|
buf := bytes.NewBuffer(data)
|
||||||
decoder := expfmt.NewDecoder(buf, format)
|
decoder := expfmt.NewDecoder(buf, format)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue