nginx-lua-prometheus icon indicating copy to clipboard operation
nginx-lua-prometheus copied to clipboard

feature requirement: new option expiration for recycle the share dict

Open Sn0rt opened this issue 7 months ago • 11 comments

I found that the implementation of the prometheus library requires manual recycling of the metric if the metric is no longer updated.

I think if nginx-lua-prometheus supports the new option expiration, it means that this metric will be recycled if it is not updated within the specified time.

init_worker_by_lua_block {
   prometheus = require("prometheus").init("prometheus_metrics", {exptime = 360})
}

and exptime default is 0

The optional exptime argument specifies expiration time (in seconds) for the inserted key-value pair. The time resolution is 0.001 seconds. If the exptime takes the value 0 (which is the default), then the item will never expire.

I think it is enough to simply implement it based on share dict.

Sn0rt avatar Dec 25 '23 09:12 Sn0rt