fix log transformation if data is <=0

Bug #690586 reported by Christian
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Graphite
Fix Released
Undecided
Unassigned

Bug Description

If you append to use log transformation on data that contains a 0.0 value in it, you will end up with a broken image and debug reports log math function has failed.

I have submitted a patch that simply checks value before calling log math function and ensures values <=0.0 are ignored.

Revision history for this message
Christian (cboitel) wrote :
Revision history for this message
Jon Stevens (latchkey-gmail) wrote :

Seems to partially work, I'm still seeing this stack trace:

Traceback (most recent call last):
  File "/usr/lib/pymodules/python2.6/django/core/handlers/base.py", line 92, in get_response
    response = callback(request, *callback_args, **callback_kwargs)
  File "/opt/graphite/webapp/graphite/render/views.py", line 97, in renderView
    seriesList = evaluateTarget(target, timeInterval)
  File "/opt/graphite/webapp/graphite/render/evaluator.py", line 14, in evaluateTarget
    result = evaluateTokens(tokens, timeInterval)
  File "/opt/graphite/webapp/graphite/render/evaluator.py", line 30, in evaluateTokens
    return evaluateTokens(tokens.expression, timeInterval, originalTime)
  File "/opt/graphite/webapp/graphite/render/evaluator.py", line 62, in evaluateTokens
    return func(*args)
  File "/opt/graphite/webapp/graphite/render/functions.py", line 386, in stdev
    avg = safeDiv(safeSum(series[:time]), time)
  File "/opt/graphite/webapp/graphite/render/functions.py", line 386, in <lambda>
    avg = safeDiv(safeSum(series[:time]), time)
TypeError: unsupported operand type(s) for *: 'NoneType' and 'NoneType'

Revision history for this message
chrismd (chrismd) wrote :

Hm... that stack trace looks a bit odd. The last stack frame says it is in a lambda, which the previous frame doesn't contain. Also I don't see how that exception could be raised from that line of code. My guess is that the running code that threw this exception differs somehow from the code on the filesystem, have you recently updated functions.py? Also can you provide the query-string parameters for the request that threw this error?

Revision history for this message
chrismd (chrismd) wrote :

Thanks for the patch Christian, it works for me

Changed in graphite:
status: New → Fix Committed
chrismd (chrismd)
Changed in graphite:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Patches

Remote bug watches

Bug watches keep track of this bug in other bug trackers.