Skip to content

Commit 8e6388b

Browse files
.
1 parent 3f301d0 commit 8e6388b

File tree

2 files changed

+6
-9
lines changed

2 files changed

+6
-9
lines changed

package/sbin/healthcheck.py

+4-7
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,12 @@ def get_list_of_destinations():
1919
found_destinations = []
2020
regex = r"^SC4S_DEST_SPLUNK_HEC_(.*)_URL$"
2121

22-
for env_var_key, _ in os.environ.items():
23-
if re.search(regex, env_var_key):
24-
found_destinations.append(env_var_key)
25-
print("Found destinations: {}".format(set(found_destinations)))
22+
for var_key, var_variable in os.environ.items():
23+
if re.search(regex, var_key):
24+
found_destinations.append(var_variable)
2625
return set(found_destinations)
2726

2827
class Config:
29-
SC4S_DEST_SPLUNK_HEC_DEFAULT_URL = os.getenv('SC4S_DEST_SPLUNK_HEC_DEFAULT_URL')
3028
HEALTHCHECK_PORT = int(os.getenv('SC4S_LISTEN_STATUS_PORT', '8080'))
3129
CHECK_QUEUE_SIZE = str_to_bool(os.getenv('HEALTHCHECK_CHECK_QUEUE_SIZE', "false"))
3230
MAX_QUEUE_SIZE = int(os.getenv('HEALTHCHECK_MAX_QUEUE_SIZE', '10000'))
@@ -85,8 +83,7 @@ def check_queue_size(
8583
stats = result.stdout.splitlines()
8684

8785
queue_sizes_all_destinations = []
88-
logger.error(f"Destinations {sc4s_dest_splunk_hec_destinations}.")
89-
logger.error(f"Stats {stats}.")
86+
9087
for destination in sc4s_dest_splunk_hec_destinations:
9188
destination_stat = next(
9289
(s for s in stats if ";queued;" in s and destination in s),

tests/test_healthcheck_unit_tests.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -216,5 +216,5 @@ def test_get_destinations():
216216
destinations = get_list_of_destinations()
217217

218218
assert len(destinations) == 2
219-
assert "SC4S_DEST_SPLUNK_HEC_DEFAULT_URL" in destinations
220-
assert "SC4S_DEST_SPLUNK_HEC_OTHER_URL" in destinations
219+
assert "http://my_test_url:1234" in destinations
220+
assert "http://my_hec:1234" in destinations

0 commit comments

Comments
 (0)