Skip to content

chore: update environment variable references to use AWS_SDK_UA_APP_ID #934

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

Open
wants to merge 10 commits into
base: develop
Choose a base branch
from

Conversation

hjgraca
Copy link
Contributor

@hjgraca hjgraca commented Jul 21, 2025

Please provide the issue number

Issue number: #933

Summary

Changes

This pull request introduces a new constant, AWS_SDK_UA_APP_ID, to represent a unique application ID for the User-Agent header, replacing the previous use of AWS_EXECUTION_ENV in the codebase. The changes involve updating constants, interfaces, implementations, and test cases to reflect this new environment variable.

Key Changes:

Core Library Updates:

  • Added a new constant AWSSdkUAAppId in Constants.cs to represent the AWS_SDK_UA_APP_ID environment variable. This constant is used throughout the library to replace AWS_EXECUTION_ENV.
  • Updated the SetExecutionEnvironment method in IPowertoolsConfigurations and IPowertoolsEnvironment interfaces to use AWS_SDK_UA_APP_ID. [1] [2]
  • Modified the SetExecutionEnvironment implementation in PowertoolsEnvironment.cs to set and retrieve the AWS_SDK_UA_APP_ID environment variable instead of AWS_EXECUTION_ENV.

Test Updates:

  • Updated all test cases in various test files (BatchProcessingInternalTests.cs, PowertoolsEnvironmentTest.cs, IdempotentAspectTests.cs, PowertoolsLoggerTest.cs, MetricsTests.cs, XRayRecorderTests.cs) to validate behavior using AWS_SDK_UA_APP_ID instead of AWS_EXECUTION_ENV. [1] [2] [3] [4] [5] [6]

Code Quality:

  • Disabled ReSharper's InconsistentNaming rule in Constants.cs to accommodate naming conventions for constants.

User experience

Please share what the user experience looks like before and after this change

Checklist

Please leave checklist items unchecked if they do not apply to your change.

Is this a breaking change?

RFC issue number:

Checklist:

  • Migration process documented
  • Implement warnings (if it can live side by side)

Acknowledgment

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

Disclaimer: We value your time and bandwidth. As such, any pull requests created on non-triaged issues might not be successful.

@boring-cyborg boring-cyborg bot added area/common Core Powertools utility tests labels Jul 21, 2025
@pull-request-size pull-request-size bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Jul 21, 2025
@hjgraca hjgraca requested a review from dreamorosi July 21, 2025 09:56
@github-actions github-actions bot added the internal Maintenance changes label Jul 21, 2025
Copy link

codecov bot commented Jul 21, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 77.29%. Comparing base (c2711e2) to head (88fdaa3).

Additional details and impacted files
@@             Coverage Diff             @@
##           develop     #934      +/-   ##
===========================================
- Coverage    77.31%   77.29%   -0.02%     
===========================================
  Files          271      271              
  Lines        10839    10839              
  Branches      1277     1277              
===========================================
- Hits          8380     8378       -2     
- Misses        2043     2044       +1     
- Partials       416      417       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@dreamorosi dreamorosi linked an issue Jul 21, 2025 that may be closed by this pull request
2 tasks
hjgraca added 6 commits July 29, 2025 15:29
… variable handling

- Replace Microsoft.CodeAnalysis.Analyzers and CSharp with Microsoft.CodeAnalysis.Common in central package management and project files
- Add Microsoft.CodeAnalysis.Common package reference to relevant projects
- Remove unused source generator file reference from Kafka project
- Refactor PowertoolsEnvironment to improve UA environment variable string construction and PTENV placement logic
- Update UASetter test to use ITestOutputHelper and add assertions for PTENV position and output
…ate source generator output

- Introduce EnvWrapper helper in each utility for setting execution environment
- Update source generator to use EnvWrapper in generated module initializers
- Add IncludeExecutionEnvironment property to project files for conditional EnvWrapper inclusion
- Add Directory.Build.targets to automate EnvWrapper generation in Release builds
@pull-request-size pull-request-size bot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Jul 29, 2025
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/common Core Powertools utility area/idempotency internal Maintenance changes size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature request: UA change from AWS_EXECUTION_ENV to AWS_SDK_UA_APP_ID
1 participant