Skip to content

Support more query variables in custom dashboards per project

Problem to solve

GitLab 12.1 introduced custom dashboards per project, where dashboards can be added to a project's repository in .gitlab/dashboards/, and be configured with various panels showing metrics from Prometheus. A limited set of CI variables are in Prometheus queries.

  • CI_ENVIRONMENT_SLUG
  • KUBE_NAMESPACE

These variables are insufficient for creating reusable dashboards, especially for project templates. I don't deploy using GitLab's Kubernetes integration, leaving CI_ENVIRONMENT_SLUG as the only bit of information for queries.

Intended users

Further details

I want to be able to create dashboard definitions that can be re-used across many projects, and included as part of project templates. For this to work, I need more information about the project that a dashboard is in, beyond just CI_ENVIRONMENT_SLUG. My Prometheus metrics have information like the project name, but there is no way to incorporate that into queries as is.

Proposal

GitLab should support more CI variables in dashboard Prometheus queries. Variables that identify the project and environments are the most important to me.

  • CI_PROJECT_NAME
  • CI_PROJECT_ID
  • CI_PROJECT_NAMESAPCE
  • CI_PROJECT_PATH
  • CI_ENVIRONMENT_NAME (in addition to CI_ENVIRONMENT_SLUG)

Permissions and Security

Documentation

Testing

What does success look like, and how can we measure that?

Be able to create reusable dashboards that work in multiple projects.

What is the type of buyer?

Links / references

Edited by King Chung Huang