Export timestamps in seconds since epoch.

Signed-off-by: Tom Wilkie <tom.wilkie@gmail.com>
This commit is contained in:
Tom Wilkie 2019-02-12 14:11:43 +00:00 committed by Tom Wilkie
parent 84df210c41
commit 37ad4db485
3 changed files with 4 additions and 4 deletions

View file

@ -126,7 +126,7 @@ var (
Namespace: namespace, Namespace: namespace,
Subsystem: subsystem, Subsystem: subsystem,
Name: "queue_highest_sent_timestamp", Name: "queue_highest_sent_timestamp",
Help: "Timestamp from a WAL sample, the highest timestamp successfully sent by this queue.", Help: "Timestamp from a WAL sample, the highest timestamp successfully sent by this queue, in seconds since epoch.",
}, },
[]string{queue}, []string{queue},
) )
@ -524,7 +524,7 @@ func (t *QueueManager) setHighestSentTimestamp(highest int64) {
defer t.timestampLock.Unlock() defer t.timestampLock.Unlock()
if highest > t.highestSentTimestamp { if highest > t.highestSentTimestamp {
t.highestSentTimestamp = highest t.highestSentTimestamp = highest
t.highestSentTimestampMetric.Set(float64(t.highestSentTimestamp)) t.highestSentTimestampMetric.Set(float64(t.highestSentTimestamp) / 1000.)
} }
} }

View file

@ -71,7 +71,7 @@ func NewStorage(l log.Logger, reg prometheus.Registerer, stCallback startTimeCal
}), }),
highestTimestampMetric: prometheus.NewGauge(prometheus.GaugeOpts{ highestTimestampMetric: prometheus.NewGauge(prometheus.GaugeOpts{
Name: "prometheus_remote_storage_highest_timestamp_in", Name: "prometheus_remote_storage_highest_timestamp_in",
Help: "Highest timestamp that has come into the remote storage via the Appender interface.", Help: "Highest timestamp that has come into the remote storage via the Appender interface, in seconds since epoch.",
}), }),
} }
reg.MustRegister(s.samplesInMetric) reg.MustRegister(s.samplesInMetric)

View file

@ -55,7 +55,7 @@ func (t *timestampTracker) Commit() error {
defer t.storage.highestTimestampMtx.Unlock() defer t.storage.highestTimestampMtx.Unlock()
if t.highestTimestamp > t.storage.highestTimestamp { if t.highestTimestamp > t.storage.highestTimestamp {
t.storage.highestTimestamp = t.highestTimestamp t.storage.highestTimestamp = t.highestTimestamp
t.storage.highestTimestampMetric.Set(float64(t.highestTimestamp)) t.storage.highestTimestampMetric.Set(float64(t.highestTimestamp) / 1000.)
} }
return nil return nil
} }