Problem with simple jsonpath query for infinity datasource

I’m trying to populate a heatmap and can’t get the query to isolate the values I need.

The raw query returns rows of data formatted as: (this is 2 rows of data, truncated)

{"data":[{"time":0.0,"value":97.765564},{"time":0.0,"value":97.768166},{"time":0.0,"value":97.77602},{"time":0.0,"value":97.78909},{"time":0.0,"value":97.80747},{"time":0.0,"value":97.8311},{"time":0.0,"value":97.86005},{"time":0.0,"value":97.89436},{"time":0.0,"value":97.934044},{"time":0.0,"value":97.97919},{"time":0.0,"value":98.02982},{"time":0.0,"value":98.08601},{"time":0.0,"value":98.14784},{"time":0.0,"value":98.21538},{"time":0.0,"value":98.28872},{"time":0.0,"value":98.367966},{"time":0.0,"value":98.45323},{"time":0.0,"value":98.54463},{"time":0.0,"value":98.64227},{"time":0.0,"value":98.74633},{"time":0.0,"value":98.85696},{"time":0.0,"value":98.974304},{"time":0.0,"value":99.09856},{"time":0.0,"value":99.229935},{"time":0.0,"value":99.36865},{"time":0.0,"value":99.51492},{"time":0.0,"value":99.66904},{"time":0.0,"value":99.83125},{"time":0.0,"value":100.00191}]},

{"data":[ {"time":0.0034299803,"value":95.74505},{"time":0.0034299803,"value":91.80179},{"time":0.0034299803,"value":95.74981},{"time":0.0034299803,"value":97.80916},{"time":0.0034299803,"value":95.81069},{"time":0.0034299803,"value":91.88584},{"time":0.0034299803,"value":95.852325},{"time":0.0034299803,"value":97.935745},{"time":0.0034299803,"value":95.961525},{"time":0.0034299803,"value":92.05559},{"time":0.0034299803,"value":96.04114},{"time":0.0034299803,"value":98.14953},{"time":0.0034299803,"value":96.20061},{"time":0.0034299803,"value":92.31449},{"time":0.0034299803,"value":96.32011},{"time":0.0034299803,"value":98.45493},{"time":0.0034299803,"value":96.53294},{"time":0.0034299803,"value":92.66804},{"time":0.0034299803,"value":96.96597},{"time":0.0034299803,"value":93.12431}]
}

I added the column query:

$…data[*].value as value format as number

and get

0 series returned

I have also gotten a table filled with null values, but I’m not sure what changed.

I have tested the query with the online jsonpath evaluator successfully. Below is a screenshot with the raw query result. This doesn’t seem complicated, so I’m not sure what’s going wrong.

I checked the JSON data shared by you, it doesn’t seem to be in a proper json structure. After formatting it properly, I was able to get the data. So I would suggest to double check on the JSON structure.

what is this data type marked as time?

{
	"time": 0.0034299803,
	"value": 96.53294
},

It’s hard to cut and paste the data in a clear way to represent in a post, that’s why I included the screen shot. The query returns an array of data, where each array element is correctly parsed into a row of data of {“data”:[{},{}.{}]}

The snippet of data I posted is two rows of data from executing the query. All indicators are that the json returned from the query is valid.

Currently the time field is a delta increment. I’m sure I need to reformat for a proper histogram, but I should be able to retrieve it as number.

Repeating your UQL syntax, I also get no data.

so based on the data you provided, and using uql, it does work on my PC :laughing: :stuck_out_tongue_winking_eye:

that can mean you did not provide the real data coming from your rest api endpoint or something else.

So one possibility: If I execute the query via the url in the browser I see something like this:

["{\"data\":[{\"time\":0.0,\"value\":97.765564},{\"time\":0.0,\"value\":97.768166},{\"time\":0.0,\"value\ ...

Perhaps the extra quotes in the beginning and end? Or the escaped quotes are the problem?

could be but hard to tell without real usable data like you did in original post. we dont have access to your api so cant help much here

I’m trying to figure out how to capture the actual REST response to a file but there are a lot of libraries involved. At least it seems like that’s the area to debug, as opposed to the query itself.

you dont need to go down that rabbit hole, just click on the Query inspector or look at your browser dev tools network tab and rerun query and you should see the actual response or post a screen shot.

Follow-up. The primary problem was a bug in the API implementation. It was returning an array of JSON formatted strings instead of an array of JSON objects. It was valid JSON, but not something the query inspector could process properly. The API is a Rust implementation for Mongodb and the conversion from Bson to Json was tricky.

1 Like

Thanks for the assistance, I’ve fixed the api so that the UQL query works, but it does not display the time correctly. The defaul JSONPath query is still not returning valid results. Screenshots:



what does this mean?

I fixed the time field. It is now seconds since epoch.

1 Like

please post latest json

It’s challenging to post the actual json. This is a truncated version of the data.

[{"data":[{"time":1720016579.763,"value":97.765564},{"time":1720016579.763,"value":97.768166},{"time":1720016579.763,"value":97.77602},{"time":1720016579.763,"value":97.78909},{"time":1720016579.763,"value":97.80747},{"time":1720016579.763,"value":97.8311},{"time":1720016579.763,"value":97.86005},{"time":1720016579.763,"value":97.89436},{"time":1720016579.763,"value":97.934044},{"time":1720016579.763,"value":97.97919}]},{"data":[{"time":1720016579.76643,"value":97.76725},{"time":1720016579.76643,"value":95.74505},{"time":1720016579.76643,"value":91.80179},{"time":1720016579.76643,"value":95.74981},{"time":1720016579.76643,"value":97.80916},{"time":1720016579.76643,"value":95.81069},{"time":1720016579.76643,"value":91.88584},{"time":1720016579.76643,"value":95.852325},{"time":1720016579.76643,"value":97.935745},{"time":1720016579.76643,"value":95.961525}]}]
1 Like

So, as you mentioned, there’s not a lot of variation in my data. Infinity seems to be rounding the data to a single decimal place. Is there a way to increase the precision? The jsonata exerciser preserves the floating point precision, but the query in the plugin does not.

read up in the docu about decimal. as you can see in my browser network tab the values are coming back with the proper decimal points.

:fish: :fishing_pole_and_fish:

Yes, the query returns the full precision floating point, but grafana is rounding to single decimal point. Searches through posts suggests this is a known issue. Is this correct? and there is no fix/work around?

go to https://grafana.com/ then click on search

image

then ask Grot dashboard decimal