Vonage / Grafana_Status_panel

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

Status Panel breaks with Grafana 6.7.0 #159

Closed hseffler closed 4 years ago

hseffler commented 4 years ago

Works up to 6.6.2, breaks in 6.7.0 released yesterday.

Panel rendering error Cannot read property 'slice' of undefined

fabian-milea commented 4 years ago

I got the same problem, even with 6.7.1

simonscheib commented 4 years ago

Yep, exactly the same Problem. After Upgrading to 6.7.1 its broken. After Downgrad to 6.6.2 it's working again

MefhigosetH commented 4 years ago

Me too

statusPanel-Grafana67

MefhigosetH commented 4 years ago

Seems that the problem is in src/status_ctrl.js:L171:

setTextMaxWidth() {
  let tail = ' …';
  let panelWidth = this.$panelContainer.innerWidth();

    if (isNaN(panelWidth))
      panelWidth = parseInt(panelWidth.slice(0, -2), 10) / 12;
    panelWidth = panelWidth - 20;
    this.maxWidth = panelWidth;
}
sbrandtb commented 4 years ago

I know it is not a satisfying thing to say, but this project looks dead and given that there are backwards-incompatibility issues with panels in Grafana at least once a year, using built-in panels is a much safer bet. Grafana has a new Stat panel, which is less powerful than multistat since it cannot set colors, thresholds and units for time series separately, but might be sufficient in most use cases.

simonscheib commented 4 years ago

Most likely, one of our internal customers got also some sort of JS errors: Panel rendering error, panelWidth is undefined

torkelo commented 4 years ago

The panel-container class is not accessible like it is here: https://github.com/Vonage/Grafana_Status_panel/blob/master/src/status_ctrl.js#L637

But if you change it to: elem.closest('.panel-container');

the panel should start working again. But the way this panel works by accessing core classes outside it's scope (panel-container & panel-header) is very fragile and will break again as these are classes Grafana will change in the future.

ashoktmw commented 4 years ago

I updated Grafana 6.5 to 6.7 , from that on status panel not working . I tried to do some changes in the status panel config and it says “Panel rendering error Cannot read property ‘slice’ of undefined”

I see already some actions taken here, just posting

sgolubevCY commented 4 years ago

It seems I've found the solution. Change this line: https://github.com/Vonage/Grafana_Status_panel/blob/master/src/status_ctrl.js#L637 like this: this.$panelContainer = elem;

The elem parameter of method link receives the following DOM subtree:

<grafana-panel ctrl="ctrl" class="panel-height-helper ng-isolate-scope">
  <ng-transclude class="panel-height-helper"><div class="status-panel ng-scope">
    <div ng-show="ctrl.duplicates">...

If I not mistakes, this is a container of the plugin which previously was retrieved by calling elem.find() method. Anyway, this subtree does not contains object of class 'panel-container'.

ftasso commented 4 years ago

Yes, it works! I'm not sure but there is a small graphic difference, after your suggestion only the internal rectangle color is changing and not the full rectangle containing the status.

Thank you, Fabrizio

sgolubevCY commented 4 years ago

Yes, it works! I'm not sure but there is a small graphic difference, after your suggestion only the internal rectangle color is changing and not the full rectangle containing the status.

Thank you, Fabrizio

Probably, It was a quick fix. In our case it was OK.

ftasso commented 4 years ago

Yes, It's OK also for me simply adding the trasparency to the panel,

MefhigosetH commented 4 years ago

Dear @sgolubevCY , Thanks for share your solution.

Sory, but i'm a JS newbie. After fix the source file, what other command o task need I execute?

I've made the change you suggested on src/status_ctrl.js, and restart Grafana, but my pannels keep blank with no info.

Thanks in advance!

ftasso commented 4 years ago

Hello, You must change also the file in "dist" directory, not only in "src".

Bye

sgolubevCY commented 4 years ago

Hi @MefhigosetH,

As @ftasso suggested, you have to change this line in the same file into "dist" folder.

MefhigosetH commented 4 years ago

@ftasso @sgolubevCY Oh, thanks! This 'detail' was the solution.

Now, I can see my pannels :-D

abadyan-vonage commented 4 years ago

Hey everyone. Unfortunately, we currently don't have the resources to work on this panel. I think issue is specifically important for continued use. If someone can create a PR to fix this, we'll try to validate and push this in soon. Thanks and apologies for the inconvenience.

ktibi commented 4 years ago

Hey,

your fix solved first issue. But If I try to use two metrics, I have this error :

image

xkilian commented 4 years ago

@ktibi This might be related to the issue where if you click on the "Duplicate Query" icon instead of the "Add Query" button. Duplicate Query will break the panel. It seems to copy some internal ID that Status panel references. It is not documented other than in an issue, but that is the way to add more than one metric! Hope this helps. The status plugin works for me with the fix and displays multiple metrics. Would be great to have a group officially take over this plugin or that the functionality be folded into the official single-stat plugin.

ktibi commented 4 years ago

@xkilian Thx your explanation. Add new query instead of duplicate resolve the issue.

MefhigosetH commented 4 years ago

Yes, yes. With the patch sugested by @sgolubevCY , the panel on my dashboards, worked fine again:

multipanel

I hope, the project can merge my PR.

luciferYu commented 4 years ago

my grafana version is 6.7.2 i have the same problem image

freedomwarrior commented 4 years ago

Grafana 6.7.2

Cannot read property 'slice' of undefined
angular.js:14800 TypeError: Cannot read property 'slice' of undefined
    at StatusPluginCtrl.setTextMaxWidth (status_ctrl.js:175)
    at StatusPluginCtrl.onRender (status_ctrl.js:216)
    at u.emit (index.js:150)
    at e.value (emitter.ts:27)
    at StatusPluginCtrl.value (panel_ctrl.ts:102)
    at panel_directive.ts:64
    at angular.js:20566
    at p (angular.js:6428)
    at angular.js:6707 "Possibly unhandled rejection: {}"
MefhigosetH commented 4 years ago

Dear @freedomwarrior , @luciferYu

The issue was fixed with the @sgolubevCY change, on prev messages here.

Or you can review muy PullRequest 161 for known where to apply the neccesary changes.

Cheers

freedomwarrior commented 4 years ago

Dear @freedomwarrior , @luciferYu

The issue was fixed with the @sgolubevCY change, on prev messages here.

Or you can review muy PullRequest 161 for known where to apply the neccesary changes.

Cheers

Worked!

rga-madhu commented 4 years ago

i see the issue is fixed but the panel display is not elegant as it used to be as @MefhigosetH mentioned. This needs to fixed too along with the other things.

jmorcar commented 4 years ago

When could is fixed this issue ? I see workaround applied by @vkalladath in a fork repo , bug the original repo have not a merge with the fix yet.

pschwippert commented 4 years ago

I would like this to be fixed in the main repository too

p1bhandari commented 3 years ago

Yes, yes. With the patch sugested by @sgolubevCY , the panel on my dashboards, worked fine again:

multipanel

I hope, the project can merge my PR.

hi can you share the JSON format of the dashboard?