Caching doesn't work?
Closed this issue · 2 comments
chr4 commented
I've set the following:
mqtt:
cache:
timeout: 24h
I understood the docs, that this means a queried value will be cached for 24h if no other value is received.
However, that doesn't seem the case. When curling the exporter, the metric shows up only for a minute or so, afterwards disappears.
Skimming the source, I couldn't find anything with c.Get()
, only c.Set()
- but I might be overlooking something here.
Is this a bug? Glad to help out with more details or implemenation!
chr4 commented
Ah, it's using c.cache.Items()
in https://github.com/hikhvar/mqtt2prometheus/blob/master/pkg/metrics/collector.go#L69