Skip to content
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

fix: use RouteKey in resource path for API Gateway inferred spans #442

Merged
merged 5 commits into from
Mar 29, 2024

Conversation

zARODz11z
Copy link
Contributor

@zARODz11z zARODz11z commented Mar 11, 2024

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
Screenshot 2024-03-13 at 11 25 13 AM

Additional Notes

Types of Changes

  • Bug fix
  • New feature
  • Breaking change
  • Misc (docs, refactoring, dependency upgrade, etc.)

Check all that apply

  • This PR's description is comprehensive
  • This PR contains breaking changes that are documented in the description
  • This PR introduces new APIs or parameters that are documented and unlikely to change in the foreseeable future
  • This PR impacts documentation, and it has been updated (or a ticket has been logged)
  • This PR's changes are covered by the automated tests
  • This PR collects user input/sensitive content into Datadog
  • This PR passes the integration tests (ask a Datadog member to run the tests)

method = event.get("httpMethod")
path = event.get("path")
resource = "{0} {1}".format(method, path)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@purple4reina purple4reina marked this pull request as ready for review March 28, 2024 17:22
@purple4reina purple4reina requested a review from a team as a code owner March 28, 2024 17:22
@duncanista duncanista changed the title use route key fix: use RouteKey in resource path for API Gateway inferred spans Mar 28, 2024
@@ -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)
Copy link
Contributor

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.

Copy link
Contributor

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)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here

Copy link
Contributor

@duncanista duncanista left a 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!

@purple4reina purple4reina merged commit d812fb6 into main Mar 29, 2024
51 checks passed
@purple4reina purple4reina deleted the ar/useRouteKeyForApiGw branch March 29, 2024 16:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants