grafana-infinity-datasource icon indicating copy to clipboard operation
grafana-infinity-datasource copied to clipboard

[Bug] Support for parsing Big numbers

Open dommgifer opened this issue 2 years ago • 2 comments

Describe the bug

Json data value was string 9921020321007113, But result was 9921020321007112 on table

Steps to reproduce

Get json response and show on table Test data: 9921020321007111, 9921020321007112, 9921020321007113, ..... ,9921020321007119 Result: 9921020321007112, 9921020321007112, 9921020321007112, ..... ,9921020321007120

Note: bugs will be fixed only if enough information provided to reproduce the issue

Sample Data

Data:

[
	{"serialNumber": "9921020321007111"},
	{"serialNumber": "9921020321007112"},
	{"serialNumber": "9921020321007113"},
	{"serialNumber": "9921020321007114"},
	{"serialNumber": "9921020321007115"},
	{"serialNumber": "9921020321007116"},
	{"serialNumber": "9921020321007117"},
	{"serialNumber": "9921020321007118"},
	{"serialNumber": "9921020321007119"}
]

Screenshots

Format as string:

image Format as number:

image

Version Details:

  • Grafana version : v8.5.6
  • Plugin version : v0.8.8

Additional context

dommgifer avatar Jun 22 '22 08:06 dommgifer

Hmm. formatting as string does produce the correct results for me at least here.

But I can confirm that parsing as number for big integers causing issue with Javascript. As you can see below screenshot browsers have limitations with javascript numbers. If the numbers are beyond range, they need to be specified as big int. ( plugin doesn't support that yet and don't have clear usecase for it ).

image

So suggesting you to use this as a string in your usecase. ( also suggest you to try latest 1.0.0-dev.5 from here if the string type doesn't produce desired result )

yesoreyeram avatar Jun 22 '22 08:06 yesoreyeram

Thank you for the prompt reply.

Upgrade my grafana to v9.0.1, the result was correct.

image

dommgifer avatar Jun 22 '22 08:06 dommgifer