algenty/grafana-flowcharting

All rules not working when one value mapping rule get the "null" metric

Sunnor opened this issue · 11 comments

Hi Arnaud,
I want to report a bug, would you help to check?

[Issue]: All Text Mapping and Value Mapping rules will be not working when a Value Mapping rule get the "null " metric value.
[Version]: 0.4.0
[Reproduce Steps]:
1. Create a panel and add some mapping rules.
2. Panel display normally.
image
3. Due to some database networking issue, grafana may query some metrics with "null" value sometimes. If this metric is bonding to a value mapping rule, then all rules will be not working. And there will an error cannot read property "toString" of null
image
image

[Desired result]: It should only affect the specific rule that have the problem, instead of broking all rules.

Hi Sunor,
Can you give stack trace in console plz ?
have you try version 0.5.0 ?

BR
Arnaud

Hi Arnaud,

Do you mean this one?
image

metrics_panel_ctrl.ts:179 Panel data error: TypeError: Cannot read property 'toString' of null
at Rule.getFormattedValue (rule_class.js:697)
at State.setState (state_class.js:92)
at eval (statesHandler.js:256)
at Array.forEach ()
at eval (statesHandler.js:255)
at Array.forEach ()
at eval (statesHandler.js:254)
at Array.forEach ()
at StateHandler.setStates (statesHandler.js:252)
at Flowchart.setStates (flowchart_class.js:143)

And I haven't tried 0.5.0 yet. I'll have a try and update the testing result

what is the type of your value ? string ? number ? date ?

  1. I can reproduce this issue with version 0.5.0

Panel data error: TypeError: Cannot read property 'toString' of null
at Rule.getFormattedValue (rule_class.js:541)
at State.setState (state_class.js:122)
at eval (statesHandler.js:159)
at Array.forEach ()
at eval (statesHandler.js:158)
at Array.forEach ()
at eval (statesHandler.js:157)
at Array.forEach ()
at StateHandler.setStates (statesHandler.js:155)
at Flowchart.setStates (flowchart_class.js:113)

  1. I have number values and string values in this diagram, but the one that leading the issue is a string value with "Value Mappings" rule.

  2. BTW, 0.5.0 looks awesome, great job!

I think i fix it during my lunch, can you try it ?
on https://algenty.github.io/flowcharting-repository/ARCHIVES.html
0.6.0 snapshot

It's good now with your 0.6.0 snapshot.

One or two value mapping rules getting "null" value will not break all rules now. it will show a "-" instead.
image

Thanks a lot for quick fix.

Looking forward to having the 0.6.0 version.

You're welcome 👍
I choose '-' when metric is null, i don't know if that is a good choise, you can change that with Value mapping : - => ' ' in rule.
Have you try graph tooltip on your columns Google/facebook ? be carefull histogram test is in progress in 0.6.0, Line Graph works very well for me.

Can i had you screenshot for tweeter and gallery ?

BR
Arnaud

Hi Arnaud,

  1. I tried map "-" to other string like "Error", but it seems not working, it still display "-".

image

  1. Yes, I've tried graph tooltip in both 0.5.0 and 0.6.0, it works fine. This feature looks awesome.

  2. Sorry, I didn't get your meaning of "tweeter and gallery", may I know what they are?

i know why, i think i come back for null value but you can change it into value mapping.

Can you try the last build and map 'null' with 'Error' ?

I tried 0.6.0, still show "-".


image