jenkinsci / prometheus-plugin

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

`default_jenkins_builds_last_build_result` has values reversed in documentation #664

Closed pxenofontos closed 4 months ago

pxenofontos commented 4 months ago

Describe your use-case which is not covered by existing documentation.

In the documentation it is stated that the values of default_jenkins_builds_last_build_result are:

Build status of a job as a boolean value - 0 or 1. Where 0 is: SUCCESS,UNSTABLE and 1: all other States

However in the unit tests for the stated of FAILURE, NOT_BUILT and ABORTED which Im assuming are "all other States" the assertions are Assertions.assertEquals(0.0, collect.get(0).samples.get(0).value); which is contradicting to the above statement in the documentation as 0 should be success.

Similarly, for the states of SUCCESS and UNSTABLE the assertions are Assertions.assertEquals(1.0, collect.get(0).samples.get(0).value); which again are contradicting to the statement in the documentation.

Reference any relevant documentation, other materials or issues/pull requests that can be used for inspiration.

References: SUCCESS and UNSTABLE unit test with 1.0 as assertion -> https://github.com/jenkinsci/prometheus-plugin/blob/b6361cad8748b8759b042aa4ebdebf5ee6c40788/src/test/java/org/jenkinsci/plugins/prometheus/collectors/builds/BuildResultGaugeTest.java#L24

FAILURE, NOT_BUILT and ABORTED unit test with 0.0 as assertion -> https://github.com/jenkinsci/prometheus-plugin/blob/b6361cad8748b8759b042aa4ebdebf5ee6c40788/src/test/java/org/jenkinsci/plugins/prometheus/collectors/builds/BuildResultGaugeTest.java#L84

Are you interested in contributing to the documentation?

No response

Waschndolos commented 4 months ago

I will check thanks