Improve a bit performance of Ceilometer
we shouldn't use <array>.extend([<generator>]) it's similiar to <array>.extend(<generator>) but slower Change-Id: Ic859e9a477f03b680e1ac0db1498261a3dc24997
This commit is contained in:
parent
09720bf524
commit
89b325c3e9
@ -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'])
|
||||
|
@ -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'])
|
||||
|
@ -67,9 +67,9 @@ class NotificationBase(PluginBase):
|
||||
|
||||
targets = []
|
||||
for exchange, topics in self.get_exchange_topics(conf):
|
||||
targets.extend([oslo.messaging.Target(topic=topic,
|
||||
targets.extend(oslo.messaging.Target(topic=topic,
|
||||
exchange=exchange)
|
||||
for topic in topics])
|
||||
for topic in topics)
|
||||
return targets
|
||||
|
||||
@abc.abstractmethod
|
||||
|
@ -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
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user