diff --git a/src/horizon/worker.py b/src/horizon/worker.py index 705e0acc..8512bd7a 100644 --- a/src/horizon/worker.py +++ b/src/horizon/worker.py @@ -45,6 +45,16 @@ def in_skip_list(self, metric_name): return False + def in_include_list(self, metric_name): + """ + Check if the metric is in INCLUDE_LIST. + """ + for to_include in settings.INCLUDE_LIST: + if to_include in metric_name: + return True + + return False + def send_graphite_metric(self, name, value): if settings.GRAPHITE_HOST != '': sock = socket.socket() @@ -87,6 +97,9 @@ def run(self): for metric in chunk: + if settings.INCLUDE_LIST and not self.in_include_list(metric[0]): + continue + # Check if we should skip it if self.in_skip_list(metric[0]): continue diff --git a/src/settings.py.example b/src/settings.py.example index c128fe88..dc671d91 100644 --- a/src/settings.py.example +++ b/src/settings.py.example @@ -217,6 +217,10 @@ SKIP_LIST = [ #'.count_ps', #'.sum', ] +INCLUDE_LIST = [ + #'some.metric.to.include', + # populate this list to selectively include metrics +] """