Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(aws_lambda): update how context is extracted (#5461)
Handlers are allowed to have more than the two required positional arguments. ```python def handler(event, context, extra_arg, optional_arg=False): ... return ... ``` Our current `context` extraction checks for the last element. The patch didn't take into account that more arguments can be provided besides the two required. This PR fixes that. It is guaranteed that the `(event, context)` arguments will be in the first positions. ## Testing strategy - Updates tests to have extra arguments - Tested with an actual AWS Lambda too. ## Checklist - [x] Change(s) are motivated and described in the PR description. - [x] Testing strategy is described if automated tests are not included in the PR. - [x] Risk is outlined (performance impact, potential for breakage, maintainability, etc). - [x] Change is maintainable (easy to change, telemetry, documentation). - [x] [Library release note guidelines](https://ddtrace.readthedocs.io/en/stable/contributing.html#Release-Note-Guidelines) are followed. - [x] Documentation is included (in-code, generated user docs, [public corp docs](https://github.com/DataDog/documentation/)). - [x] PR description includes explicit acknowledgement/acceptance of the performance implications of this PR as reported in the benchmarks PR comment. ## Reviewer Checklist - [x] Title is accurate. - [x] No unnecessary changes are introduced. - [x] Description motivates each change. - [x] Avoids breaking [API](https://ddtrace.readthedocs.io/en/stable/versioning.html#interfaces) changes unless absolutely necessary. - [x] Testing strategy adequately addresses listed risk(s). - [x] Change is maintainable (easy to change, telemetry, documentation). - [x] Release note makes sense to a user of the library. - [x] Reviewer has explicitly acknowledged and discussed the performance implications of this PR as reported in the benchmarks PR comment.
- Loading branch information