Bug 1866928

Summary: Native dashboards do not support valueMaps in singlestat panels
Product: OpenShift Container Platform Reporter: Stavros Kontopoulos <skontopo>
Component: Management ConsoleAssignee: Robb Hamilton <rhamilto>
Status: CLOSED ERRATA QA Contact: Yadan Pei <yapei>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 4.5CC: jokerman, pkrupa, spadgett, yapei
Target Milestone: ---Keywords: Reopened
Target Release: 4.6.0   
Hardware: All   
OS: All   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Cause: The web console does not support Grafana valueMaps for singlestat panels. Consequence: singlestat panels are unable to display Grafana valueMaps. Fix: Add support for Grafana valueMaps to singlestat panels. Result: singlestat panels can display Grafana valueMaps.
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-10-27 16:26:23 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Stavros Kontopoulos 2020-08-06 20:30:28 UTC
Description of problem:

Native dashboards dont support valueMaps for singlestat panels.


Version-Release number of selected component (if applicable):


How reproducible:


Steps to Reproduce:
1. Setup crc 4.5.1.

Create a custom configmap with the required contents:

apiVersion: v1
kind: ConfigMap
metadata:
  name: grafana-dashboard-definition-knative-health-2
  namespace: openshift-config-managed
  labels:
    console.openshift.io/dashboard: "true"
