Skip to content

Add prometheus_endpoint_path for variables

Reuben Pereira requested to merge 214539-add-prometheus-endpoint-path into master

What does this MR do?

We are adding a new type of variable called metric_label_values to the metrics dashboard YAML format (#214539 (closed)). This new variable type uses the label values of a Prometheus metric to populate the dropdown selector.

The frontend needs to make a Prometheus request in order to get the possible values of the variable.

Similar to how the backend adds a prometheus_endpoint_path key to the metrics in the dashboard YAML, this MR adds a prometheus_endpoint_path key to variables of type metric_label_values. The frontend will send a Prometheus request to this path, and use the response to populate the dropdown selector.

This MR:

  1. Renames Stages::EndpointInserter to Stages::MetricEndpointInserter.
  2. Creates a new class called Stages::VariableEndpointInserter which adds the prometheus_endpoint_path key to any metric_label_values variable type present in the dashboard being processed.
  3. Adds an example of a metric_label_values variable to the sample_dashboard.yml spec fixture file.
  4. Updates the dashboard JSON schema to allow metric_label_values variable types.

Issue: #214539 (closed)

Screenshots

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

Security

If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:

  • [-] Label as security and @ mention @gitlab-com/gl-security/appsec
  • [-] The MR includes necessary changes to maintain consistency between UI, API, email, or other methods
  • [-] Security reports checked/validated by a reviewer from the AppSec tea
Edited by 🤖 GitLab Bot 🤖

Merge request reports

Loading