Fix TTL bug

lastRegistredAt element was only set at creation of a time series.
Now it is updated every time a new event is seen for that time series.

Signed-off-by: Cedric Den Haese <cedric.den.haese@gmail.com>
This commit is contained in:
Cedric Den Haese 2019-07-08 09:21:08 +01:00
parent d56b864f83
commit ccd86002cf
No known key found for this signature in database
GPG key ID: 21C5D1AF1D0DA6C0

View file

@ -169,6 +169,8 @@ func (r *registry) get(metricName string, hash labelHash, metricType metricType)
rm, ok := metric.metrics[hash.values] rm, ok := metric.metrics[hash.values]
if ok { if ok {
now := clock.Now()
rm.lastRegisteredAt = now
return metric.vectors[hash.names].holder, rm.metric return metric.vectors[hash.names].holder, rm.metric
} }