Create a new endpoint that converts .yml panels to JSON
Description
As part of &2882, create a new endpoint to validate and return panel information in JSON format.
The panel response would have the same format as the current panel UI.
Example request:
panel
- title: "Memory Usage (Total)"
type: "area-chart"
y_label: "Total Memory Used (GB)"
weight: 4
metrics:
- id: system_metrics_kubernetes_container_memory_total
query_range: 'avg(sum(container_memory_usage_bytes{container_name!="POD",pod_name=~"^{{ci_environment_slug}}-(.*)",namespace="{{kube_namespace}}"}) by (job)) without (job) /1024/1024/1024'
label: Total (GB)
unit": "GB"
Example response:
{
"title": "Memory Usage (Total)",
"type": "area-chart",
"y_label": "Total Memory Used (GB)",
"weight": 4,
"metrics": [
{
"id": "system_metrics_kubernetes_container_memory_total",
"query_range": "avg(sum(container_memory_usage_bytes{container_name!=\"POD\",pod_name=~\"^{{ci_environment_slug}}-(.*)\",namespace=\"{{kube_namespace}}\"}) by (job)) without (job) /1024/1024/1024",
"label": "Total (GB)",
"unit": "GB",
"metric_id": 15,
"edit_path": null,
"prometheus_endpoint_path": "/root/autodevops-deploy/-/environments/29/prometheus/api/v1/query_range?query=avg%28sum%28container_memory_usage_bytes%7Bcontainer_name%21%3D%22POD%22%2Cpod_name%3D~%22%5E%7B%7Bci_environment_slug%7D%7D-%28.%2A%29%22%2Cnamespace%3D%22%7B%7Bkube_namespace%7D%7D%22%7D%29+by+%28job%29%29+without+%28job%29++%2F1024%2F1024%2F1024"
}
],
"id": "4570deed516d0bf93fb42879004117009ab456ced27393ec8dce5b6960438132"
}
Technical Details
The list of errors and warnings from the YML validation might be displayed, should we consolidate them?
- The file editor
- The metrics dashboard
- The metrics builder
Edited by Miguel Rincon