nginx-lua-prometheus
nginx-lua-prometheus copied to clipboard
feature requirement: new option expiration for recycle the share dict
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.