Grafana format JSON data when using Infinity datasource

46 views Asked by At

I used sonarQube web-api to fetch data, and I need to show the data in a table. What i need to do is to restrucure the JSON to needed format

Response from api

{
    "measures": [
        {
            "metric": "bugs",
            "value": "12",
            "component": "project-1",
            "bestValue": true
        },
        {
            "metric": "bugs",
            "value": "13",
            "component": "project-2",
            "bestValue": true
        },
        {
            "metric": "reliability_remediation_effort",
            "value": "14",
            "component": "project-1",
            "bestValue": true
        },
        {
            "metric": "reliability_remediation_effort",
            "value": "15",
            "component": "project-2",
            "bestValue": true
        }
    ]
}

This is the format i needed to show in a table in grafana

[
        {
            "component": "project-1",
            "bugs" : "12"
            "reliability_remediation_effort" : "14",
        },
        {
            "component": "project-2",
            "bugs" : "13"
            "reliability_remediation_effort" : "15",
        },
]

How to do this formatting when using Infinity datasource in grafana ?

I tried using uql and groq Parsers but were not able to get the expected output

0

There are 0 answers