graphite-dev team mailing list archive
-
graphite-dev team
-
Mailing list archive
-
Message #05484
[Question #264196]: keepLastValue behaviour
New question #264196 on Graphite:
https://answers.launchpad.net/graphite/+question/264196
Hi,
Let consider this series stored in DB: 10, 20, None, 40, 50, None, None, None, None, None, 110
When Calling keepLastValue(3), then I would expect the following series as a result:
10, 20, 20, 40, 50, 50, 50, None, None, None, 110
or:
10, 20, 20, 40, 50, 50, 50, 50, None, None, 110
(depending on if the "last value" is included in the count).
But current behaviour is to return:
10, 20, 20, 40, 50, None, None, None, None, None, 110
i.e. no value is repeated after 50 since the number of consecutiveNones between value 50 and value 110 is greater than the provided limit (5>3).
So, from the documentation, I would expect the keepLastValue function to behave like this:
----
def keepLastValue(requestContext, seriesList, limit = INF):
for series in seriesList:
series.name = "keepLastValue(%s)" % (series.name)
series.pathExpression = series.name
consecutiveNones = 0
last = None
for i,value in enumerate(series):
#series[i] = value
if value is None:
if last is None:
continue
consecutiveNones += 1
if 0 < consecutiveNones < limit:
series[i] = last
else:
last = value
consecutiveNones = 0
return seriesList
----
If it is not the expected behaviour, then this is a behaviour I am looking for from Graphite so it would be nice to add a function for this (something like "repeatLastValueIfNone(requestContext, seriesList, lim)")
Cheers,
Fabien
--
You received this question notification because you are a member of
graphite-dev, which is an answer contact for Graphite.