Support multiple series for stacked column charts

Summary

Currently our stacked column charts only support one row of results, consider the following example of a result of prometheus query:

{
   "status" : "success",
   "data" : {
      "resultType" : "matrix",
      "result" : [ // "rows"
         { // This will be rendered
            "metric" : {
               "__name__" : "up",
               "job" : "prometheus",
               "instance" : "localhost:9090"
            },
            "values" : [
               [ 1435781430.781, "1" ], // "columns"
               [ 1435781445.781, "1" ],
               [ 1435781460.781, "1" ]
            ]
         },
         { // This will not render
            "metric" : {
               "__name__" : "up",
               "job" : "node",
               "instance" : "localhost:9091"
            },
            "values" : [
               [ 1435781430.781, "0" ],
               [ 1435781445.781, "0" ],
               [ 1435781460.781, "1" ]
            ]
         }
      ]
   }
}

Steps to reproduce

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

Example Project

(If possible, please create an example project here on GitLab.com that exhibits the problematic behavior, and link to it here in the bug report)

(If you are using an older version of GitLab, this will also determine whether the bug is fixed in a more recent version)

What is the current bug behavior?

We don't render multiple series beyond the first row of a multiple row result from a prometheus query

What is the expected correct behavior?

We should render multiple series in our stacked column charts

Possible fixes

We need to change the chartData computed prop in the corresponding vue component:

https://gitlab.com/gitlab-org/gitlab/blob/ad256ac4bd9d35953b19f531356129cba0976ac4/app/assets/javascripts/monitoring/components/charts/column.vue#L48

And on the following utility function

https://gitlab.com/gitlab-org/gitlab/blob/ad256ac4bd9d35953b19f531356129cba0976ac4/app/assets/javascripts/monitoring/utils.js#L315

Edited Jun 15, 2020 by Jose Ivan Vargas
Assignee Loading
Time tracking Loading