jenkinsci / prometheus-plugin

Jenkins Prometheus Plugin
https://plugins.jenkins.io/prometheus/
Apache License 2.0
181 stars 151 forks source link

Remove Guice + use Singleton to fix initilization potential deadlock #682

Closed Dohbedoh closed 1 month ago

Dohbedoh commented 1 month ago

Fixes #635 . Second attempt... Removed Guice. Using a Singleton with a simple constructor. Collectors get register with the Jenkins initialization milestones. Job related collectors later on when jobs are loaded.

Note that the AsyncPeriodicWork would kick off later on after JOB_CONFIG_ADAPTED https://github.com/jenkinsci/jenkins/blob/jenkins-2.468/core/src/main/java/hudson/model/PeriodicWork.java#L104.

Changes proposed

Checklist

Notify

@Waschndolos

Waschndolos commented 1 month ago

Thank you for the PR! I'll test it in the next couple of days and come back to you

Waschndolos commented 1 month ago

The code looks good. I've installed a version of this PR in our Test instance. No issues so far (but didn't have any in the previous attempt, since I'm using a dockered controller). I'll check the instance further and do another test on a non dockered environment. If that's ok as well we might give it a new try :)

Dohbedoh commented 1 month ago

Sounds good. Thanks @Waschndolos !

Waschndolos commented 1 month ago

@Dohbedoh. Sorry for the delay, my computer died, had to reinstall :+1: I've installed Jenkins on my unix based system without docker and it doesn't show any error, as well as prometheus endpoint is still working. So I think we're good to go. I'll double check the logs in the companies jenkins tomorrow and if they're ok I'll merge it. Thanks again for the fix!

Waschndolos commented 1 month ago

Released with 778.ve1c932a_ff24f