Every Kapacitor client (`github.com/influxdata/kapacitor/client/v1`)
instantiates its own `http.Transport`, unless one is provided. A
`http.Transport` will cache socket connections for future use, which
leaves connections open.
Chronograf creates a new Kapacitor client upon every request for several
endpoints. Thus each time these endpoints were hit, new connections
would be opened but never closed until Chronograf is shut down.
These changes pass a singleton `http.Transport` when creating new
Kapacitor clients, so that connections are reused while Chronograf is
running.
Kapacitor responses are paginated, and sometimes users have more than
the default 100 tasks that are returned from Kapacitor. This replaces
the previous Kapa client with one that automatically follows paginated
responses from Kapacitor's ListTasks endpoint and returns the full
response.
Tests for the KapacitorRulesGet endpoint had to be updated because they
did not account for "limit" and "offset", and so led to an infinite
loop with the paginated client. A correct kapacitor backend will not
have this behavior