Skip to content

Commit 204a02b

Browse files
committed
Merge pull request #9 from varjoranta/master
fix commenting out all metrics funcs on key in config
2 parents 08a8e55 + c527959 commit 204a02b

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

postgresql_metrics/metrics_logic.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -110,12 +110,13 @@ def get_stats_functions_from_conf(func_key_name, conf):
110110
"""Finds the statistics function configured, and ensures that the callables
111111
are found from metrics_gatherer.py."""
112112
stats_functions = []
113-
for func_name, call_interval in conf[func_key_name]:
114-
stats_func = getattr(metrics_gatherer, func_name)
115-
if not stats_func or not callable(stats_func):
116-
raise Exception("statistics function '" + func_name +
117-
"' not found in configuration under key name: " + func_key_name)
118-
stats_functions.append((stats_func, int(call_interval)))
113+
if func_key_name in conf and conf[func_key_name] is not None:
114+
for func_name, call_interval in conf[func_key_name]:
115+
stats_func = getattr(metrics_gatherer, func_name)
116+
if not stats_func or not callable(stats_func):
117+
raise Exception("statistics function '" + func_name +
118+
"' not found in configuration under key name: " + func_key_name)
119+
stats_functions.append((stats_func, int(call_interval)))
119120
return stats_functions
120121

121122

0 commit comments

Comments
 (0)