Skip to content

Commit

Permalink
measuring sync time
Browse files Browse the repository at this point in the history
Signed-off-by: Pedro Tanaka <[email protected]>
  • Loading branch information
pedro-stanaka committed Sep 21, 2024
1 parent 6ce682f commit 57a8f0e
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion pkg/exporter/air_monitor_lite.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@ import (
"github.com/efficientgo/core/runutil"
"github.com/go-kit/log"
"github.com/go-kit/log/level"
"github.com/pedro-stanaka/qingping_exporter/pkg/client"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/promauto"

"github.com/pedro-stanaka/qingping_exporter/pkg/client"
)

const DeviceModel = "CGDN1"
Expand Down Expand Up @@ -144,6 +145,9 @@ func (a *AirMonitorLite) sync() error {
level.Info(a.logger).Log("msg", "starting sync loop")
defer level.Info(a.logger).Log("msg", "sync loop finished")

timer := prometheus.NewTimer(a.m.syncDuration.WithLabelValues("total"))
defer timer.ObserveDuration()

devices, err := a.client.GetDeviceList()
if err != nil {
level.Error(a.logger).Log("msg", "failed to get device list", "err", err)
Expand Down

0 comments on commit 57a8f0e

Please sign in to comment.