Cheers Sergey,
I mentioned the other day I had a hunch it was in that line :-) I was literally just about to sit down and take a look at it so I'm glad that I opened my mail when I did.

Thanks for getting there first, I'll can put my feet up now :-)

Couple of comments inline below....

Frase


On 08/02/13 10:48, Zhemzhitsky Sergey wrote:

TypeError: stats.get(...) is undefined
while ((stats.get(i)[TIMESTAMP] < minimumTimestamp) && (i < limit)) i++;


I've debugged a little bit and found the following:

1. msgDepth stats is not a rate stats

var isRate = (description == "msgDepth") ? false : true
Yup that's exactly right, msgDepth is the only statistic being graphed that isn't a rate - I figured that as things like msgTotalEnqueues etc. are all absolute monotonically increasing values then it was more useful to graph the rate.

Unfortunately it's a surprising pain in the butt to do that. When I started I got some weird results then realised that when I add queues etc. I was getting statistic updates in rapid succession, which was (when I thought about it) causing much higher instantaneous rate values. The while loop where the error is is trying to ensure that the time delta used is (roughly) 10 seconds.


2. Next limit=size for a not rate stats

var limit = isRate ? size - 1 : size

3.  Then if we look at

while ((stats.get(i)[TIMESTAMP] < minimumTimestamp) && (i < limit)) i++;

the first part of the while loop condition will be executed twice (i=0, i=1) 
for limit=size=1 and i=0
so, for i=1 and size=1, stats.get(i) is undefined

What we have to do is to reorder the while loop conditions and everything will 
be fine, i.e.

while ((i < limit) && (stats.get(i)[TIMESTAMP] < minimumTimestamp)) i++;


Well spotted! Good old short circuit boolean evaluation, our friend once again.....

To be honest I'm really surprised that I haven't hit this more often myself, as I say I almost never see this problem kicking in, so I'd forgotten about it.

Between you and Bruno Matos you're really piling up my "null pointer" shame this week :-[

Nice one!
Cheers,






---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@qpid.apache.org
For additional commands, e-mail: users-h...@qpid.apache.org

Reply via email to