Skip to content

Commit 4424ffa

Browse files
committed
set http resource and server span tag
1 parent c6dd22d commit 4424ffa

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

datadog_lambda/tracing.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1466,10 +1466,17 @@ def create_function_execution_span(
14661466
else:
14671467
service_name = function_name if function_name else "aws.lambda"
14681468

1469+
if (method := trigger_tags.get("http.method")) and (
1470+
route := trigger_tags.get("http.route")
1471+
):
1472+
resource = f"{method} {route}"
1473+
else:
1474+
resource = function_name
1475+
14691476
span = tracer.trace(
14701477
"aws.lambda",
14711478
service=service_name,
1472-
resource=function_name,
1479+
resource=resource,
14731480
span_type="serverless",
14741481
)
14751482
if span:

datadog_lambda/trigger.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ def extract_http_tags(event):
288288
"""
289289
Extracts HTTP facet tags from the triggering event
290290
"""
291-
http_tags = {}
291+
http_tags = {"span.kind": "server"}
292292

293293
# Safely get request_context and ensure it's a dictionary
294294
request_context = event.get("requestContext")

0 commit comments

Comments
 (0)