From fc19994db0f1c4c626edf96fd1be3d7ecf1d2a32 Mon Sep 17 00:00:00 2001 From: istae <14264581+istae@users.noreply.github.com> Date: Mon, 11 Dec 2023 15:30:56 +0300 Subject: [PATCH] fix: metric fix --- pkg/check/networkavailability/check.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pkg/check/networkavailability/check.go b/pkg/check/networkavailability/check.go index db6a7f77b..6f29222cb 100644 --- a/pkg/check/networkavailability/check.go +++ b/pkg/check/networkavailability/check.go @@ -117,11 +117,11 @@ iteration: if err != nil { c.logger.Errorf("upload failed to neighborhood %s: %v", n, err) c.metrics.UploadErrors.Inc() - c.metrics.UploadDuration.WithLabelValues("false").Observe(float64(time.Since(t))) + c.metrics.UploadDuration.WithLabelValues("false").Observe(time.Since(t).Seconds()) } else if !resp.Equal(ch.Address()) { c.logger.Errorf("uploaded chunk and response addresses do no match, uploaded %s, downloaded %s", ch, resp) } else { - c.metrics.UploadDuration.WithLabelValues("true").Observe(float64(time.Since(t))) + c.metrics.UploadDuration.WithLabelValues("true").Observe(time.Since(t).Seconds()) chunks = append(chunks, ch) } } @@ -137,12 +137,12 @@ iteration: data, err := downloadClient.DownloadChunk(ctx, ch.Address(), "") if err != nil { c.metrics.DownloadErrors.Inc() - c.metrics.DownloadDuration.WithLabelValues("false").Observe(float64(time.Since(t))) + c.metrics.DownloadDuration.WithLabelValues("false").Observe(time.Since(t).Seconds()) c.logger.Errorf("download failed: %v", err) } else if !bytes.Equal(data, ch.Data()) { c.logger.Errorf("uploaded chunk and response data do no match for chunk_address %s", ch.Address()) } else { - c.metrics.DownloadDuration.WithLabelValues("true").Observe(float64(time.Since(t))) + c.metrics.DownloadDuration.WithLabelValues("true").Observe(time.Since(t).Seconds()) } }