Skip to content
Snippets Groups Projects
Unverified Commit 5cb9e239 authored by Anthony Woods's avatar Anthony Woods Committed by GitHub
Browse files

Merge pull request #294 from grafana/fixPromtailReqDurMetric

fix promtail_request_duration metric
parents 23650046 93fbd40e
No related branches found
No related tags found
No related merge requests found
......@@ -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)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment