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: Restored tracing of ALB event properties #2780

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

mrickard
Copy link
Member

Description

Filtering of API Gateway v1 vs v2 did not allow for Lambda functions triggered by ALB/ELB. Prior to our most recent change to that filtering, ALB events were traced without explicit filtering. This adds explicit checking for an ALB event type, and allows ALB-triggered web requests to be treated as web transactions.

How to Test

This adds a unit test at test/unit/server/ess/alb-event.test.js checking for the expected request properties.

Related Issues

Closes NR-341636
Closes #2779
Closes NR-342521

Comment on lines 163 to +164
}
const albKeys = [
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
}
const albKeys = [
}
const albKeys = [

Comment on lines 163 to +164
}
const albKeys = [
Copy link
Contributor

Choose a reason for hiding this comment

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

Please document this as our other event keys are documented.

'multiValueQueryStringParameters',
'pathParameters'
]
.sort()
Copy link
Contributor

Choose a reason for hiding this comment

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

I recommend listing them in sorted order to avoid the unnecessary sorting operation cost.

if (!event.multiValueQueryStringParameters) {
if (
!event.multiValueQueryStringParameters ||
Object.keys(event.multiValueQueryStringParameters).length === 0
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't understand. If we have multiValueQueryStringParameters defined at all, we should not have queryStringParameters defined. So why would we return queryStringParameters if the multi valued property is defined with zero elements?

Copy link
Member Author

Choose a reason for hiding this comment

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

In the sample event captured by the customer, both queryStringParameters and multiValueQueryStringParameters were defined, event though each had zero properties. I could see changing this to check for properties in each. The definition of one, though, doesn't exclude the definition of the other, based on the input they've captured.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Needs PR Review
Development

Successfully merging this pull request may close these issues.

Missing attributes for Lambda functions triggered by ALB
2 participants