needless looping in legacy pipeline code

Bug #1401176 reported by gordon chung
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Ceilometer
Fix Released
Low
gordon chung

Bug Description

when publishing samples, the pipeline will sort the samples by name and also group them by name... this is legacy code which was previously used so we could effectively filter samples. the location of filtering samples has moved to an earlier stage so the groupby isn't needed anymore. furthermore, the publisher should not be worrying about sorting what it publishes, it should just push stuff out as quick as possible.

removing this should at worse do nothing. at best, it removes additional looping and thus improves performance.

code in question:

    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)

ref: https://github.com/openstack/ceilometer/blob/master/ceilometer/pipeline.py#L314-L318

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to ceilometer (master)

Fix proposed to branch: master
Review: https://review.openstack.org/140772

Changed in ceilometer:
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to ceilometer (master)

Reviewed: https://review.openstack.org/140772
Committed: https://git.openstack.org/cgit/openstack/ceilometer/commit/?id=494689ff9ed52a32208a1c9966d30c50c0a3af3b
Submitter: Jenkins
Branch: master

commit 494689ff9ed52a32208a1c9966d30c50c0a3af3b
Author: gordon chung <email address hidden>
Date: Wed Dec 10 11:53:14 2014 -0500

    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

Changed in ceilometer:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in ceilometer:
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in ceilometer:
milestone: kilo-1 → 2015.1.0
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.