Skip to content

Maintenance: replace EnvironmentVariablesService class with helper functions in Metrics #21

@dreamorosi

Description

@dreamorosi

[TEST ISSUE] - Copied from aws-powertools repo for testing issue categorization automation

Summary

In aws-powertools#3945 we added new zero-dependency functional utilities to read and parse environment variables. These new functions supersede the old class based environment service approach. We should refactor the Metrics package to use the new function based approach instead of the custom EnvironmentVariablesService class.

Why is this needed?

The rationale for the introduction of these utilities as per aws-powertools#3945 is as follows:

[M]ost of the advantage to customers will come in the form of smaller utilities over time, since we'll be able to use these helpers across other Powertools for AWS utilities and replace the existing EnvironmentVariablesService class-based model which is extremely verbose and requires props drilling if you want to access env variables deep into an inheritance stack.

This change will help us to eventually remove the EnvironmentVariablesService entirely from the code base. The Metrics package currently has its own extended version of the service that adds metrics-specific environment variable handling.

Which area does this relate to?

Metrics

Solution

Currently the Metrics package has its own EnvironmentVariablesService class that extends the common one.

Acknowledgment

Future readers

Please react with 👍 and your use case to help us understand customer demand.

Updated to trigger categorization system

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions