mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-11-25 14:28:20 +01:00
vmalert: fix vmalert_remotewrite_send_duration_seconds_total
metric value
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
1d4a0796f4
commit
4c815ed59b
@ -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 New Issue
Block a user