graphite-api icon indicating copy to clipboard operation
graphite-api copied to clipboard

Render failure with movingAverage and from=-24h

Open KristianLyng opened this issue 9 years ago • 3 comments

http://172.17.0.78/render/?target=movingAverage(ping.e29-2.ipv4,2)&format=svg&from=-24h

Throws a tantrum/exception.

http://172.17.0.78/render/?target=movingAverage(ping.e29-2.ipv4,2)&format=svg&from=-25h http://172.17.0.78/render/?target=movingAverage(ping.e29-2.ipv4,2)&format=svg&from=-23h http://172.17.0.78/render/?target=ping.e29-2.ipv4&format=svg&from=-24h

etc work.

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/flask/app.py", line 1988, in wsgi_app
    response = self.full_dispatch_request()
  File "/usr/lib/python3/dist-packages/flask/app.py", line 1641, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/usr/lib/python3/dist-packages/flask/app.py", line 1544, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/usr/lib/python3/dist-packages/flask/_compat.py", line 33, in reraise
    raise value
  File "/usr/lib/python3/dist-packages/flask/app.py", line 1639, in full_dispatch_request
    rv = self.dispatch_request()
  File "/usr/lib/python3/dist-packages/flask/app.py", line 1625, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/usr/lib/python3/dist-packages/graphite_api/app.py", line 401, in render
    series_list = evaluateTarget(context, target, data_store)
  File "/usr/lib/python3/dist-packages/graphite_api/app.py", line 496, in evaluateTarget
    result = evaluateTokens(requestContext, tokens, data_store)
  File "/usr/lib/python3/dist-packages/graphite_api/app.py", line 506, in evaluateTokens
    return evaluateTokens(requestContext, tokens.expression, data_store)
  File "/usr/lib/python3/dist-packages/graphite_api/app.py", line 520, in evaluateTokens
    ret = func(requestContext, *args, **kwargs)
  File "/usr/lib/python3/dist-packages/graphite_api/functions.py", line 919, in movingAverage
    seconds=bootstrapSeconds)
  File "/usr/lib/python3/dist-packages/graphite_api/functions.py", line 2114, in _fetchWithBootstrap
    newValues.extend([value] * ratio)
TypeError: can't multiply sequence by non-int of type 'float'

(format can be blank too)

Using graphite-api 1.1.3 (or 1.1.3-2 from Debian Stretch, strictly speaking) guincorn3.

KristianLyng avatar Nov 06 '16 16:11 KristianLyng

I'm hitting this same thing with with holtWinters* too, but even more so. Presumably because it will use other time ranges behind the scenes to feed the algorithm.

I'm also noticing that my bandwidth metrics from SNMP are a lot less (if at all) susceptible to this. I'm speculating that this is related to them being positive integers (and always increasing) as opposed to floats. But it might also be related to the fact that I store latency data in 1s precision while snmp-data is stored in 60s precision, so there's going to be a lot more latency data than SNMP.

KristianLyng avatar Nov 17 '16 17:11 KristianLyng

Confirmed with

Package: graphite-api
Version: 1.1.3-2

(Debian stretch/testing)

I feel this might be related to downscaling happening.

Is this something an upgrade would fix?

horazont avatar Apr 08 '17 11:04 horazont

I also encountered this bug. Through my investigation, I found that the bug is caused because / in _fetchWithBootstrap returns float with Python3. https://github.com/brutasse/graphite-api/blob/1.1.3/graphite_api/functions.py#L2109

However, at the current Head, _fetchWithBootstrap has been completely remoevd by 7d9384021c8b9a8cbb16fd9960190908b4f2be72. So the bug would be fixed in the next release, or you can avoid the bug with the version 1.1.3 by using Python2.

choplin avatar Sep 05 '17 04:09 choplin