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

Add types autoconversion in JSONPath aggregations

    Details

    • Team:
      Team D
    • Sprint:
      Sprint 56 (Sep 2019), Sprint 57 (Oct 2019)
    • Story Points:
      0.5

      Description

      --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.

        Attachments

          Activity

            People

            • Assignee:
              martins-v Martins Valkovskis
              Reporter:
              vzhuravlev Vitaly Zhuravlev
            • Votes:
              3 Vote for this issue
              Watchers:
              11 Start watching this issue

              Dates

              • Created:
                Updated: