From 7275dd59124260df18bb6d3f78b2737297fe298d Mon Sep 17 00:00:00 2001 From: gord chung Date: Fri, 24 Nov 2017 17:11:02 -0500 Subject: [PATCH] compute sample as dictionary once we shouldn't be wasting time doing the same thing over and over in loop Change-Id: Iaa5aeb5b91004945a24fab105c8b4884918c1644 --- ceilometer/publisher/gnocchi.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ceilometer/publisher/gnocchi.py b/ceilometer/publisher/gnocchi.py index 16872c33..5cfea378 100644 --- a/ceilometer/publisher/gnocchi.py +++ b/ceilometer/publisher/gnocchi.py @@ -123,8 +123,9 @@ def event_match(self, event_type): def sample_attributes(self, sample): attrs = {} + sample_dict = sample.as_dict() for name, definition in self._attributes.items(): - value = definition.parse(sample.as_dict()) + value = definition.parse(sample_dict) if value is not None: attrs[name] = value return attrs