-
Change Request
-
Resolution: Fixed
-
Minor
-
4.2.5, 4.4.0alpha2
-
Sprint 56 (Sep 2019), Sprint 57 (Oct 2019), Sprint 58 (Nov 2019)
-
0.5
---- brings very powerful aggregation functions such as sum(), min(), max() to be used with numbers.ZBXNEXT-4502
But the problem is, sometimes numeric values are still wrapped in quotes in JSON, so actually of type JSON string. For example, "value" attribute returned from 'Prometheus to JSON'
Adding simple attempt to autoconvert such values would make extremely easy to aggregate such values on fly with JSONPath.
Simple example:
[ {"value":"123"}, {"value":"123"} ]
and JSONPath $.*['value'].sum() gives error now.
Expected:
Values sum is returned.
Prometheus to JSON example:
[{"name":"node_cpu_seconds_total","value":"69659.16","line_raw":"node_cpu_seconds_total{cpu=\"0\",mode=\"idle\"} 69659.16","labels":{"cpu":"0","mode":"idle"},"type":"counter","help":"Seconds the cpus spent in each mode."},{"name":"node_cpu_seconds_total","value":"69581.05","line_raw":"node_cpu_seconds_total{cpu=\"1\",mode=\"idle\"} 69581.05","labels":{"cpu":"1","mode":"idle"},"type":"counter","help":"Seconds the cpus spent in each mode."}]
and JSONPath $.*['value'].sum() gives error now.
Expected:
Values (cpu idle time) sum is returned.