Werk #15662: Bug fixes for cmk.gui.plugins.metrics.utils.indexed_color
|Title||Bug fixes for <tt>cmk.gui.plugins.metrics.utils.indexed_color</tt>|
|Date||Apr 27, 2023|
|Checkmk Edition||Checkmk Raw (CRE)|
|Checkmk Version||2.3.0b1 2.2.0b6|
|Compatibility||Incompatible - Manual interaction might be required|
This werk is mainly relevant to users who deploy or develop custom Checkmk plugins. For all other users, the werk might result in some changes regarding the colors of certain metrics in graphs.
The above mentioned function, also available via cmk.gui.plugins.metrics.indexed_color, computes colors for graphs. It was buggy in multiple ways:
- There was no validation of the input arguments idx and total. We now ensure that 0 <= idx <= total and total > 0. If these requirements are violated, an error is raised.
- indexed_color crashed for certain (valid) parameter combinations. For small values of idx, indexed_color returns values from a fixed set of pre-defined colors. Once this set was exhausted, the function crashed if idx was close to total.
- Depending on the value of total, indexed_color produced very dark colors after exhausting the pre-defined set. Instead, we now always start with the same brightness and then then become successively darker.