chaostoolkit-prometheus
chaostoolkit-prometheus copied to clipboard
Allow unwrapping scalar Prometheus values
Prometheus returns scalar values as strings in order to support NaN
, Inf
, and -Inf
. Unfortunately, this makes it quite difficult to use the Toolkit's jsonpath support to filter based on these scalar values, as jsonpath2 does not perform comparisons between numbers and numbers formatted as strings.
I would like to use the following tolerance to ensure a metric is within a certain range:
{
"type": "jsonpath",
"path": "$.data.result[*][?(@.value[1] > 90)]",
"count": 1,
"target": "stdout"
}
In order to do so, I am currently relying on a custom probe script which will fetch the Prometheus metrics and reformat the scalars represented as strings into floating point values. I think this would be useful functionality to have in the Prometheus extension, and it is easier to implement the change here than in jsonpath2.