Skip to content

Commit a33baa3

Browse files
committed
Only add env:none if there is no custom env tag
1 parent b7aefd7 commit a33baa3

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

aws/logs_monitoring/lambda_function.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -822,7 +822,11 @@ def awslogs_handler(event, context, metadata):
822822
# Default `env` to `none` and `service` to the function name,
823823
# for correlation with the APM env and service.
824824
metadata[DD_SERVICE] = function_name
825-
metadata[DD_CUSTOM_TAGS] += ",env:none"
825+
826+
env_tag_exists = metadata[DD_CUSTOM_TAGS].startswith('env:') or ',env:' in metadata[DD_CUSTOM_TAGS]
827+
# If there is no env specified, default to env:none
828+
if not env_tag_exists:
829+
metadata[DD_CUSTOM_TAGS] += ",env:none"
826830

827831
# Create and send structured logs to Datadog
828832
for log in logs["logEvents"]:

0 commit comments

Comments
 (0)