Hello, > Do let me know as soon as you have something for me to test and I'll be > there!
I have uploaded 0.9.12+debian-7 to unstable with the patched included. It worked for me. Could you please test it also? debdiff graphite-web_0.9.12+debian-6_all.deb graphite-web_0.9.12+debian-7_all.deb File lists identical (after any substitutions) Control files: lines which differ (wdiff format) ------------------------------------------------ Installed-Size: [-8384-] {+8385+} Version: [-0.9.12+debian-6-] {+0.9.12+debian-7+} Attached the debdiff source patch. Greets, Jonas
diff -Nru graphite-web-0.9.12+debian/debian/changelog graphite-web-0.9.12+debian/debian/changelog --- graphite-web-0.9.12+debian/debian/changelog 2014-09-03 19:47:00.000000000 +0200 +++ graphite-web-0.9.12+debian/debian/changelog 2015-01-29 12:37:32.000000000 +0100 @@ -1,3 +1,10 @@ +graphite-web (0.9.12+debian-7) unstable; urgency=low + + * added patch for maxDataPoints + huge performance impact for dashboards like grafana (Closes: #775783) + + -- Jonas Genannt <jonas.gena...@capi2name.de> Thu, 29 Jan 2015 12:36:30 +0100 + graphite-web (0.9.12+debian-6) unstable; urgency=medium [ Vincent Bernat ] diff -Nru graphite-web-0.9.12+debian/debian/patches/add_maximum_returned_datapoints.patch graphite-web-0.9.12+debian/debian/patches/add_maximum_returned_datapoints.patch --- graphite-web-0.9.12+debian/debian/patches/add_maximum_returned_datapoints.patch 1970-01-01 01:00:00.000000000 +0100 +++ graphite-web-0.9.12+debian/debian/patches/add_maximum_returned_datapoints.patch 2015-01-29 12:37:32.000000000 +0100 @@ -0,0 +1,71 @@ +From 5b1015df91b7740a96299594a3a1727238517c20 Mon Sep 17 00:00:00 2001 +Author: Philip Hoy, gingerlime +Date: Sun, 19 May 2013 10:56:28 +0200 +Description: Added ability to set maximum returned datapoints for json requests + This is a backport for the 0.9.x branch of Graphite. + This patch is a huge performance impact for dashboards like grafana. + +--- + webapp/graphite/render/views.py | 35 +++++++++++++++++++++++++++++++---- + 1 file changed, 31 insertions(+), 4 deletions(-) + +diff --git a/webapp/graphite/render/views.py b/webapp/graphite/render/views.py +index 34b2710..813d002 100644 +--- a/webapp/graphite/render/views.py ++++ b/webapp/graphite/render/views.py +@@ -12,6 +12,7 @@ + See the License for the specific language governing permissions and + limitations under the License.""" + import csv ++import math + from datetime import datetime + from time import time + from random import shuffle +@@ -128,10 +129,34 @@ def renderView(request): + + if format == 'json': + series_data = [] +- for series in data: +- timestamps = range(series.start, series.end, series.step) +- datapoints = zip(series, timestamps) +- series_data.append( dict(target=series.name, datapoints=datapoints) ) ++ if 'maxDataPoints' in requestOptions and any(data): ++ startTime = min([series.start for series in data]) ++ endTime = max([series.end for series in data]) ++ timeRange = endTime - startTime ++ maxDataPoints = requestOptions['maxDataPoints'] ++ for series in data: ++ numberOfDataPoints = timeRange/series.step ++ if maxDataPoints < numberOfDataPoints: ++ valuesPerPoint = math.ceil(float(numberOfDataPoints) / float(maxDataPoints)) ++ secondsPerPoint = int(valuesPerPoint * series.step) ++ # Nudge start over a little bit so that the consolidation bands align with each call ++ # removing 'jitter' seen when refreshing. ++ nudge = secondsPerPoint + (series.start % series.step) - (series.start % secondsPerPoint) ++ series.start = series.start + nudge ++ valuesToLose = int(nudge/series.step) ++ for r in range(1, valuesToLose): ++ del series[0] ++ series.consolidate(valuesPerPoint) ++ timestamps = range(series.start, series.end, secondsPerPoint) ++ else: ++ timestamps = range(series.start, series.end, series.step) ++ datapoints = zip(series, timestamps) ++ series_data.append(dict(target=series.name, datapoints=datapoints)) ++ else: ++ for series in data: ++ timestamps = range(series.start, series.end, series.step) ++ datapoints = zip(series, timestamps) ++ series_data.append( dict(target=series.name, datapoints=datapoints) ) + + if 'jsonp' in requestOptions: + response = HttpResponse( +@@ -230,6 +255,8 @@ def parseOptions(request): + requestOptions['jsonp'] = queryParams['jsonp'] + if 'noCache' in queryParams: + requestOptions['noCache'] = True ++ if 'maxDataPoints' in queryParams and queryParams['maxDataPoints'].isdigit(): ++ requestOptions['maxDataPoints'] = int(queryParams['maxDataPoints']) + + requestOptions['localOnly'] = queryParams.get('local') == '1' + diff -Nru graphite-web-0.9.12+debian/debian/patches/series graphite-web-0.9.12+debian/debian/patches/series --- graphite-web-0.9.12+debian/debian/patches/series 2014-09-03 19:47:00.000000000 +0200 +++ graphite-web-0.9.12+debian/debian/patches/series 2015-01-29 12:37:32.000000000 +0100 @@ -6,3 +6,4 @@ remove_internal_logrotate.patch django1.6_compatibility.patch remove_graphlot.patch +add_maximum_returned_datapoints.patch
signature.asc
Description: PGP signature