From 8d98750e8f47fcc269b0ef7d9aa502255b8172c4 Mon Sep 17 00:00:00 2001 From: Julius Volz Date: Fri, 18 Jun 2021 11:49:30 +0200 Subject: [PATCH] Simplify float formatting for HTTP SD refresh interval (#8961) Signed-off-by: Julius Volz --- discovery/http/http.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/discovery/http/http.go b/discovery/http/http.go index a45b1cdc7..9c6db98a4 100644 --- a/discovery/http/http.go +++ b/discovery/http/http.go @@ -21,6 +21,7 @@ import ( "io/ioutil" "net/http" "net/url" + "strconv" "time" "github.com/go-kit/log" @@ -136,7 +137,7 @@ func (d *Discovery) refresh(ctx context.Context) ([]*targetgroup.Group, error) { } req.Header.Set("User-Agent", userAgent) req.Header.Set("Accept", "application/json") - req.Header.Set("X-Prometheus-Refresh-Interval-Seconds", fmt.Sprintf("%f", d.refreshInterval.Seconds())) + req.Header.Set("X-Prometheus-Refresh-Interval-Seconds", strconv.FormatFloat(d.refreshInterval.Seconds(), 'f', -1, 64)) resp, err := d.client.Do(req.WithContext(ctx)) if err != nil {