Metrics collected are not reset on each page load
When pulling up the metric page, the metrics displayed are not refreshed on each page load.
For example, I have a function that returns 1 metric with an id. It is getting this id and metric from an API (within a container) and whenever that API is restarted, an new id is returned. This allows me to get stats from a container but keep them specific to that container.
examplemetric{id=1} 0
The API was restarted so it now has an id=2. The next time the page is opened and the function is ran, only the id=2 is returned but the PowershellExporter page still displays the metric where id=1. It now looks like this:
examplemetric{id=1} 0 examplemetric{id=2} 0
Prometheus scrapes the page and stores both metrics.
Every time the page is loaded and the function is ran, the list of metrics should be recreated. It appears to be persisting when that metric is not returned in the Powershell function. The only way to clear the metrics is on a service restart.
Oh that's unfortunate. It seems we need unit tests for this. Do you want to contribute them? :-)