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
|
||||
// gathers. This is called every "interval"
|
||||
func (h *HTTP) Gather(acc telegraf.Accumulator) error {
|
||||
if h.parser == nil {
|
||||
return errors.New("Parser is not set")
|
||||
}
|
||||
|
||||
if h.client == nil {
|
||||
tlsCfg, err := internal.GetTLSConfig(
|
||||
h.SSLCert, h.SSLKey, h.SSLCA, h.InsecureSkipVerify)
|
||||
|
@ -170,10 +174,6 @@ func (h *HTTP) gatherURL(
|
|||
return err
|
||||
}
|
||||
|
||||
if h.parser == nil {
|
||||
return errors.New("Parser is not set")
|
||||
}
|
||||
|
||||
metrics, err := h.parser.Parse(b)
|
||||
if err != nil {
|
||||
return err
|
||||
|
|
Loading…
Reference in New Issue