diff --git a/pkg/promtail/client/client.go b/pkg/promtail/client/client.go index 38d7800e58621a3b14b908a6bb7f71c3dc833e94..7f447524b5cb5dc99e39845df7dc0aa1a314e958 100644 --- a/pkg/promtail/client/client.go +++ b/pkg/promtail/client/client.go @@ -154,13 +154,13 @@ func (c *Client) send(batch map[model.Fingerprint]*logproto.Stream) error { start := time.Now() resp, err := http.Post(c.cfg.URL.String(), contentType, bytes.NewReader(buf)) if err != nil { - requestDuration.WithLabelValues("failed").Observe(time.Until(start).Seconds()) + requestDuration.WithLabelValues("failed").Observe(time.Since(start).Seconds()) return err } if err := resp.Body.Close(); err != nil { return err } - requestDuration.WithLabelValues(strconv.Itoa(resp.StatusCode)).Observe(time.Until(start).Seconds()) + requestDuration.WithLabelValues(strconv.Itoa(resp.StatusCode)).Observe(time.Since(start).Seconds()) if resp.StatusCode/100 != 2 { return fmt.Errorf("Error doing write: %d - %s", resp.StatusCode, resp.Status)