Adds path to edit custom metrics in dashboard response
What does this MR do?
Addresses #35968 (closed). This MR modifies the metrics dashboard response to include two new fields.
-
custom_metrics
to indicate that a panel group includes custom metrics. -
edit_path
to include the edit path for a custom metric. This will be nil if not a custom metric.
For example:
{
"all_dashboards":[
{
"path":"config/prometheus/common_metrics.yml",
"display_name":"Default",
"default":true,
"system_dashboard":true,
"can_edit":false,
"project_blob_path":null
}
],
"dashboard":{
"dashboard":"Environment metrics",
"priority":1,
"panel_groups":[
{
# System Metric
"group":"System metrics (Kubernetes)",
"priority":5,
"panels":[
{
"title":"Knative function invocations",
"type":"area-chart",
"y_label":"Invocations",
"weight":1,
"metrics":[
{
"id":"system_metrics_knative_function_invocation_count",
"query_range":"sum(ceil(rate(istio_requests_total{destination_service_namespace=\"%{kube_namespace}\", destination_service=~\"%{function_name}.*\"}[1m])*60))",
"label":"invocations / minute",
"unit":"requests",
"metric_id":21,
"prometheus_endpoint_path":"/root/autodevops-deploy/-/environments/25/prometheus/api/v1/query_range?query=sum%28ceil%28rate%28istio_requests_total%7Bdestination_service_namespace%3D%22%25%7Bkube_namespace%7D%22%2C+destination_service%3D~%22%25%7Bfunction_name%7D.%2A%22%7D%5B1m%5D%29%2A60%29%29",
"edit_path":null
}
]
}
],
"custom_metrics":false
},
{
# Custom Metric
"group":"Business metrics (Custom)",
"priority":0,
"panels":[
{
"type":"area-chart",
"title":"Throughput",
"y_label":"Requests/second",
"metrics":[
{
"query_range":"rate(http_requests_total[5m])",
"unit":"req/sec",
"label":"HTTP requests",
"metric_id":22,
"prometheus_endpoint_path":"/root/autodevops-deploy/-/environments/25/prometheus/api/v1/query_range?query=rate%28http_requests_total%5B5m%5D%29",
"edit_path":"/root/autodevops-deploy/prometheus/metrics/22/edit"
}
]
}
],
"custom_metrics":true
}
]
},
"status":"success"
}
Screenshots
Does this MR meet the acceptance criteria?
Conformity
-
Changelog entry -
Documentation (if required) -
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 team
Closes #35968 (closed)
Edited by 🤖 GitLab Bot 🤖