Skip to content

Commit

Permalink
fix(inputs.consul): Move config checking to Init method
Browse files Browse the repository at this point in the history
  • Loading branch information
Hipska committed Sep 12, 2024
1 parent c4d27b6 commit f43dc4f
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions plugins/inputs/consul/consul.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,12 @@ func (c *Consul) Init() error {
)
}

newClient, err := c.createAPIClient()
if err != nil {
return err
}
c.client = newClient

return nil
}

Expand Down Expand Up @@ -136,16 +142,6 @@ func (c *Consul) GatherHealthCheck(acc telegraf.Accumulator, checks []*api.Healt
}

func (c *Consul) Gather(acc telegraf.Accumulator) error {
if c.client == nil {
newClient, err := c.createAPIClient()

if err != nil {
return err
}

c.client = newClient
}

checks, _, err := c.client.Health().State("any", nil)

if err != nil {
Expand Down

0 comments on commit f43dc4f

Please sign in to comment.