Metrics Anomaly Chart rendering fails

Summary

Metrics Anomaly Chart rendering fails

Steps to reproduce

  1. Setup a devops project with metrics enabled

  2. Create a new custom dashboard with an anomaly chart

dashboard: 'Metrics Anomaly'
panel_groups:
  - group: 'Memory'
    panels:
      - title: "anomalies"
        type: anomaly-chart
        y_label: "MB"
        metrics:
          - id: anomaly_requests_normal
            query_range: 'avg(sum(container_memory_usage_bytes{container_name!="POD",pod_name=~"^%{ci_environment_slug}-([^c].*|c([^a]|a([^n]|n([^a]|a([^r]|r[^y])))).*|)-(.*)",namespace="%{kube_namespace}"}) by (job)) without (job) / count(avg(container_memory_usage_bytes{container_name!="POD",pod_name=~"^%{ci_environment_slug}-([^c].*|c([^a]|a([^n]|n([^a]|a([^r]|r[^y])))).*|)-(.*)",namespace="%{kube_namespace}"}) without (job)) /1024/1024'
            label: "memory_1024"
            unit: "MB"
          - id: anomaly_requests_normal_upper_limit
            query_range: 20
            label: "upper limit"
            unit: "MB"
          - id: anomaly_requests_normal_lower_limit
            query_range: 5
            label: "lower limit"
            unit: "MB"

Example Project

https://staging.gitlab.com/gitlab-org/monitor/monitor-sandbox/-/environments/180571/metrics?dashboard=.gitlab%2Fdashboards%2Fanomaly_custom_dashboard.yml

What is the current bug behavior?

No chart is rendered

What is the expected correct behavior?

Chart is rendered

Relevant logs and/or screenshots

image

Output of checks

(If you are reporting a bug on GitLab.com, write: This bug happens on GitLab.com)

Results of GitLab environment info

Expand for output related to GitLab environment info

(For installations with omnibus-gitlab package run and paste the output of: sudo gitlab-rake gitlab:env:info)

(For installations from source run and paste the output of: sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production)

Results of GitLab application Check

Expand for output related to the GitLab application check

(For installations with omnibus-gitlab package run and paste the output of: sudo gitlab-rake gitlab:check SANITIZE=true)

(For installations from source run and paste the output of: sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production SANITIZE=true)

(we will only investigate if the tests are passing)

Possible fixes

(If you can, link to the line of code that might be responsible for the problem)

Edited by Miguel Rincon