newrelic / infra-integrations-sdk

New Relic Infrastructure Integrations SDK
Apache License 2.0
46 stars 24 forks source link

[v3] metrics on the a storer file are not garbage collected #294

Closed gsanchezgavier closed 2 years ago

gsanchezgavier commented 2 years ago

Description

There is no mechanism that removes metrics (after a TTL expired) from the storer file used to save this metric into the disk to calculate the deltas on each execution.

On initialization the integrations checks the TTL of the entire file remove it if it has expired. But there are cases where the metric identifiers are based on ephemeral entities causing that new entries to this file are constantly being created and if the integration keeps it's execution normally the current clean up mechanism is never triggered, making this file grow without control and having the integration loading in on each execution.

Expected Behavior

Metrics on the storer should be garbage collected if they are not being updated after a TTL.

Similar thing is done in the Kubernetes integration

Steps to Reproduce

Your Environment

One example happens on nri-varnish where backend entities could be ephemeral in some environments. more context in this issue

Additional context