Skip to content

Commit c4ca81d

Browse files
saartochner-lumigoCircleCI
andauthored
feat: add nested-auto-execution-tags (#242)
Co-authored-by: CircleCI <[email protected]>
1 parent 9fe78b3 commit c4ca81d

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

src/lumigo_tracer/auto_tag/auto_tag_event.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ def auto_tag(event: dict):
5151
class ConfigurationHandler(EventAutoTagHandler):
5252
@staticmethod
5353
def is_supported(event: dict) -> bool:
54-
return bool(event) and any(key in event for key in Configuration.auto_tag)
54+
return bool(event) and any(key.split(".")[0] in event for key in Configuration.auto_tag)
5555

5656
@staticmethod
5757
def auto_tag(event: dict):

src/test/unit/test_tracer.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -341,18 +341,19 @@ def lambda_test_function(event, context):
341341
]
342342

343343

344-
def test_wrapping_with_auto_tags(context):
345-
key = "my_key"
346-
value = "my_value"
347-
344+
@pytest.mark.parametrize(
345+
"key, event",
346+
[("my_key", {"my_key": "my_value"}), ("my_key.key2", {"my_key": {"key2": "my_value"}})],
347+
)
348+
def test_wrapping_with_auto_tags(context, key, event):
348349
@lumigo_tracer(auto_tag=[key])
349350
def lambda_test_function(event, context):
350351
return "ret_value"
351352

352-
result = lambda_test_function({key: value}, context)
353+
result = lambda_test_function(event, context)
353354
assert result == "ret_value"
354355
assert SpansContainer.get_span().function_span[EXECUTION_TAGS_KEY] == [
355-
{"key": key, "value": value}
356+
{"key": key, "value": "my_value"}
356357
]
357358

358359

0 commit comments

Comments
 (0)