MarcusCalidus / marcuscalidus-svg-panel

Grafana panel for displaying metric sensitive SVG images using the snap svg library
MIT License
63 stars 28 forks source link

ctrl.series[0] is undefined #20

Closed marcin-kasinski closed 5 years ago

marcin-kasinski commented 6 years ago

I have dashboard with 3 metrics.

I discover that sometimes my dashboard doesn't work.

I got error ctrl.series[0] is undefined

Beginning of my code

var svg = Snap(svgnode); 

var metricA=ctrl.series[0].stats.current;
var metricB=ctrl.series[1].stats.current;
var metricC=ctrl.series[2].stats.current;

I tought it is due to my svg content encoding.

Problme is that after removing svg content I still have the same error

There is a worst thing.

After half an hour it works fine.

I have no idea is it some grafana cache or something.

Your plugin is great but this issue makes me cry.

Error:

anonymous@http://grafana:30080/public/build/0.6aa12092d3333cb24394.js line 1 > eval line 309 > Function:6:5
render@http://grafana:30080/public/plugins/marcuscalidus-svg-panel/rendering.js:86:11
link/<@http://grafana:30080/public/plugins/marcuscalidus-svg-panel/rendering.js:16:7
o.prototype.emit@http://grafana:30080/public/build/vendor.6aa12092d3333cb24394.js:44:25778
a</e.prototype.emit@http://grafana:30080/public/build/app.6aa12092d3333cb24394.js:1:13819
1669/f</t.prototype.render@http://grafana:30080/public/build/0.6aa12092d3333cb24394.js:1:51006
onDataReceived@http://grafana:30080/public/plugins/marcuscalidus-svg-panel/svg_ctrl.js:332:25
o.prototype.emit@http://grafana:30080/public/build/vendor.6aa12092d3333cb24394.js:44:25348
a</e.prototype.emit@http://grafana:30080/public/build/app.6aa12092d3333cb24394.js:1:13819
1752/g</e.prototype.handleQueryResult@http://grafana:30080/public/build/0.6aa12092d3333cb24394.js:7:18465
u@http://grafana:30080/public/build/vendor.6aa12092d3333cb24394.js:87:68722
l/<@http://grafana:30080/public/build/vendor.6aa12092d3333cb24394.js:87:69127
$digest@http://grafana:30080/public/build/vendor.6aa12092d3333cb24394.js:87:74824
$apply@http://grafana:30080/public/build/vendor.6aa12092d3333cb24394.js:87:76636
x/s<@http://grafana:30080/public/build/vendor.6aa12092d3333cb24394.js:87:72695
i@http://grafana:30080/public/build/vendor.6aa12092d3333cb24394.js:87:21868
mt/l.defer/n<@http://grafana:30080/public/build/vendor.6aa12092d3333cb24394.js:87:23332
marcin-kasinski commented 6 years ago

Sorry. It is my fault again.

marcin-kasinski commented 6 years ago

It works if I choose "last 5 minutes". It doesn't work with "Last 12 hours"

I have no idea why... I think it should work with both ranges. Any hint please ?

MarcusCalidus commented 6 years ago

As I understand that stats.current only holds the last value that was retrieved. I guess you can tweak that behaviour with the way you are grouping your data like so: image So there should not be nulls in the selection. But that is a long shot, not sure if that works.