Skip to content

refactor(tracer): replace class-based env access with functional helpers #4146

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

chetan9518
Copy link
Contributor

Summary

This PR removes the legacy class-based EnvironmentVariablesService from the Tracer package and replaces it with functional getEnv helpers from @aws-lambda-powertools/commons.

Changes

  • Removed EnvironmentVariablesService class
  • Replaced all class-based env access with functional helpers (e.g. getEnv, getXRayTraceIdFromEnv)
  • Removed EnvironmentVariablesService.test.ts (no longer needed)
  • Confirmed all tests pass and builds succeed

Issue number: #4137


By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@pull-request-size pull-request-size bot added the size/L PRs between 100-499 LOC label Jul 7, 2025
@boring-cyborg boring-cyborg bot added tests PRs that add or change tests tracer This item relates to the Tracer Utility labels Jul 7, 2025
Copy link

boring-cyborg bot commented Jul 7, 2025

Thanks a lot for your first contribution! Please check out our contributing guidelines and don't hesitate to ask whatever you need.
In the meantime, check out the #typescript channel on our Powertools for AWS Lambda Discord: Invite link

@dreamorosi
Copy link
Contributor

Hi @chetan9518 thank you for opening this PR!

I'll review it soon, in the meantime could you please leave a comment on the linked issue, so that I can assign it to you?

GitHub doesn't allow me to assign issues if you haven't interacted with it first.

Thank you.

Copy link
Contributor

@dreamorosi dreamorosi left a comment

Choose a reason for hiding this comment

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

Thank you again for the PR.

I've left a few comments but it's looking good.

Before pushing the next commit, could you please run npm run lint:fix -w packages/tracer from the root? I think some lines didn't get formatted correctly.

Also I noticed you left a comment under another issue, but not the one linked to this PR (#4137). Please leave a comment there so we can assign this to you - it really helps our tracking.

@boring-cyborg boring-cyborg bot added the dependencies Changes that touch dependencies, e.g. Dependabot, etc. label Jul 9, 2025
Copy link
Contributor

@dreamorosi dreamorosi left a comment

Choose a reason for hiding this comment

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

Thank you for the PR, I made some small changes so I'll wait for another reviewer before merging it - but it's ok for me.

Thanks!

@dreamorosi dreamorosi requested a review from svozza July 9, 2025 06:40
Copy link

sonarqubecloud bot commented Jul 9, 2025

@dreamorosi dreamorosi merged commit 51d9b98 into aws-powertools:main Jul 9, 2025
44 checks passed
Copy link

boring-cyborg bot commented Jul 9, 2025

Awesome work, congrats on your first merged pull request and thank you for helping improve everyone's experience!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Changes that touch dependencies, e.g. Dependabot, etc. size/L PRs between 100-499 LOC tests PRs that add or change tests tracer This item relates to the Tracer Utility
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Maintenance: replace EnvironmentVariablesService class with helper functions in Tracer
3 participants