Skip to content

Maintenance: move redundant code and functionalities in shared commons package #484

Closed
@saragerion

Description

@saragerion

Description of the feature request

The execution of this issue should be divided into 3 steps:

  1. 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.
  2. Add that logic in commons.
  3. 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

#165

N/A

Metadata

Metadata

Assignees

Labels

completedThis item is complete and has been merged/shippedinternalPRs that introduce changes in governance, tech debt and chores (linting setup, baseline, etc.)loggerThis item relates to the Logger UtilitymetricsThis item relates to the Metrics UtilitytracerThis item relates to the Tracer Utility

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions