Skip to content

Variable value from URL is not read correctly

Summary

(Summarize the bug encountered concisely)

Given a URL like https://staging.gitlab.com/gitlab-instance-administrators-2a3278da/gitlab-self-monitoring/-/environments/211810/metrics?var-instance=.*prometheus.+, the dashboard should open with the instance variable filled with the .*prometheus.+ value.

Steps to reproduce

(How one can reproduce the issue - this is very important)

  1. Create a project, setup a K8s cluster and install the Prometheus managed app.

  2. Create a custom metrics dashboard with the following content:

    dashboard: 'Pod metrics'
    priority: 10
    templating:
      variables:
        pod_name: '.+'
    panel_groups:
    - group: CPU metrics
      panels:
      - title: "CPU usage"
        type: "line-chart"
        y_label: "Cores per pod"
        metrics:
        - id: pod_cpu_usage_seconds_total
          query_range: 'rate(container_cpu_usage_seconds_total{pod_name=~"{{pod_name}}",container_name="POD"}[5m])'
          unit: "cores"
          label: pod_name
  3. Open the metrics dashboard and change the value of the pod_name variable. For example, you can change it to prometheus.+.

  4. Copy the URL of that page with the new variable value, and open it in a new tab. The dashboard in the new tab should open with the new variable value. But it doesn't.

What is the current bug behavior?

Variable from the URL is not prefilled correctly.

What is the expected correct behavior?

Variable from the URL should be prefilled correctly.

Possible fixes

No possible workarounds.

Edited by Dhiraj Bodicherla