Skip to content
This repository was archived by the owner on Dec 18, 2019. It is now read-only.

Adding whitelist feature to worker.py and settings.py.example #75

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions src/horizon/worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions src/settings.py.example
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,10 @@ SKIP_LIST = [
#'.count_ps',
#'.sum',
]
INCLUDE_LIST = [
#'some.metric.to.include',
# populate this list to selectively include metrics
]


"""
Expand Down