New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Old metrics still visible #48
Comments
Hey @komljen, can you describe a bit more how it got to the current state? Specifically:
My theory is that if an existing |
Yeah, I'm using the RC version and both old and new metrics were available. The stateful set is updated via Helm upgrade, and the previous vulnerability report just got overwritten. When describing it I see new values in there only. I have the same theory. I had to restart the starboard exporter pod to get rid of old metrics. Not sure if there is anything else that we could do in this scenario. |
We likely have to include some diff logic and clear metrics for the previous version if the CR is just updated. Roughly in here. Thanks for bringing it to my attention, I'll take a deeper look and come up with something |
So just to keep this issue up to date, I've looked a bit more into this and don't see a great way forward yet. The problem is that once the report object is updated, we can't reconstruct the vector needed to clear the prometheus metric. I've added a note to this prometheus client issue which would make it possible to clear the old metrics. Aside from official prometheus support, current options seem to be limited to either storing a copy of all those label vectors per-report (which I'd rather not do), clearing ALL metrics (so there would be weird periodic drops in metrics and dashboards, potentially re-triggering alerts, etc.), or just restarting the exporter (which is inelegant). TL;DR - I want to fix this but don't see how quite yet. A workaround is to periodically restart the exporter. Open to suggestions |
I believe the solution is to drop the labels for a specific metric, at least that's what I've done on a previous project which is similar to starboard. My metric looked like this:
Then I was able to do :
If a label can not be removed for a metric, then an error is thrown, which should be fine. Of course, there may be better ways of doing this. I'm only adding this information as it may be interesting. Based on
this may not be possible. |
Deletion based on partial matches is not currently supported by the Go prometheus client, so I've opened prometheus/client_golang#1013 to add this capability |
Update: The upstream fix has been merged, so just waiting on a new release and we can resolve this |
@stone-z thanks a lot! So this is fixed now but just waiting for a new release? |
@philippeckel correct, I've merged a temporary fix to |
@stone-z awesome, thanks a lot! |
The fix for this has been released with v0.5.0 |
I'm using the starboard feature described here https://github.com/giantswarm/starboard-exporter#one-vulnerabilityreport-per-deployment, and even though I don't see old reports anymore with kubectl CLI:
If I go to the metrics endpoint on starboard exporter, I still see metrics like (notice the image tag version):
I guess this is because the report name is not unique in this case, like with replica sets?
The text was updated successfully, but these errors were encountered: