Skip to content

Commit

Permalink
Merge pull request #1939 from jamesandariese/refactor-list-comprehens…
Browse files Browse the repository at this point in the history
…ions

removed the uses of list comprehensions as looping constructs.
  • Loading branch information
Remi Hakim committed Sep 23, 2015
2 parents 40f8da8 + 87724cd commit 580faf8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
3 changes: 2 additions & 1 deletion checks.d/postgres.py
Original file line number Diff line number Diff line change
Expand Up @@ -508,7 +508,8 @@ def _collect_stats(self, key, db, instance_tags, relations, custom_metrics):
# v[0] == (metric_name, submit_function)
# v[1] == the actual value
# tags are
[v[0][1](self, v[0][0], v[1], tags=tags) for v in values]
for v in values:
v[0][1](self, v[0][0], v[1], tags=tags)

cursor.close()
except InterfaceError, e:
Expand Down
7 changes: 5 additions & 2 deletions checks.d/riak.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ class Riak(AgentCheck):
def __init__(self, name, init_config, agentConfig, instances=None):
AgentCheck.__init__(self, name, init_config, agentConfig, instances)
for k in ["mean", "median", "95", "99", "100"]:
[self.keys.append(m + "_" + k) for m in self.stat_keys]
for m in self.stat_keys:
self.keys.append(m + "_" + k)

self.prev_coord_redirs_total = -1

Expand Down Expand Up @@ -81,7 +82,9 @@ def check(self, instance):
self.service_check(
self.SERVICE_CHECK_NAME, AgentCheck.OK, tags=service_check_tags)

[self.gauge("riak." + k, stats[k], tags=tags) for k in self.keys if k in stats]
for k in self.keys:
if k in stats:
self.gauge("riak." + k, stats[k], tags=tags)

coord_redirs_total = stats["coord_redirs_total"]
if self.prev_coord_redirs_total > -1:
Expand Down

0 comments on commit 580faf8

Please sign in to comment.