-
Notifications
You must be signed in to change notification settings - Fork 36
Span Inferrer: Fix path for API Gateway V1 #262
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
Span Inferrer: Fix path for API Gateway V1 #262
Conversation
@astuyve Please take a look and let me know if anything else is needed to get this bug fix merged and a new version released. |
Thanks so much for the PR @hpetru - the code looks good, re-reading my PR I think I just missed this mid-refactor, so I appreciate your contribution! Please run |
Codecov Report
@@ Coverage Diff @@
## main #262 +/- ##
==========================================
+ Coverage 82.26% 82.75% +0.49%
==========================================
Files 37 37
Lines 1618 1618
Branches 349 349
==========================================
+ Hits 1331 1339 +8
+ Misses 238 231 -7
+ Partials 49 48 -1
Continue to review full report at Codecov.
|
Hi @hpetru - the integration tests might be tricky to update for you as you'll need both a DD API key as well as an available AWS account. I'll merge your branch into one of my own, update the tests, and merge that PR, which should solve this. Thanks again for your contribution!! |
This has been released to 5.71.0! We don't adhere to semver here as we keep the minor version in sync with the lambda layer version available on AWS. Unfortunately AWS doesn't allow semver for lambda layers. v71 is also published in all regions for all runtimes. https://github.com/DataDog/datadog-lambda-js/releases/tag/v5.71.0 |
@@ -55,7 +55,7 @@ export class SpanInferrer { | |||
): SpanWrapper { | |||
const options: SpanOptions = {}; | |||
const domain = event.requestContext.domainName; | |||
const path = event.rawPath || event.requestContext.routeKey; | |||
const path = event.rawPath || event.requestContext.path || event.requestContext.routeKey; |
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.
@astuyve I'm afraid that the right change here should be:
const path = event.rawPath || event.requestContext.resourcePath || event.requestContext.routeKey;
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.
Hmm, I see. In our tests they were equivalent, is that not the case in your app? Can you show me the difference in your payload?
https://github.com/DataDog/datadog-lambda-js/blob/main/event_samples/api-gateway-v1.json#L67
https://github.com/DataDog/datadog-lambda-js/blob/main/event_samples/api-gateway-v1.json#L73
What does this PR do?
This Pull Request fixes the span inferrer for API Gateway V1 events.
Motivation
Because of this bug, resources are not shown right in DataDog API Gateway service.
Testing Guidelines
I wrote a until test which replicates the bug.
Additional Notes
Looks like this problem happens only for API Gateway V1, but I also added an additional test case for API Gateway V2 just to make sure that my changes are not breaking something V2 related.
Types of Changes
Check all that apply