Open rafaelweingartner opened 1 month ago
Thanks @pedro-martins !
@pedro-martins and @chungg I have rebased this PR and it is ready for your reviews
Thanks @pedro-martins for your review!
@chungg thanks for your review! I have added the code changes you suggested, and there are some remarks open, which I would like to hear your response before closing them.
This patch is created on top of https://github.com/gnocchixyz/gnocchi/pull/1385, https://github.com/gnocchixyz/gnocchi/pull/1381, https://github.com/gnocchixyz/gnocchi/pull/1387, and https://github.com/gnocchixyz/gnocchi/pull/1388. Therefore, we need to merge them first. Then, the extra commits here will disappear.
While executing some Gnocchi optimizations (https://github.com/gnocchixyz/gnocchi/pull/1307), we noticed that some deleted/removed resources do not have the "ended_at" field with a datetime. This can cause slowness with time, as more and more "zombie" resources are left there, and this has a direct impact in the MySQL queries executed with the aggregates API.
This patch introduces a new parameter called
metric_inactive_after
, which defines for how long a metric can go without receiving new data points until we consider it as inactive. Then, when all metrics of a resource are in inactive state, we can mark/consider the resource as removed.