Closed
Description
Description of the feature request
The execution of this issue should be divided into 3 steps:
- Vet the business logic of Logger, Tracer and Metrics utilities to identify code de-duplication opportunities. Opportunities found so far: cold-start business logic, fetching of environment variables.
- Add that logic in commons.
- Remove duplicated logic from the single utilities, in favour of the logic from the commons package.
Problem statement
Right now there is a number of functionalities that are repeated throughout the 3 different utilities, all with their own business logic and separated unit tests.
This is not optimal because:
- The same feature should have the same behaviour across all utilities
- This unnecessarily increases the cost of maintenance
- Code duplication inflates the libraries's size unnecessarily, with impact over the Lambda package size and consequently cold-starts
Summary of the feature
See above.
Code examples
Benefits for you and the wider AWS community
Describe alternatives you've considered
Additional context
See here:
https://github.com/awslabs/aws-lambda-powertools-typescript/blob/main/packages/logger/src/config/EnvironmentVariablesService.ts
https://github.com/awslabs/aws-lambda-powertools-typescript/blob/main/packages/logger/src/Logger.ts#L92
Related issues, RFCs
N/A