data:
  revision-dashboard.json: |+
    {
      "__inputs": [
        {
          "description": "",
          "label": "prometheus",
          "name": "prometheus",
          "pluginId": "prometheus",
          "pluginName": "Prometheus",
          "type": "datasource"
        }
      ],
      "annotations": {
        "list": []
      },
      "editable": false,
      "description" : "Knative Health status - Serving",
      "gnetId": null,
      "graphTooltip": 0,
      "links": [],
      "panels": [
         {
           "cacheTimeout": null,
           "colorBackground": false,
           "colorValue": false,
           "colors": [
             "rgba(245, 54, 54, 0.9)",
               "rgba(237, 129, 40, 0.89)",
               "rgba(50, 172, 45, 0.97)"
             ],
           "datasource": "prometheus",
           "editable": false,
           "error": false,
           "format": "none",
           "gauge": {
             "maxValue": 1,
             "minValue": 0,
             "show": false,
             "thresholdLabels": false,
             "thresholdMarkers": true
           },
           "id": 29,
           "interval": null,
           "isNew": true,
           "links": [],
           "mappingType": 1,
           "mappingTypes": [
               {
                 "name": "value to text",
                 "value": 1
               },
               {
                 "name": "range to text",
                 "value": 2
               }
            ],
            "maxDataPoints": 100,
            "nullPointMode": "connected",
            "nullText": null,
            "postfix": "",
            "postfixFontSize": "50%",
            "prefix": "",
            "prefixFontSize": "50%",
            "rangeMaps": [
               {
                 "from": "null",
                 "text": "N/A",
                 "to": "null"
               }
            ],
            "span": 12,
            "sparkline": {
                 "fillColor": "rgba(31, 118, 189, 0.18)",
                 "full": false,
                 "lineColor": "rgb(31, 120, 193)",
                 "show": false
            },
            "targets": [
               {
                 "expr": "sum(knative_up{namespace=\"$namespace\", service=\"knative-openshift-metrics\", type=\"serving_status\"})",
                 "intervalFactor": 2,
                 "legendFormat": "",
                 "metric": "knative_up",
                 "refId": "A",
                 "step": 20
               }
            ],
            "thresholds": "",
            "title": "Knative Status",
            "type": "singlestat",
            "valueFontSize": "200%",
            "valueMaps": [
                 {
                   "op": "=",
                   "text": "N/A",
                   "value": "null"
                 },
                 {
                   "op": "=",
                   "text": "Healthy",
                   "value": "1"
                 },
                 {
                   "op": "=",
                   "text": "Unhealthy",
                   "value": "0"
                 }
            ],
            "valueName": "current"
         },
        {
          "aliasColors": {},
          "bars": false,
          "dashLength": 10,
          "dashes": false,
          "datasource": "prometheus",
          "fieldConfig": {
            "defaults": {
              "custom": {}
            },
            "overrides": []
          },
          "fill": 1,
          "fillGradient": 0,
          "gridPos": {
            "h": 9,
            "w": 12,
            "x": 0,
            "y": 0
          },
          "hiddenSeries": false,
          "id": 2,
          "legend": {
            "avg": false,
            "current": false,
            "max": false,
            "min": false,
            "show": true,
            "total": false,
            "values": false
          },
          "lines": true,
          "linewidth": 1,
          "span": 6,
          "nullPointMode": "null",
          "percentage": false,
          "pluginVersion": "7.1.0",
          "pointradius": 2,
          "points": false,
          "renderer": "flot",
          "seriesOverrides": [],
          "spaceLength": 10,
          "stack": false,
          "steppedLine": false,
          "targets": [
            {
              "expr": "knative_up{namespace=\"$namespace\", service=\"knative-openshift-metrics\", type=\"serving_status\"}",
              "format": "time_series",
              "interval": "",
              "legendFormat": "Serving status - 1 is up, 0 is down",
              "refId": "A"
            }
          ],
          "thresholds": [],
          "timeFrom": null,
          "timeRegions": [],
          "timeShift": null,
          "title": "Knative Health Status - Serving",
          "tooltip": {
            "shared": true,
            "none": 0,
            "value_type": "individual"
          },
          "type": "graph",
          "xaxis": {
            "buckets": null,
            "mode": "time",
            "name": null,
            "show": true,
            "values": []
          },
          "yaxes": [
            {
              "format": "none",
              "label": null,
              "decimals": 0,
              "logBase": 1,
              "max": 1,
              "min": 0,
              "show": true
            },
            {
              "format": "none",
              "label": null,
              "decimals": 0,
              "logBase": 1,
              "max": 1,
              "min": 0,
              "show": true
            }
          ],
          "yaxis": {
            "align": false,
            "alignLevel": null
          }
        },
        {
          "aliasColors": {},
          "bars": false,
          "dashLength": 10,
          "dashes": false,
          "datasource": "prometheus",
          "fieldConfig": {
           "defaults": {
           "custom": {}
          },
          "overrides": []
          },
       "fill": 1,
       "fillGradient": 0,
       "gridPos": {
         "h": 9,
         "w": 12,
         "x": 0,
         "y": 0
       },
       "hiddenSeries": false,
       "id": 2,
       "legend": {
         "avg": false,
         "current": false,
         "max": false,
         "min": false,
         "show": true,
         "total": false,
         "values": false
       },
       "lines": true,
       "linewidth": 1,
       "nullPointMode": "null",
       "percentage": false,
       "pluginVersion": "7.1.0",
       "pointradius": 2,
       "points": false,
       "renderer": "flot",
       "span": 6,
       "seriesOverrides": [],
       "spaceLength": 10,
       "stack": false,
       "steppedLine": false,
       "targets": [
         {
           "expr": "knative_up{namespace=\"$namespace\", service=\"knative-openshift-metrics\", type=\"eventing_status\"}",
           "format": "time-series",
           "interval": "",
           "legendFormat": "Eventing status - 1 is up, 0 is down",
           "refId": "B"
         }
       ],
       "thresholds": [],
       "timeFrom": null,
       "timeRegions": [],
       "timeShift": null,
       "title": "Knative Health Status - Eventing",
       "tooltip": {
         "shared": true,
         "sort": 0,
         "value_type": "individual"
       },
       "type": "graph",
       "xaxis": {
         "buckets": null,
         "mode": "time",
         "name": null,
         "show": true,
         "values": []
       },
       "yaxes": [
         {
           "format": "none",
           "label": null,
           "logBase": 1,
           "max": 1,
           "min": 0,
           "show": false
         },
         {
           "format": "none",
           "label": null,
           "logBase": 1,
           "max": 1,
           "min": 0,
           "show": false
         }
       ],
       "yaxis": {
       "align": false,
       "alignLevel": null
      }
      }
     ],
     "schemaVersion": 26,
     "style": "dark",
      "tags": [],
      "templating": {
         "list": [
          {
            "allValue": null,
            "current": {},
            "datasource": "prometheus",
            "hide": 0,
            "includeAll": false,
            "label": "Namespace",
            "multi": false,
            "name": "namespace",
            "options": [],
            "query": "label_values(knative_up{namespace!=\"unknown\"}, namespace)",
            "refresh": 1,
            "regex": "",
            "skipUrlSync": false,
            "sort": 1,
            "tagValuesQuery": "",
            "tags": [],
            "tagsQuery": "",
            "type": "query",
            "useTags": false
           }
        ]
      },
      "timepicker": {
        "refresh_intervals": [
          "5s",
          "10s",
          "30s",
          "1m",
          "5m",
          "15m",
          "30m",
          "1h",
          "2h",
          "1d"
        ],
        "time_options": [
          "5m",
          "15m",
          "1h",
          "6h",
          "12h",
          "24h",
          "2d",
          "7d",
          "30d"
        ]
      },
      "timezone": "",
      "title": "Knative Health Status",
      "uid": "bhpVnWVMz",
      "version": 1
    }

