Skip to content

Conversation

@andrewslotin
Copy link

AWS has introduced a new trigger event type, which is now a default for newly created triggers. This PR adds support for such payload format, extracting the trace context and necessary tags for the entry span.

Copy link
Contributor

@pglombardo pglombardo left a comment

Choose a reason for hiding this comment

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

This is a great improvement - thanks

is_application_load_balancer_trigger(event)

if is_proxy_event:
return tracer.extract('http_headers', event['headers'])
Copy link
Contributor

Choose a reason for hiding this comment

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

The failsafe check here would be to also add in if "headers" in event or alternatively wrap this entire function in an try..except (or both). What do you think?

Copy link
Author

@andrewslotin andrewslotin Nov 20, 2020

Choose a reason for hiding this comment

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

Fair enough, although the fact that this is a proxy event guarantees that we have headers. Who knows when AWS decides to change their payload again. An event.get('headers', dict()) maybe?

return True


def is_api_gateway_v2_proxy_trigger(event):
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice

@pglombardo pglombardo merged commit c924c39 into master Nov 20, 2020
@pglombardo pglombardo deleted the add_support_for_api_gw_v2_lambda_payload branch November 20, 2020 14:41
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