grafana

grafana y axis starting at random value (non zero) when query is filtered by threshold


Grafana y axis starting at random value (non zero) when query is filtered by threshold i.e instance vector filtered by scalar value. Grafana OSS version 9.1.8

E.g I want to see cpu utilisation more than 70%. So I use query like this

(container_cpu_usage_seconds_total{...}/kube_pod_container_resource_requests{...}) > ${CPU_THRESHOLD}

The graph y-axis now starts at random value as below, despite using soft min, soft max enter image description here

When no threshold in the query the y-axis is normal enter image description here


Solution

  • Despite playing with settings we have noticed the UI settings are not saved properly in panel json (when changes are done in UI panel->axis->soft min). These values are different from what we provide in UI (we gave 0 for softmin but saw "axisSoftMin": 0.1 in panel json (see attachment below) enter image description here

    So modified this value to 0 and applied the json and it worked well for us. So we explicitly mentioned below values in panel json.

    "axisSoftMax": 1,
    "axisSoftMin": 0