2. Apply the cm:
oc apply -f dah.yaml -n openshift-config-managed

3. Go to the ui and click montiroing ->  dashboards select your dashboard.

Actual results:

If the value of the metrics is 1 it should show Healthy however it never maps
the value to the text. Instead it shows 1.

Expected results:


It should map the value to the corresponding text as described in this part:
            "valueMaps": [
                 {
                   "op": "=",
                   "text": "N/A",
                   "value": "null"
                 },
                 {
                   "op": "=",
                   "text": "Healthy",
                   "value": "1"
                 },
                 {
                   "op": "=",
                   "text": "Unhealthy",
                   "value": "0"
                 }
            ],

This does not even work for N/A which is used in current dashboard like the one for etcd.
Additional info:

Grafana supports this as expected. This blocks the UX we want to achieve here: https://github.com/openshift-knative/serverless-operator/pull/388 for creatng a custom dashboard for serverless.

Comment 1 Pawel Krupa 2020-08-07 08:23:17 UTC
This is not a bug as it follows an established design doc https://docs.google.com/document/d/1yk-Ef_YGRJUiuVNFwxcar_qeFDveKYLyILAnbDDfTb0/edit#. If you don't agree with design decisions, please open an RFE in https://issues.redhat.com/projects/RFE/issues.

Comment 2 Samuel Padgett 2020-08-13 13:42:30 UTC
*** Bug 1868463 has been marked as a duplicate of this bug. ***

Comment 3 Samuel Padgett 2020-08-13 16:58:22 UTC
Reopening as a bug since

1. This is a tiny code change
2. It impacts several 4.6 dashboards and looks pretty bad
3. There's no workaround

Comment 6 Yadan Pei 2020-08-24 07:11:24 UTC
It should map the value to the corresponding text as described in this part:
            "valueMaps": [
                 {
                   "op": "=",
                   "text": "N/A",
                   "value": "null"
                 },
                 {
                   "op": "=",
                   "text": "Healthy",
                   "value": "1"
                 },
                 {
                   "op": "=",
                   "text": "Unhealthy",
                   "value": "0"
                 }
            ],

On Monitoring Dashboards -> Knative Health Status page, it shows text N/A instead of value 'null', I assume with Knative Serving Serverless operator installed the value will be 1 but currently in 4.6 cluster there is no serverless operator and this is tracked in bug 1869500. From the screenshot in fix PR, I think the issue has already been fixed.

Moving to VERIFIED, let me know if my steps are wrong

4.6.0-0.nightly-2020-08-23-185640

Comment 7 Yadan Pei 2020-08-24 09:19:34 UTC
I found a way to change the value to 1 and 0, when value is 1 console will show text Healthy and when value is 0 console will show Unhealthy, the issue is fixed

Comment 9 errata-xmlrpc 2020-10-27 16:26:23 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (OpenShift Container Platform 4.6 GA Images), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2020:4196