Check parser initialization earlier
This commit is contained in:
parent
6c656d92a0
commit
a55456b56c
|
@ -88,6 +88,10 @@ func (*HTTP) Description() string {
|
||||||
// Gather takes in an accumulator and adds the metrics that the Input
|
// Gather takes in an accumulator and adds the metrics that the Input
|
||||||
// gathers. This is called every "interval"
|
// gathers. This is called every "interval"
|
||||||
func (h *HTTP) Gather(acc telegraf.Accumulator) error {
|
func (h *HTTP) Gather(acc telegraf.Accumulator) error {
|
||||||
|
if h.parser == nil {
|
||||||
|
return errors.New("Parser is not set")
|
||||||
|
}
|
||||||
|
|
||||||
if h.client == nil {
|
if h.client == nil {
|
||||||
tlsCfg, err := internal.GetTLSConfig(
|
tlsCfg, err := internal.GetTLSConfig(
|
||||||
h.SSLCert, h.SSLKey, h.SSLCA, h.InsecureSkipVerify)
|
h.SSLCert, h.SSLKey, h.SSLCA, h.InsecureSkipVerify)
|
||||||
|
@ -170,10 +174,6 @@ func (h *HTTP) gatherURL(
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
if h.parser == nil {
|
|
||||||
return errors.New("Parser is not set")
|
|
||||||
}
|
|
||||||
|
|
||||||
metrics, err := h.parser.Parse(b)
|
metrics, err := h.parser.Parse(b)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
|
Loading…
Reference in New Issue