-
Notifications
You must be signed in to change notification settings - Fork 1.1k
fix(dashboard): Handle NaN values when rendering analysis in the UI #4203
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
Handle NaN values Signed-off-by: Sondre Lillebø Gundersen <sondrelg@live.no>
|
|
I see now that this was fixed in the past: #3801. Seems to have been rolled back at some point? |
Published E2E Test Results 4 files 4 suites 3h 16m 56s ⏱️ Results for commit a5a9be5. |
Published Unit Test Results2 307 tests 2 307 ✅ 2m 59s ⏱️ Results for commit a5a9be5. |
|
@ashutosh16, sorry for the ping, but I see you removed the json5.parse call in #3881. Was that intentional? Not sure, but #3801 seems like it addressed the problem I'm having, so while I'm not sure why, I think the reversal might have reintroduced the issue |
|
@sondrelg Dashboard was crashing even after #3801 , I don't exactly remember what JSON5 parse was returning, so i tried to fix it by adding try/block which worked. Verified below data is parse correctly in the dashboard, Are you trying to parse different data? |
|
The problematic data seems to look like this, for me: {
"value": "[NaN]",
"status": "Successful",
"metricName": "ingress success rate",
"startedAt": "2025-03-24T13:25:22Z"
},
{
"value": "[NaN]",
"status": "Successful",
"metricName": "ingress success rate",
"startedAt": "2025-03-24T13:26:22Z"
},
{
"value": "[1]",
"status": "Successful",
"metricName": "ingress success rate",
"startedAt": "2025-03-24T13:27:22Z"
},
{
"value": "[1]",
"status": "Successful",
"metricName": "ingress success rate",
"startedAt": "2025-03-24T13:28:22Z"
}Seems pretty similar |
|
@sondrelg Not sure why it is failing for you, your changes look reliable to me. Were you able to verify the change in your setup? |
| let parsedValue; | ||
| try { | ||
| parsedValue = JSON.parse(value); | ||
| parsedValue = JSON.parse(safeValue); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the value is null then we can skip the parse and safely ignore the value or set it to 0
|
Yes the changes fixed the problem on my setup, as far as I can tell 👍 |



Handle NaN values
Checklist:
"fix(controller): Updates such and such. Fixes #1234".Hi!
I have this analysis metric:
Which returns data like this:
{ "value": "[NaN]", "status": "Successful", "metricName": "ingress success rate", "startedAt": "2025-03-24T13:25:22Z" }, { "value": "[NaN]", "status": "Successful", "metricName": "ingress success rate", "startedAt": "2025-03-24T13:26:22Z" }, { "value": "[1]", "status": "Successful", "metricName": "ingress success rate", "startedAt": "2025-03-24T13:27:22Z" }, { "value": "[1]", "status": "Successful", "metricName": "ingress success rate", "startedAt": "2025-03-24T13:28:22Z" }When I try to view the analysis in the dashboard, the rendering fails and I see this error in the console:
I believe this fixes the issue, though I haven't written the tests to prove it yet - sorry about that!
I'm on version 1.8.1.