From d24d4825813f2573b1add53f070aa0c2ee289edf Mon Sep 17 00:00:00 2001 From: James Sullivan Date: Tue, 23 Oct 2012 13:41:16 -0400 Subject: [PATCH 1/3] removed unused variable declaration (pep) --- pyawschart/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyawschart/__init__.py b/pyawschart/__init__.py index fca1409..1694df1 100644 --- a/pyawschart/__init__.py +++ b/pyawschart/__init__.py @@ -85,7 +85,7 @@ def _get_datapoints(self): def _get_chart(self): if not self._chart: - datapoints = self._get_datapoints() + self._get_datapoints() data = [datapoint['Average'] for datapoint in self._datapoints] # Set the vertical range from 0 to 100 From 0232b8ac27040548da7dcade58281ad560172451 Mon Sep 17 00:00:00 2001 From: James Sullivan Date: Tue, 23 Oct 2012 13:43:31 -0400 Subject: [PATCH 2/3] support 'Sum' statistic (used by elb 5xx) --- pyawschart/__init__.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pyawschart/__init__.py b/pyawschart/__init__.py index 1694df1..40d16b5 100644 --- a/pyawschart/__init__.py +++ b/pyawschart/__init__.py @@ -83,11 +83,15 @@ def _get_datapoints(self): ) return self._datapoints + def _get_chart(self): if not self._chart: self._get_datapoints() - data = [datapoint['Average'] for datapoint in self._datapoints] + key = 'Sum' if self._datapoints and 'Sum' in self._datapoints[0] + else 'Average' + data = [datapoint[key] for datapoint in self._datapoints] + # Set the vertical range from 0 to 100 max_y = 1 if data: From 585901248f8c13ed49b4c133f37b63f985bf7709 Mon Sep 17 00:00:00 2001 From: James Sullivan Date: Tue, 23 Oct 2012 15:08:25 -0400 Subject: [PATCH 3/3] fix RequestCountChart stats and unit --- pyawschart/elb.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pyawschart/elb.py b/pyawschart/elb.py index 90a627f..345ad32 100644 --- a/pyawschart/elb.py +++ b/pyawschart/elb.py @@ -26,8 +26,8 @@ def __init__(self, cloudwatch_connection=None, instance=None, range=None): ELBChart.__init__(self, cloudwatch_connection, instance, range) self.metric_verbose = 'Request count' self.args['metric'] = 'RequestCount' - self.args['statistics'] = 'Average' - self.args['unit'] = 'Count/Second' + self.args['statistics'] = 'Sum' + self.args['unit'] = 'Count' CHART_CLASSES.append(RequestCountChart)