[rrd-developers] NAN-safe ADD

Alex van den Bogaerdt alex at ergens.op.het.net
Thu Mar 6 05:13:53 CET 2008

On Thu, Mar 06, 2008 at 01:44:30AM +0100, Timo Stripf wrote:
> Hello,
> i've implemented a nan-safe add operator (ADDNAN) into rrd. I used it 
> to add several incomplete graphs.
> NaN + NaN => NaN
>  x + NaN => x
>  NaN + y => y
>  x + y => x + y

I understand why you would consider this useful.

However, I also think it can be dangerous, especially to newcomers.

Consider two datasources (e.g. two uplinks). One is constant at
(<whatever>, say:) 10Mbps, the other at 20Mbps.

Suddenly something fails somewhere for whatever reason, and getting
stats from one of the two datasources fails.  The user ends up with
a gap in his graph.

I can see the following Q&A happening on the mailinglist, often:
Q: how to fix this?
A: use 'ADDNAN' instead of '+' <period>

Result: only 20 (or 10) Mbps is shown on the graph. The problem is
not fixed. Eventually this user is going to complain that "RRDtool
provides a wrong picture".

This scenario is even more likely if the datasources do not provide
constant or near constant rates.

Things get even worse when the X-files factor comes into play and one
RRA does have an unknown while the other doesn't.

Quite often 'NaN' does not mean 'nothing'.  In many cases substituting
the average of the two neighbours (not direct neighbours per se) would
make more sense.

At the very least I think this feature deserves more documentation than
just a line or two.

Just my 2 cents.
Alex van den Bogaerdt

More information about the rrd-developers mailing list