-
Bug
-
Resolution: Unresolved
-
Critical
-
None
-
None
When the variables set in a grafana dashboard contain commas or new lines, the migration to Perses fails to recognize this as a single variable value.
Having these variables from a grafana json:
"options": [ { "selected": true, "text": "All", "value": "0" }, { "selected": false, "text": "stopped", "value": "on(cluster,name,namespace) group_left()(0*(sum by(cluster,namespace,name)(kubevirt_vm_non_running_status_last_transition_timestamp_seconds>0)))" }, { "selected": false, "text": "starting", "value": "on(cluster,name,namespace) group_left()(0*(sum by(cluster, namespace,name)(kubevirt_vm_starting_status_last_transition_timestamp_seconds>0)))" }, { "selected": false, "text": "migrating", "value": "on(cluster,name,namespace) group_left()(0*(sum by(cluster, namespace,name)(kubevirt_vm_migrating_status_last_transition_timestamp_seconds>0)))" }, { "selected": false, "text": "error", "value": "on(cluster,name,namespace) group_left()(0*(sum by(cluster,namespace,name)(kubevirt_vm_error_status_last_transition_timestamp_seconds>0)))" }, { "selected": false, "text": "running", "value": "on(cluster,name,namespace) group_left()(0*(sum by(cluster,namespace,name)(kubevirt_vm_running_status_last_transition_timestamp_seconds>0)))" }
the migrated variable looks like:
plugin: kind: StaticListVariable spec: values: - All=0 - stopped:on(cluster - name - namespace) group_left()(0*(sum by(cluster - namespace - name)(kubevirt_vm_non_running_status_last_transition_timestamp_seconds>0))) - starting:on(cluster - name - namespace) group_left()(0*(sum by(cluster - namespace - name)(kubevirt_vm_starting_status_last_transition_timestamp_seconds > 0))) - migrating:on(cluster - name - namespace) group_left() (0*(sum by (cluster - namespace - name)(kubevirt_vm_migrating_status_last_transition_timestamp_seconds>0))) - error:on(cluster - name - namespace) group_left()(0*(sum by(cluster - namespace - name)(kubevirt_vm_error_status_last_transition_timestamp_seconds>0))) - running:on(cluster - name - namespace) group_left()(0*(sum by(cluster - namespace - name)(kubevirt_vm_running_status_last_transition_timestamp_seconds>0)))
Which created new values out the commas and new lines and also did not include the value name to be displayed on the dropdown.
Expected results
The migration command from percli should respect the commas and new lines that are intended to be concatenated into the query.
How to Test
- With the latest version of Perses backend from https://github.com/perses/perses `main`, using the latest version of the StaticListVariablePlugin from https://github.com/perses/plugins `main`
- Build the percli tool using `make build-cli` on the perses backend
- Start the perses backend so percli can connect for the migration
- Use the built percli executable to migrate a complex ACM dashboard.
-
- percli login http://localhost:8080
- download the ACM dashboard defined as configmap: https://github.com/stolostron/multicluster-observability-operator/blob/main/operators/multiclusterobservability/manifests/base/grafana/virtualization/dash-acm-virtual-machines-by-time-in-status.yaml
- Extract the configmap json content (grafana definition) and use it in the following command
- percli migrate -f acm-vm-status.json --online -o json > perses-acm-vm-status.json
- Add a project name to the migrated dashboard, this project should exist in perses, and create the dashboard
- percli apply -f perses-acm-vm-status.json
- Check that the status variable is correctly replaced in queries. The string `${status:raw}` should NOT be present in the queries executed