Skip to content

Commit 0bdcc12

Browse files
Timestamp fix
1 parent 5908e5b commit 0bdcc12

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

pkg/metrics/gauge.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ type Gauge struct {
1414
labels map[string]string
1515

1616
value float64
17-
timestamp int64
17+
timestamp int64 // timestamp expressed as milliseconds
1818
mutex sync.RWMutex
1919
}
2020

@@ -24,7 +24,7 @@ func (g *Gauge) Set(value float64) {
2424
defer g.mutex.Unlock()
2525

2626
g.value = value
27-
g.timestamp = time.Now().UnixNano() / int64(time.Millisecond)
27+
g.timestamp = time.Now().UnixNano() / 1e6
2828
}
2929

3030
// Exposes the gauge in the text-based exposition format.

0 commit comments

Comments
 (0)