From 89b325c3e91ee5e571ac32024ecf47265760dce5 Mon Sep 17 00:00:00 2001 From: Boris Pavlovic Date: Mon, 30 Jun 2014 22:11:25 +0400 Subject: [PATCH] Improve a bit performance of Ceilometer we shouldn't use .extend([]) it's similiar to .extend() but slower Change-Id: Ic859e9a477f03b680e1ac0db1498261a3dc24997 --- ceilometer/network/statistics/opencontrail/client.py | 4 ++-- ceilometer/network/statistics/opendaylight/client.py | 4 ++-- ceilometer/plugin.py | 6 +++--- ceilometer/storage/hbase/utils.py | 4 ++-- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/ceilometer/network/statistics/opencontrail/client.py b/ceilometer/network/statistics/opencontrail/client.py index 2e6e6bdee..d9b37e8cc 100644 --- a/ceilometer/network/statistics/opencontrail/client.py +++ b/ceilometer/network/statistics/opencontrail/client.py @@ -130,8 +130,8 @@ class AnalyticsAPIBaseClient(object): dump.append('HTTP %.1f %s %s\n' % (resp.raw.version, resp.status_code, resp.reason)) - dump.extend(['%s: %s\n' % (k, v) - for k, v in six.iteritems(resp.headers)]) + dump.extend('%s: %s\n' % (k, v) + for k, v in six.iteritems(resp.headers)) dump.append('\n') if resp.content: dump.extend([resp.content, '\n']) diff --git a/ceilometer/network/statistics/opendaylight/client.py b/ceilometer/network/statistics/opendaylight/client.py index a0162a1b3..38f201836 100644 --- a/ceilometer/network/statistics/opendaylight/client.py +++ b/ceilometer/network/statistics/opendaylight/client.py @@ -213,8 +213,8 @@ class Client(): dump.append('HTTP %.1f %s %s\n' % (resp.raw.version, resp.status_code, resp.reason)) - dump.extend(['%s: %s\n' % (k, v) - for k, v in six.iteritems(resp.headers)]) + dump.extend('%s: %s\n' % (k, v) + for k, v in six.iteritems(resp.headers)) dump.append('\n') if resp.content: dump.extend([resp.content, '\n']) diff --git a/ceilometer/plugin.py b/ceilometer/plugin.py index 8a6a46ebf..c69e5272e 100644 --- a/ceilometer/plugin.py +++ b/ceilometer/plugin.py @@ -67,9 +67,9 @@ class NotificationBase(PluginBase): targets = [] for exchange, topics in self.get_exchange_topics(conf): - targets.extend([oslo.messaging.Target(topic=topic, - exchange=exchange) - for topic in topics]) + targets.extend(oslo.messaging.Target(topic=topic, + exchange=exchange) + for topic in topics) return targets @abc.abstractmethod diff --git a/ceilometer/storage/hbase/utils.py b/ceilometer/storage/hbase/utils.py index ae66f1eef..38744d264 100644 --- a/ceilometer/storage/hbase/utils.py +++ b/ceilometer/storage/hbase/utils.py @@ -200,9 +200,9 @@ def get_meter_columns(metaquery, **kwargs): column name in db """ columns = ['f:message', 'f:recorded_at'] - columns.extend(["f:%s" % k for k, v in kwargs.items() if v]) + columns.extend("f:%s" % k for k, v in kwargs.items() if v) if metaquery: - columns.extend(["f:r_%s" % k for k, v in metaquery.items() if v]) + columns.extend("f:r_%s" % k for k, v in metaquery.items() if v) return columns