← Back to team overview

graphite-dev team mailing list archive

Re: [Question #90633]: How do you graph switch interface counters that rollover?

 

Question #90633 on Graphite changed:
https://answers.launchpad.net/graphite/+question/90633

    Status: Open => Answered

chrismd proposed the following answer:
Yes this is actually a tricky problem. So nonNegativeDerivative just
calculates the differences between each two successive data points and
displays that, unless the difference is negative in which case it
displays zero. The reason this is tricky is because the only way for
graphite to display the "correct" value is to know what the maximum
value is (ie. where the counter wraps). Since graphite doesn't know that
we have to basically just make up a value and initially I chose zero as
a default. My counters tend to wrap infrequently and I liked seeing the
zero as an indication that they had. In your case it sounds like it
would be better to just retain the previous value. I don't really like
either solution because both are inaccurately representing the real
data.

So I think I've come up with a good solution that can more accurately
represent the data. What I'll do is change the default behavior to be
that whenever the difference between two successive data points is
negative I'll have it yield a null value (a gap in the data). This is
technically more "honest" since graphite doesn't know what the value is.
What you can do then is simply wrap these calls with the keepLastValue()
function which replaces all null values with the closest non-null value
that precedes them.

In addition I'll add the ability to specify an extra parameter to
nonNegativeDerivative that specifies the maximum value explicitly. Using
this should make the graph always be accurate. Technically it is
possible for the counter to wrap more than once within an interval but
there's no way for graphite to handle that case so I'll just ignore it
:)

-- 
You received this question notification because you are a member of
graphite-dev, which is an answer contact for Graphite.