-
Notifications
You must be signed in to change notification settings - Fork 45
fix: use RouteKey in resource path for API Gateway inferred spans #442
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
datadog_lambda/tracing.py
Outdated
method = event.get("httpMethod") | ||
path = event.get("path") | ||
resource = "{0} {1}".format(method, path) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fc1b414
to
0f16ebb
Compare
@@ -893,7 +893,8 @@ def create_inferred_span_from_api_gateway_event( | |||
) | |||
method = event.get("httpMethod") | |||
path = event.get("path") | |||
resource = "{0} {1}".format(method, path) | |||
resource_path = _get_resource_path(event, request_context) | |||
resource = "{0} {1}".format(method, resource_path) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's use f string, instead of format. Due to performance.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh good call!
@@ -947,7 +958,8 @@ def create_inferred_span_from_http_api_event( | |||
) | |||
method = request_context.get("http", {}).get("method") | |||
path = event.get("rawPath") | |||
resource = "{0} {1}".format(method, path) | |||
resource_path = _get_resource_path(event, request_context) | |||
resource = "{0} {1}".format(method, resource_path) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM – thanks for addressing performance regression on another PR!
What does this PR do?
Normalizes the apigw inferred span resource name
Motivation
SVLS-4006
Testing Guidelines
I built the python layer and manually tested it, here is the outcome

Additional Notes
Types of Changes
Check all that apply