remove useless looping in pipeline
previously, the pipeline filtered at the publisher stage. this logic has been moved to an earlier stage yet we still do processing at publisher. this patch removes legacy code. at worse, it will have no effect on performance. at best, we publish quicker as we don't loop and groupby needlessly for each batch of samples. Change-Id: I2171c067bd8bb293a8478756f8b4938f312614a1 Closes-Bug: #1401176
This commit is contained in:
parent
9af8f521e3
commit
494689ff9e
@ -18,8 +18,6 @@
|
||||
# under the License.
|
||||
|
||||
import fnmatch
|
||||
import itertools
|
||||
import operator
|
||||
import os
|
||||
|
||||
from oslo.config import cfg
|
||||
@ -312,10 +310,7 @@ class Sink(object):
|
||||
'pub': p}))
|
||||
|
||||
def publish_samples(self, ctxt, samples):
|
||||
for meter_name, samples in itertools.groupby(
|
||||
sorted(samples, key=operator.attrgetter('name')),
|
||||
operator.attrgetter('name')):
|
||||
self._publish_samples(0, ctxt, samples)
|
||||
self._publish_samples(0, ctxt, samples)
|
||||
|
||||
def flush(self, ctxt):
|
||||
"""Flush data after all samples have been injected to pipeline."""
|
||||
|
@ -869,11 +869,11 @@ class BasePipelineTestCase(base.BaseTestCase):
|
||||
pipe.publish_samples(None, counters)
|
||||
publisher = pipeline_manager.pipelines[0].publishers[0]
|
||||
self.assertEqual(2, len(publisher.samples))
|
||||
core_temp = publisher.samples[1]
|
||||
core_temp = publisher.samples[0]
|
||||
self.assertEqual('core_temperature', getattr(core_temp, 'name'))
|
||||
self.assertEqual('°F', getattr(core_temp, 'unit'))
|
||||
self.assertEqual(96.8, getattr(core_temp, 'volume'))
|
||||
amb_temp = publisher.samples[0]
|
||||
amb_temp = publisher.samples[1]
|
||||
self.assertEqual('ambient_temperature', getattr(amb_temp, 'name'))
|
||||
self.assertEqual('°F', getattr(amb_temp, 'unit'))
|
||||
self.assertEqual(88.8, getattr(amb_temp, 'volume'))
|
||||
|
Loading…
x
Reference in New Issue
Block a user