Skip to content

Prometheus alerts show for multiple environments

A prometheus alert setup for a specific environment will also show itself in other environments.

Steps to reproduce

  1. Create a project
  2. Setup prometheus
  3. Add a .gitlab-ci.yml (You can use gitlab-ci.yml)
  4. Run pipelines
  5. There should be two environments ("staging" and "production")
  6. Go to the production metrics
  7. Add one alert using the widget
  8. Go to the staging metrics
  9. Verify that the alert shows in the "staging" environment as well

GIF replicating the problem

bug

Expected behaviour

  • The alert should only show for the environment where it was created

Possible solution

Scope the calls in Prometheus::AlertsController by environment_id

\cc @splattael @joshlambert

Edited by Tiago Botelho