Skip to content

Commit

Permalink
compute sample as dictionary once
Browse files Browse the repository at this point in the history
we shouldn't be wasting time doing the same thing over and over
in loop

Change-Id: Iaa5aeb5b91004945a24fab105c8b4884918c1644
  • Loading branch information
chungg authored and dchavoll committed Aug 15, 2018
1 parent e516e82 commit 7275dd5
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion ceilometer/publisher/gnocchi.py
Expand Up @@ -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
Expand Down

0 comments on commit 7275dd5

Please sign in to comment.