Skip to content

Commit df4b2b6

Browse files
author
Nils
authored
Send functionname and memorysize as tag
1 parent d08e6b8 commit df4b2b6

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

Log/lambda_function.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,6 @@
2727

2828
# metadata: Additional metadata to send with the logs
2929
metadata = {
30-
"aws": {
31-
"type": "s3_logs"
32-
},
3330
"ddsourcecategory": "aws",
3431
}
3532

@@ -40,6 +37,7 @@
4037

4138

4239
DD_SOURCE = "ddsource"
40+
DD_CUSTOM_TAGS = "ddtags"
4341

4442
def lambda_handler(event, context):
4543
# Check prerequisites
@@ -59,10 +57,10 @@ def lambda_handler(event, context):
5957
if "aws" not in metadata:
6058
metadata["aws"] = {}
6159
aws_meta = metadata["aws"]
62-
aws_meta["function_name"] = context.function_name
6360
aws_meta["function_version"] = context.function_version
6461
aws_meta["invoked_function_arn"] = context.invoked_function_arn
65-
aws_meta["memory_limit_in_mb"] = context.memory_limit_in_mb
62+
#Add custom tags here by adding new value with the following format "key1:value1, key2:value2" - might be subject to modifications
63+
metadata[DD_CUSTOM_TAGS] = "functionname:" + context.function_name+ ",memorysize:"+ context.memory_limit_in_mb
6664

6765

6866
try:

0 commit comments

Comments
 (0)