mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2025-02-19 15:30:17 +00:00
vmalert: fix vmalert_remotewrite_send_duration_seconds_total
metric value (#4801)
The deferred call's arguments are evaluated immediately, but the function call is not executed until the surrounding function returns. Signed-off-by: Abirdcfly <fp544037857@gmail.com>
This commit is contained in:
parent
bc5065fd14
commit
835c03fb47
1 changed files with 3 additions and 1 deletions
|
@ -216,7 +216,9 @@ func (c *Client) flush(ctx context.Context, wr *prompbmarshal.WriteRequest) {
|
||||||
retryInterval = maxRetryInterval
|
retryInterval = maxRetryInterval
|
||||||
}
|
}
|
||||||
timeStart := time.Now()
|
timeStart := time.Now()
|
||||||
defer sendDuration.Add(time.Since(timeStart).Seconds())
|
defer func() {
|
||||||
|
sendDuration.Add(time.Since(timeStart).Seconds())
|
||||||
|
}()
|
||||||
L:
|
L:
|
||||||
for attempts := 0; ; attempts++ {
|
for attempts := 0; ; attempts++ {
|
||||||
err := c.send(ctx, b)
|
err := c.send(ctx, b)
|
||||||
|
|
Loading…
Reference in a new issue