prometheus/blackbox_exporter

Allow to cache HTTP clients (useful for slow oauth2 probes)

nemobis opened this issue · 0 comments

The default oauth2 module works well, however http.go creates a new client (pconfig.NewClientFromConfig()) for every single probe.

We'd like to cache the client across probes, so that we can reuse authorization tokens and avoid overloading the oauth2 provider. This requires the introduction of some cache expiry method.

For our own internal purposes we're using a patched version which simply creates a new client whenever the probe fails with an HTTP 401 (http.StatusUnauthorized). Not sure whether that's good enough for everyone. We would like to upstream the patch but have little resources for any needed changes.