LowPowerLab Forum

Software support => Pi Gateway => Topic started by: Lensdigital on February 02, 2016, 02:32:52 PM

Title: One metric shows on graph, other one doesn't
Post by: Lensdigital on February 02, 2016, 02:32:52 PM
I have this definition in matrics.js file:
// Mailbox
  Mbox_open : { name:'MBox', regexp:/MBOX\:O/i, value:'OPENED', pin:1, graph:1, logValue:1, graphOptions:{ legendLbl:'Mailbox', lines: { show:false, fill:false }, points: { show: true, radius: 5, lineWidth:1 }, grid: { backgroundColor: {colors:['#000', '#03c', '#08c']}}, yaxis: { ticks: 0 }}},
  MBox_closed : { name:'MBox', regexp:/MBOX\:C/i, value:'CLOSED', pin:1, graph:1, logValue:1, graphOptions:{ legendLbl:'Mailbox', lines: { show:false, fill:false }, points: { show: true, radius: 5, lineWidth:1 }, grid: { backgroundColor: {colors:['#000', '#03c', '#08c']}}, yaxis: { ticks: 0 }}},
 

For some reason OPENED event shows on graph, but CLOSED doesn't.  In the status I have no problem seeing one or the other... Both definitions are virtually identical except for value.  Any clue why second one doesn't graph?

I'm using V8 gateway btw.
Title: Re: One metric shows on graph, other one doesn't
Post by: Felix on February 02, 2016, 11:35:43 PM
Your logValue:1 can't be the same, i think that should fix it.
Look at the garage mote metrics (https://github.com/LowPowerLab/RaspberryPi-Gateway/blob/master/metrics.js#L47).............
Title: Re: One metric shows on graph, other one doesn't
Post by: Lensdigital on February 03, 2016, 12:48:29 PM
Quote from: Felix on February 02, 2016, 11:35:43 PM
Your logValue:1 can't be the same, i think that should fix it.
Look at the garage mote metrics (https://github.com/LowPowerLab/RaspberryPi-Gateway/blob/master/metrics.js#L47).............
Thanks Felix! Changed one of them to logValue:1.1
That was easy :)
Title: Re: One metric shows on graph, other one doesn't
Post by: Felix on February 03, 2016, 02:52:46 PM
Works now?
Title: Re: One metric shows on graph, other one doesn't
Post by: Lensdigital on February 03, 2016, 03:09:26 PM
Quote from: Felix on February 03, 2016, 02:52:46 PM
Works now?
Strangely no :( And it broke SMS for some reason. I'll try few things when I get home...
Title: Re: One metric shows on graph, other one doesn't
Post by: Felix on February 03, 2016, 04:00:06 PM
Use an INTEGER for value not decimal.
Title: Re: One metric shows on graph, other one doesn't
Post by: Lensdigital on February 03, 2016, 04:33:39 PM
Quote from: Felix on February 03, 2016, 04:00:06 PM
Use an INTEGER for value not decimal.
Oops ok I'll try that :) I saw that your garage example used 1.1 and 0.5 and thought it was ok ...
Title: Re: One metric shows on graph, other one doesn't
Post by: Felix on February 03, 2016, 08:19:40 PM
It should be yes but for ease and clarity please use integers until we iron out the details.
Title: Re: One metric shows on graph, other one doesn't
Post by: Lensdigital on February 03, 2016, 08:55:51 PM
Ok I now understand what happens.
Value is actual data value, so it shows up higher or lower on the graph. It was actually working with 1.1 as I see that value now.
Problem is that very last event is never shown on the graph at all for some reason...
Let's say MBox was opened at 20:00. I get alert and see status changed, but no dot on the graph.
Then at 20:05 Mbox closes and now I see dot for OPEN but not for close. And so on. Bug? :)
At any rate it works for me! I assigned OPEN value 2 and CLOSE value 1 so OPEN is shown as higher dot :)
Title: Re: One metric shows on graph, other one doesn't
Post by: Felix on February 03, 2016, 10:54:08 PM
Quote from: Lensdigital on February 03, 2016, 08:55:51 PM
Then at 20:05 Mbox closes and now I see dot for OPEN but not for close. And so on. Bug? :)

Yup that is actually a bug I am aware of and trying to fix. Basically some data is filtered out and it tends to be the last edge points of the graph, so your last dot in the data store would be filtered out. Annoying but as soon as more data is added that dot will show and not the newest one and so on.
On my to-fix list...
Title: Re: One metric shows on graph, other one doesn't
Post by: Felix on February 04, 2016, 03:54:17 PM
OK just FYI I think I fixed the graph bug where the last dot does not show.
I also released other changes which allow the node list to be sortable on a desktop browser - to make this work on a mobile device is possible but not without some undesirable behavior so I decided to make the list sortable on desktop browsing only. Anyway it's a bug fix and new feature release, check it out.
Title: Re: One metric shows on graph, other one doesn't
Post by: Lensdigital on February 04, 2016, 05:13:38 PM
Thanks Felix!  I updated logUtil.js, gateway.js and index.html.... After this I do see last CLOSED event, but 2 previous OPENED evens are now gone :(
I restored previous logUtil.js and OPEN evens are back... See screenshot
Title: Re: One metric shows on graph, other one doesn't
Post by: Felix on February 04, 2016, 07:11:39 PM
What happens if you zoom into the graph where your OPEN events used to be? Do they show up?
Title: Re: One metric shows on graph, other one doesn't
Post by: Lensdigital on February 04, 2016, 07:46:24 PM
Yes I see summer older stats if I zoom out. For now I rolled back
Title: Re: One metric shows on graph, other one doesn't
Post by: Felix on February 04, 2016, 08:59:08 PM
I basically made a small change that would ensure the last point in a graph is captured in the graph.
Otherwise the bulk of the other points should be the same. Perhaps increasing the 600 points limit in logUtil.js might make a difference. This can be especially true if those 4 points are very close to each other with respect with the rest of the graph which is empty. The data is aggregated with binary search, so it will pull the closest point to a fixed unit of time.