Do not allow label values that will corrupt the metrics
In https://gitlab.com/gitlab-com/gl-infra/infrastructure/issues/7729, an application error was introduced which led to corrupted OpenMetric values.
It turns out that this was a problem with a single missing parameter which was not validated during initialisation.
The application ran, but Prometheus marked the instances as down, since the OpenMetrics text was incorrect.
Fix for the immediate problem was made in https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/32453
This change ensures that the same problem will not occur again in future by validating the metrics that are passed in.
Downstream vendoring into GitLab-CE coming in https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/32460
Edited by Andrew Newdigate