Skip to content
This repository has been archived by the owner on Nov 1, 2022. It is now read-only.

Export image data as Prometheus metrics #2793

Closed
ricoberger opened this issue Jan 28, 2020 · 3 comments
Closed

Export image data as Prometheus metrics #2793

ricoberger opened this issue Jan 28, 2020 · 3 comments

Comments

@ricoberger
Copy link

Describe the feature

Flux already handles automatic updates of new version very nice. For some third party images which are running in a cluster it could be possible to disable automation. By default Flux also checks these images for new version and expose the data via the /api/flux/v6/images endpoint.

It would be nice to also expose these data as Prometheus metrics, so a user can create notification for new image versions. This is helpful for third party images where a user disabled the automation, but wants to stay updated for new versions.

What would the new user story look like?

The user can scrape the metrics via the already existing /metrics endpoint. The exported metrics can look as follows:

flux_available_images_total{name="grafana"} 2
flux_new_available_images_total{name="grafana"} 1
flux_filtered_images_total{name="grafana"} 2
flux_new_filtered_images_total{name="grafana"} 1

The metrics can be scraped by Prometheus and a user can create rules and send notifications via Alertmanager, when for exampleflux_new_filtered_images_total is larger than 0.

If this sound like a useful feature to you, I can also try to come up with a PR.

@ricoberger ricoberger added blocked-needs-validation Issue is waiting to be validated before we can proceed enhancement labels Jan 28, 2020
@2opremio
Copy link
Contributor

2opremio commented Feb 3, 2020

I am not opposed to these idea but could you define the metrics? What's new or filtered depends on the workload and I am not sure we want to publish that per workload.

@2opremio 2opremio removed the blocked-needs-validation Issue is waiting to be validated before we can proceed label Feb 3, 2020
@ricoberger
Copy link
Author

Hi, publishing these metrics per workload can be to much. Maybe it's possible to only publish the following metrics:

  • flux_new_available_images_total{name="grafana"} 1: The number of new available images found by Flux. name is the name of the container.
  • flux_new_filtered_images_total{name="grafana"} 1: If I get it right this is the number of new images found by Flux and filtered by the fluxcd.io/tag.grafana: "semver:~6" annotation. This would only be useful if this number is also different when fluxcd.io/automated is set to false, because if not updates would be automated anyway.

To reduce the amount of exported metrics, it would also possible to only export one metric flux_update_available_info{name="grafana"} 1 which is 1 if NewAvailableImagesCount or NewFilteredImagesCount from the API endpoint is larger then 0. Which would be enough to create a notification for an available update.

@kingdonb
Copy link
Member

kingdonb commented Feb 26, 2021

Flux v1 is in maintenance mode now, and is not adding any new features unless they are critical. This is a really interesting use case and I encourage you to check out the Notification Controller in Flux v2, as well as the new metrics that are available.

I am honestly not sure if this has been addressed by Flux v2, though I wouldn't think so from a brief reading and surface understanding of what you're trying to do. I think the developers would be receptive to a feature request, especially if you are willing to contribute a PR. I would also encourage you to open a discussion on the new repo if you are considering making a change. I don't know the status of your Flux deploys, but if you've been following our development efforts then of course we hope you are able to upgrade, here's more info on how to find support with that: https://fluxcd.io/support/

As Flux contrib efforts have been focused on Flux v2, the Flux project has moved to a new repo, fluxcd/flux2

In the interest of reducing the number of open issues not directly related to supporting Flux v1 in maintenance mode, and respecting you may have moved on already, I will go ahead and close out this issue for now.

If you have a use case for Flux that isn't covered well in the new Flux v2 (which is a total rewrite), we definitely want to hear about it! Thanks again for your contribution.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants