Add prometheus_endpoint_path for variables
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:
- Renames
Stages::EndpointInserter
toStages::MetricEndpointInserter
. - Creates a new class called
Stages::VariableEndpointInserter
which adds theprometheus_endpoint_path
key to anymetric_label_values
variable type present in the dashboard being processed. - Adds an example of a
metric_label_values
variable to the sample_dashboard.yml spec fixture file. - Updates the dashboard JSON schema to allow
metric_label_values
variable types.
Issue: #214539 (closed)
Screenshots
Does this MR meet the acceptance criteria?
Conformity
- Changelog entry
-
Documentation (if required)
Docs MR: !34762 (merged) to be merged after frontend MR (!34607 (merged)) -
Code review guidelines -
Merge request performance guidelines -
Style guides -
Database guides -
Separation of EE specific content
Availability and Testing
-
Review and add/update tests for this feature/bug. Consider all test levels. See the Test Planning Process. - [-] Tested in all supported browsers
- [-] Informed Infrastructure department of a default or new setting change, if applicable per definition of done
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