Uploaded image for project: 'ZABBIX FEATURE REQUESTS'
  1. ZABBIX FEATURE REQUESTS
  2. ZBXNEXT-5422

Add types autoconversion in JSONPath aggregations

XMLWordPrintable

    • Sprint 56 (Sep 2019), Sprint 57 (Oct 2019), Sprint 58 (Nov 2019)
    • 0.5

      --ZBXNEXT-4502-- brings very powerful aggregation functions such as sum(), min(), max() to be used with numbers.

      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.

            atumilovics Andrejs Tumilovics
            vzhuravlev Vitaly Zhuravlev
            Team C
            Votes:
            3 Vote for this issue
            Watchers:
            10 Start watching this issue

              Created:
              Updated:
              Resolved: