Vonage / Grafana_Status_panel

A panel plugin for Grafana to monitor multiple parameters at once
Other
179 stars 108 forks source link

Fix undefined Handler Type in current master branch #73

Closed PeteBa closed 6 years ago

PeteBa commented 7 years ago

In Release 1.0.4, I noticed that the default Handler Type is not selected for new series as seen in the screenshot below:

grafana

I have only recently noticed this and suspect it could actually be due to new behaviour in Grafana version 4.4.1.

The issue results from upgradeOldVersion() being called multiple times on a new series when still on the Metrics tab and before the Options tab has a chance to set the default. This results in valueHandler being incorrectly set to "Regular" rather than the default of"Threshold" (i.e. valueHandlers[0]).

Looking at the code in status_ctrl.js, this occurs as follows: 1) when a series is first created in the Metrics tab then valueHandler is null 2) a first call to upgradeOldVersion() will set the displayType to "Regular" (i.e. displayType[0]) on line 236 3) a second call to upgradeOldVersion() will then copy "Regular" into the valueHandler on line 232 4) when you then go to the Options tab then the Handler Type is blank

I think this is new behaviour in the latest Grafana release as I cannot recall seeing this problem before. The fix uses (target.displayType != null) to limit the upgrade checks to only legacy series and not new ones.

PeteBa commented 7 years ago

I have rebased this to the latest merge.

tomer-amir-vonage commented 7 years ago

Thanks! I'll take a look in the weekend and get back to you

PeteBa commented 6 years ago

Rebased to merge with current master.

valeriu-a commented 6 years ago

Any updates on this merge?

PeteBa commented 6 years ago

Thanks for the merge