fix log transformation if data is <=0

Reported by Christian on 2010-12-15
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.

Christian (cboitel) wrote :
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'

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?

chrismd (chrismd) wrote :

Thanks for the patch Christian, it works for me

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

Other bug subscribers

Patches