Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion datadog_lambda/trigger.py
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,8 @@ def extract_http_tags(event):
method = apigateway_v2_http.get("method")

if path:
http_tags["http.url_details.path"] = path
if http_tags.get("http.url"):
http_tags["http.url"] += path
if method:
http_tags["http.method"] = method

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,7 @@ HTTP GET https://www.datadoghq.com/ Headers: ["Accept-Encoding:gzip, deflate","A
"function_trigger.event_source": "api-gateway",
"function_trigger.event_source_arn": "XXXX",
"span.kind": "server",
"http.url": "https://XXXX.execute-api.us-east-2.amazonaws.com",
"http.url_details.path": "/Prod/",
"http.url": "https://XXXX.execute-api.us-east-2.amazonaws.com/Prod/",
"http.method": "GET",
"http.route": "/",
"http.status_code": "200"
Expand Down Expand Up @@ -772,8 +771,7 @@ HTTP GET https://www.datadoghq.com/ Headers: ["Accept-Encoding:gzip, deflate","A
"function_trigger.event_source": "api-gateway",
"function_trigger.event_source_arn": "XXXX$default",
"span.kind": "server",
"http.url": "https://XXXX.execute-api.eu-west-1.amazonaws.com",
"http.url_details.path": "/httpapi/get",
"http.url": "https://XXXX.execute-api.eu-west-1.amazonaws.com/httpapi/get",
"http.method": "GET",
"http.route": "/httpapi/get",
"http.status_code": "200"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,7 @@ HTTP GET https://www.datadoghq.com/ Headers: ["Accept-Encoding:gzip, deflate","A
"function_trigger.event_source": "api-gateway",
"function_trigger.event_source_arn": "XXXX",
"span.kind": "server",
"http.url": "https://XXXX.execute-api.us-east-2.amazonaws.com",
"http.url_details.path": "/Prod/",
"http.url": "https://XXXX.execute-api.us-east-2.amazonaws.com/Prod/",
"http.method": "GET",
"http.route": "/",
"http.status_code": "200"
Expand Down Expand Up @@ -772,8 +771,7 @@ HTTP GET https://www.datadoghq.com/ Headers: ["Accept-Encoding:gzip, deflate","A
"function_trigger.event_source": "api-gateway",
"function_trigger.event_source_arn": "XXXX$default",
"span.kind": "server",
"http.url": "https://XXXX.execute-api.eu-west-1.amazonaws.com",
"http.url_details.path": "/httpapi/get",
"http.url": "https://XXXX.execute-api.eu-west-1.amazonaws.com/httpapi/get",
"http.method": "GET",
"http.route": "/httpapi/get",
"http.status_code": "200"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,7 @@ HTTP GET https://www.datadoghq.com/ Headers: ["Accept-Encoding:gzip, deflate","A
"function_trigger.event_source": "api-gateway",
"function_trigger.event_source_arn": "XXXX",
"span.kind": "server",
"http.url": "https://XXXX.execute-api.us-east-2.amazonaws.com",
"http.url_details.path": "/Prod/",
"http.url": "https://XXXX.execute-api.us-east-2.amazonaws.com/Prod/",
"http.method": "GET",
"http.route": "/",
"http.status_code": "200"
Expand Down Expand Up @@ -772,8 +771,7 @@ HTTP GET https://www.datadoghq.com/ Headers: ["Accept-Encoding:gzip, deflate","A
"function_trigger.event_source": "api-gateway",
"function_trigger.event_source_arn": "XXXX$default",
"span.kind": "server",
"http.url": "https://XXXX.execute-api.eu-west-1.amazonaws.com",
"http.url_details.path": "/httpapi/get",
"http.url": "https://XXXX.execute-api.eu-west-1.amazonaws.com/httpapi/get",
"http.method": "GET",
"http.route": "/httpapi/get",
"http.status_code": "200"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,7 @@ HTTP GET https://www.datadoghq.com/ Headers: ["Accept-Encoding:gzip, deflate","A
"function_trigger.event_source": "api-gateway",
"function_trigger.event_source_arn": "XXXX",
"span.kind": "server",
"http.url": "https://XXXX.execute-api.us-east-2.amazonaws.com",
"http.url_details.path": "/Prod/",
"http.url": "https://XXXX.execute-api.us-east-2.amazonaws.com/Prod/",
"http.method": "GET",
"http.route": "/",
"http.status_code": "200"
Expand Down Expand Up @@ -772,8 +771,7 @@ HTTP GET https://www.datadoghq.com/ Headers: ["Accept-Encoding:gzip, deflate","A
"function_trigger.event_source": "api-gateway",
"function_trigger.event_source_arn": "XXXX$default",
"span.kind": "server",
"http.url": "https://XXXX.execute-api.eu-west-1.amazonaws.com",
"http.url_details.path": "/httpapi/get",
"http.url": "https://XXXX.execute-api.eu-west-1.amazonaws.com/httpapi/get",
"http.method": "GET",
"http.route": "/httpapi/get",
"http.status_code": "200"
Expand Down
6 changes: 2 additions & 4 deletions tests/integration/snapshots/logs/async-metrics_python38.log
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,7 @@ HTTP GET https://www.datadoghq.com/ Headers: ["Accept-Encoding:gzip, deflate","A
"function_trigger.event_source": "api-gateway",
"function_trigger.event_source_arn": "XXXX",
"span.kind": "server",
"http.url": "https://XXXX.execute-api.us-east-2.amazonaws.com",
"http.url_details.path": "/Prod/",
"http.url": "https://XXXX.execute-api.us-east-2.amazonaws.com/Prod/",
"http.method": "GET",
"http.route": "/",
"http.status_code": "200"
Expand Down Expand Up @@ -772,8 +771,7 @@ HTTP GET https://www.datadoghq.com/ Headers: ["Accept-Encoding:gzip, deflate","A
"function_trigger.event_source": "api-gateway",
"function_trigger.event_source_arn": "XXXX$default",
"span.kind": "server",
"http.url": "https://XXXX.execute-api.eu-west-1.amazonaws.com",
"http.url_details.path": "/httpapi/get",
"http.url": "https://XXXX.execute-api.eu-west-1.amazonaws.com/httpapi/get",
"http.method": "GET",
"http.route": "/httpapi/get",
"http.status_code": "200"
Expand Down
6 changes: 2 additions & 4 deletions tests/integration/snapshots/logs/async-metrics_python39.log
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,7 @@ HTTP GET https://www.datadoghq.com/ Headers: ["Accept-Encoding:gzip, deflate","A
"function_trigger.event_source": "api-gateway",
"function_trigger.event_source_arn": "XXXX",
"span.kind": "server",
"http.url": "https://XXXX.execute-api.us-east-2.amazonaws.com",
"http.url_details.path": "/Prod/",
"http.url": "https://XXXX.execute-api.us-east-2.amazonaws.com/Prod/",
"http.method": "GET",
"http.route": "/",
"http.status_code": "200"
Expand Down Expand Up @@ -772,8 +771,7 @@ HTTP GET https://www.datadoghq.com/ Headers: ["Accept-Encoding:gzip, deflate","A
"function_trigger.event_source": "api-gateway",
"function_trigger.event_source_arn": "XXXX$default",
"span.kind": "server",
"http.url": "https://XXXX.execute-api.eu-west-1.amazonaws.com",
"http.url_details.path": "/httpapi/get",
"http.url": "https://XXXX.execute-api.eu-west-1.amazonaws.com/httpapi/get",
"http.method": "GET",
"http.route": "/httpapi/get",
"http.status_code": "200"
Expand Down
6 changes: 2 additions & 4 deletions tests/integration/snapshots/logs/sync-metrics_python310.log
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,7 @@ HTTP GET https://www.datadoghq.com/ Headers: ["Accept-Encoding:gzip, deflate","A
"function_trigger.event_source": "api-gateway",
"function_trigger.event_source_arn": "XXXX",
"span.kind": "server",
"http.url": "https://XXXX.execute-api.us-east-2.amazonaws.com",
"http.url_details.path": "/Prod/",
"http.url": "https://XXXX.execute-api.us-east-2.amazonaws.com/Prod/",
"http.method": "GET",
"http.route": "/",
"http.status_code": "200"
Expand Down Expand Up @@ -828,8 +827,7 @@ HTTP GET https://www.datadoghq.com/ Headers: ["Accept-Encoding:gzip, deflate","A
"function_trigger.event_source": "api-gateway",
"function_trigger.event_source_arn": "XXXX$default",
"span.kind": "server",
"http.url": "https://XXXX.execute-api.eu-west-1.amazonaws.com",
"http.url_details.path": "/httpapi/get",
"http.url": "https://XXXX.execute-api.eu-west-1.amazonaws.com/httpapi/get",
"http.method": "GET",
"http.route": "/httpapi/get",
"http.status_code": "200"
Expand Down
6 changes: 2 additions & 4 deletions tests/integration/snapshots/logs/sync-metrics_python311.log
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,7 @@ HTTP GET https://www.datadoghq.com/ Headers: ["Accept-Encoding:gzip, deflate","A
"function_trigger.event_source": "api-gateway",
"function_trigger.event_source_arn": "XXXX",
"span.kind": "server",
"http.url": "https://XXXX.execute-api.us-east-2.amazonaws.com",
"http.url_details.path": "/Prod/",
"http.url": "https://XXXX.execute-api.us-east-2.amazonaws.com/Prod/",
"http.method": "GET",
"http.route": "/",
"http.status_code": "200"
Expand Down Expand Up @@ -828,8 +827,7 @@ HTTP GET https://www.datadoghq.com/ Headers: ["Accept-Encoding:gzip, deflate","A
"function_trigger.event_source": "api-gateway",
"function_trigger.event_source_arn": "XXXX$default",
"span.kind": "server",
"http.url": "https://XXXX.execute-api.eu-west-1.amazonaws.com",
"http.url_details.path": "/httpapi/get",
"http.url": "https://XXXX.execute-api.eu-west-1.amazonaws.com/httpapi/get",
"http.method": "GET",
"http.route": "/httpapi/get",
"http.status_code": "200"
Expand Down
6 changes: 2 additions & 4 deletions tests/integration/snapshots/logs/sync-metrics_python312.log
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,7 @@ HTTP GET https://www.datadoghq.com/ Headers: ["Accept-Encoding:gzip, deflate","A
"function_trigger.event_source": "api-gateway",
"function_trigger.event_source_arn": "XXXX",
"span.kind": "server",
"http.url": "https://XXXX.execute-api.us-east-2.amazonaws.com",
"http.url_details.path": "/Prod/",
"http.url": "https://XXXX.execute-api.us-east-2.amazonaws.com/Prod/",
"http.method": "GET",
"http.route": "/",
"http.status_code": "200"
Expand Down Expand Up @@ -828,8 +827,7 @@ HTTP GET https://www.datadoghq.com/ Headers: ["Accept-Encoding:gzip, deflate","A
"function_trigger.event_source": "api-gateway",
"function_trigger.event_source_arn": "XXXX$default",
"span.kind": "server",
"http.url": "https://XXXX.execute-api.eu-west-1.amazonaws.com",
"http.url_details.path": "/httpapi/get",
"http.url": "https://XXXX.execute-api.eu-west-1.amazonaws.com/httpapi/get",
"http.method": "GET",
"http.route": "/httpapi/get",
"http.status_code": "200"
Expand Down
6 changes: 2 additions & 4 deletions tests/integration/snapshots/logs/sync-metrics_python313.log
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,7 @@ HTTP GET https://www.datadoghq.com/ Headers: ["Accept-Encoding:gzip, deflate","A
"function_trigger.event_source": "api-gateway",
"function_trigger.event_source_arn": "XXXX",
"span.kind": "server",
"http.url": "https://XXXX.execute-api.us-east-2.amazonaws.com",
"http.url_details.path": "/Prod/",
"http.url": "https://XXXX.execute-api.us-east-2.amazonaws.com/Prod/",
"http.method": "GET",
"http.route": "/",
"http.status_code": "200"
Expand Down Expand Up @@ -828,8 +827,7 @@ HTTP GET https://www.datadoghq.com/ Headers: ["Accept-Encoding:gzip, deflate","A
"function_trigger.event_source": "api-gateway",
"function_trigger.event_source_arn": "XXXX$default",
"span.kind": "server",
"http.url": "https://XXXX.execute-api.eu-west-1.amazonaws.com",
"http.url_details.path": "/httpapi/get",
"http.url": "https://XXXX.execute-api.eu-west-1.amazonaws.com/httpapi/get",
"http.method": "GET",
"http.route": "/httpapi/get",
"http.status_code": "200"
Expand Down
6 changes: 2 additions & 4 deletions tests/integration/snapshots/logs/sync-metrics_python38.log
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,7 @@ HTTP GET https://www.datadoghq.com/ Headers: ["Accept-Encoding:gzip, deflate","A
"function_trigger.event_source": "api-gateway",
"function_trigger.event_source_arn": "XXXX",
"span.kind": "server",
"http.url": "https://XXXX.execute-api.us-east-2.amazonaws.com",
"http.url_details.path": "/Prod/",
"http.url": "https://XXXX.execute-api.us-east-2.amazonaws.com/Prod/",
"http.method": "GET",
"http.route": "/",
"http.status_code": "200"
Expand Down Expand Up @@ -828,8 +827,7 @@ HTTP GET https://www.datadoghq.com/ Headers: ["Accept-Encoding:gzip, deflate","A
"function_trigger.event_source": "api-gateway",
"function_trigger.event_source_arn": "XXXX$default",
"span.kind": "server",
"http.url": "https://XXXX.execute-api.eu-west-1.amazonaws.com",
"http.url_details.path": "/httpapi/get",
"http.url": "https://XXXX.execute-api.eu-west-1.amazonaws.com/httpapi/get",
"http.method": "GET",
"http.route": "/httpapi/get",
"http.status_code": "200"
Expand Down
6 changes: 2 additions & 4 deletions tests/integration/snapshots/logs/sync-metrics_python39.log
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,7 @@ HTTP GET https://www.datadoghq.com/ Headers: ["Accept-Encoding:gzip, deflate","A
"function_trigger.event_source": "api-gateway",
"function_trigger.event_source_arn": "XXXX",
"span.kind": "server",
"http.url": "https://XXXX.execute-api.us-east-2.amazonaws.com",
"http.url_details.path": "/Prod/",
"http.url": "https://XXXX.execute-api.us-east-2.amazonaws.com/Prod/",
"http.method": "GET",
"http.route": "/",
"http.status_code": "200"
Expand Down Expand Up @@ -828,8 +827,7 @@ HTTP GET https://www.datadoghq.com/ Headers: ["Accept-Encoding:gzip, deflate","A
"function_trigger.event_source": "api-gateway",
"function_trigger.event_source_arn": "XXXX$default",
"span.kind": "server",
"http.url": "https://XXXX.execute-api.eu-west-1.amazonaws.com",
"http.url_details.path": "/httpapi/get",
"http.url": "https://XXXX.execute-api.eu-west-1.amazonaws.com/httpapi/get",
"http.method": "GET",
"http.route": "/httpapi/get",
"http.status_code": "200"
Expand Down
11 changes: 3 additions & 8 deletions tests/test_trigger.py
Original file line number Diff line number Diff line change
Expand Up @@ -318,8 +318,7 @@ def test_extract_trigger_tags_api_gateway(self):
{
"function_trigger.event_source": "api-gateway",
"function_trigger.event_source_arn": "arn:aws:apigateway:us-west-1::/restapis/1234567890/stages/prod",
"http.url": "https://70ixmpl4fl.execute-api.us-east-2.amazonaws.com",
"http.url_details.path": "/prod/path/to/resource",
"http.url": "https://70ixmpl4fl.execute-api.us-east-2.amazonaws.com/prod/path/to/resource",
"http.method": "POST",
"http.route": "/{proxy+}",
"span.kind": "server",
Expand All @@ -338,8 +337,7 @@ def test_extract_trigger_tags_api_gateway_non_proxy(self):
{
"function_trigger.event_source": "api-gateway",
"function_trigger.event_source_arn": "arn:aws:apigateway:us-west-1::/restapis/lgxbo6a518/stages/dev",
"http.url": "https://lgxbo6a518.execute-api.eu-west-1.amazonaws.com",
"http.url_details.path": "/dev/http/get",
"http.url": "https://lgxbo6a518.execute-api.eu-west-1.amazonaws.com/dev/http/get",
"http.method": "GET",
"http.route": "/http/get",
"span.kind": "server",
Expand Down Expand Up @@ -409,8 +407,7 @@ def test_extract_trigger_tags_api_gateway_http_api(self):
{
"function_trigger.event_source": "api-gateway",
"function_trigger.event_source_arn": "arn:aws:apigateway:us-west-1::/restapis/x02yirxc7a/stages/$default",
"http.url": "https://x02yirxc7a.execute-api.eu-west-1.amazonaws.com",
"http.url_details.path": "/httpapi/get",
"http.url": "https://x02yirxc7a.execute-api.eu-west-1.amazonaws.com/httpapi/get",
"http.method": "GET",
"span.kind": "server",
"http.route": "/httpapi/get",
Expand All @@ -429,7 +426,6 @@ def test_extract_trigger_tags_application_load_balancer(self):
{
"function_trigger.event_source": "application-load-balancer",
"function_trigger.event_source_arn": "arn:aws:elasticloadbalancing:us-east-2:123456789012:targetgroup/lambda-xyz/123abc",
"http.url_details.path": "/lambda",
"http.method": "GET",
"span.kind": "server",
},
Expand Down Expand Up @@ -596,7 +592,6 @@ def test_extract_http_tags_with_invalid_request_context(self):
http_tags,
{
"span.kind": "server",
"http.url_details.path": "/test",
"http.method": "GET",
},
)
Expand Down
Loading