Skip to content

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

Merged
purple4reina merged 5 commits intomainfrom
ar/useRouteKeyForApiGw
Mar 29, 2024
Merged

fix: use RouteKey in resource path for API Gateway inferred spans#442
purple4reina merged 5 commits intomainfrom
ar/useRouteKeyForApiGw

Conversation

@zARODz11z
Copy link
Copy Markdown
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
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@purple4reina purple4reina force-pushed the ar/useRouteKeyForApiGw branch from fc1b414 to 0f16ebb Compare March 28, 2024 17:20
@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
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
Copy Markdown
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
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Oh good call!

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
Copy Markdown
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
Copy Markdown
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
@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.

3 participants