Not able to parse multiple Json Path with Infinity-datasouce

Hi,
Overview
I’m using Infinity datasource to get api response from an endpoint and want to visualize it as a timeseries.
Its a nested json response.

I want to fetch the this two values below.
“runRates”: [
{
“reportTime”: “2024-04-23T11:35:00Z”,
“value”: 100.0
},
and
“name”: “node1”

I use this two json path to parse the value
$.data.runRates and $.data.node.name

Problem 1
I’m not able to use both json path for parsing in single query it shows an error:plugin.downstreamError

I can parse both when i use it in two different query

I’m very new to this can anyone help?

1 Like

welcome @mohammedrahmanali

please post proper usable json, not partial json

1 Like

Thanks for quick response

same error : plugin.downstreamError
tried without $. as well

The Json looks like this

{
    "data": {
        "node": {
            "name": "node1",
            "instances": [
                {
                    "hostName": "abcce",
                    "status": {
                        "id": 1,
                        "name": "Inactive"
                    }
                }
            ]
        },
        "runRates": [
            {
                "reportTime": "2024-04-23T11:35:00Z",
                "value": 100
            },
            {
                "reportTime": "2024-04-23T11:40:00Z",
                "value": 100
            },
            {
                "reportTime": "2024-04-23T11:45:00Z",
                "value": 100
            },
            {
                "reportTime": "2024-04-23T11:50:00Z",
                "value": 100
            }
        ]
    }
}

Want to visualize runrate and node name

Well, I’ll also give a bit more context in what I’m trying to achieve, may be there could be better option that someone can suggest.

Goal is to visualize the run rate with node name as timeseries as below
this one is based on splunk data source


I’m trying to achieve the same with infinity as it supports alerting, I’m able to visualize it as timeseries with the $.data.runRates parse with transformation as below.

can anyone help me how to achieve this with infinity?

please fix the json data you poste, it is a not usable, cleanly formatted json. if one copies what you posted, it is not a valid json. please vet your data first before posting. help us help you

1 Like

I just fixed the json in the above message

1 Like

could you copy it and validate it here? https://jsonlint.com/

Really sorry just found the right option to add the code

{
    "data": {
        "node": {
            "name": "node1",
            "instances": [
                {
                    "hostName": "abcce",
                    "status": {
                        "id": 1,
                        "name": "Inactive"
                    }
                }
            ]
        },
        "runRates": [
            {
                "reportTime": "2024-04-23T11:35:00Z",
                "value": 100
            },
            {
                "reportTime": "2024-04-23T11:40:00Z",
                "value": 100
            },
            {
                "reportTime": "2024-04-23T11:45:00Z",
                "value": 100
            },
            {
                "reportTime": "2024-04-23T11:50:00Z",
                "value": 100
            }
        ]
    }
}
1 Like

you could leverage jsonata

https://try.jsonata.org/u5nodrvVJ

Brilliant solution from @yosiasz , but just in case you get stuck in Infinity, you have to write the UQL query on one line, like this:

2 Likes

@yosiasz Really appreciate your help!!!
I was able to do the parsing successfully.

I’m trying to change this name for each query or assign the node name in the timeseries visualization so that we can separate each node. I tried to do some transformation and all but nothing seems to be working.

like this

Can you help me with this ?

please post json data showing multiple nodes, one you posted only showed node1