Skip to content

Commit 195d662

Browse files
authored
Fix domains-scrubber (#178)
1 parent 3ef55f7 commit 195d662

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

src/lumigo_tracer/lumigo_utils.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
import inspect
1717
import traceback
1818

19+
LUMIGO_DOMAINS_SCRUBBER_KEY = "LUMIGO_DOMAINS_SCRUBBER"
20+
1921
try:
2022
import botocore
2123
import boto3
@@ -182,9 +184,9 @@ def config(
182184
Configuration.send_only_if_error = os.environ.get("SEND_ONLY_IF_ERROR", "").lower() == "true"
183185
if domains_scrubber:
184186
domains_scrubber_regex = domains_scrubber
185-
elif "LUMIGO_DOMAINS_SCRUBBER" in os.environ:
187+
elif LUMIGO_DOMAINS_SCRUBBER_KEY in os.environ:
186188
try:
187-
domains_scrubber_regex = json.loads(os.environ["LUMIGO_DOMAIN_SCRUBBER"])
189+
domains_scrubber_regex = json.loads(os.environ[LUMIGO_DOMAINS_SCRUBBER_KEY])
188190
except Exception:
189191
get_logger().critical(
190192
"Could not parse the specified domains scrubber, shutting down the reporter."

src/test/unit/test_lumigo_utils.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -390,6 +390,12 @@ def test_config_enhanced_printstep_function_without_envs(monkeypatch, configurat
390390
assert Configuration.is_step_function == configuration_value
391391

392392

393+
def test_config_lumigo_domains_scrubber_with_envs(monkeypatch):
394+
monkeypatch.setenv("LUMIGO_DOMAINS_SCRUBBER", '["lambda.us-west-2.amazonaws.com"]')
395+
config()
396+
assert len(Configuration.domains_scrubber) == 1
397+
398+
393399
def test_config_timeout_timer_buffer_with_exception(monkeypatch):
394400
monkeypatch.setenv("LUMIGO_TIMEOUT_BUFFER", "not float")
395401
config()

0 commit comments

Comments
 (0)