Skip to content
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

feat(user-agent): add custom header User-Agent to AWS SDK requests #2267

Merged
merged 28 commits into from
Jun 1, 2023

Conversation

roger-zhangg
Copy link
Member

@roger-zhangg roger-zhangg commented May 15, 2023

Issue number: #2284

Summary

Implement standard user-agent in Powertools

Changes

  • AWS SDK request created by/with Powertools will include standard powertools user-agent string
  • Feature specific user-agent added for idempotency and parameters feature

User experience

  • UX is not affect by this change

Checklist

If your change doesn't seem to apply, please leave them unchecked.

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.

roger-zhangg and others added 4 commits May 2, 2023 16:19
- Need to review on how to import botocore
- Review how to get PT version
- better solution than implementing in __init__.py ?
- rename module to `user_agent`
- add feature name "parameters", "idempotency" to user-agent
@roger-zhangg roger-zhangg requested a review from a team as a code owner May 15, 2023 22:01
@roger-zhangg roger-zhangg requested review from heitorlessa and removed request for a team May 15, 2023 22:01
@pull-request-size pull-request-size bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label May 15, 2023
@github-actions
Copy link
Contributor

No related issues found. Please ensure there is an open issue related to this change to avoid significant delays or closure.

@github-actions github-actions bot added do-not-merge need-issue PRs that are missing related issues labels May 15, 2023
@roger-zhangg roger-zhangg changed the title Add PT User-Agent to AWS SDK requests feat(User-Agent): Add PT User-Agent to AWS SDK requests May 15, 2023
@github-actions github-actions bot added the feature New feature or functionality label May 15, 2023
- rename module to `user_agent`
- add feature name "parameters", "idempotency" to user-agent
- rename module to `user_agent`
- add feature name "parameters", "idempotency" to user-agent
@codecov-commenter
Copy link

codecov-commenter commented May 15, 2023

Codecov Report

Patch coverage: 75.60% and project coverage change: -0.26 ⚠️

Comparison is base (9e0f15c) 97.47% compared to head (b79bd83) 97.21%.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #2267      +/-   ##
===========================================
- Coverage    97.47%   97.21%   -0.26%     
===========================================
  Files          150      152       +2     
  Lines         6925     6998      +73     
  Branches       509      513       +4     
===========================================
+ Hits          6750     6803      +53     
- Misses         137      155      +18     
- Partials        38       40       +2     
Impacted Files Coverage Δ
aws_lambda_powertools/shared/user_agent.py 61.22% <61.22%> (ø)
..._powertools/utilities/streaming/_s3_seekable_io.py 89.00% <80.00%> (-0.48%) ⬇️
aws_lambda_powertools/__init__.py 100.00% <100.00%> (ø)
aws_lambda_powertools/shared/version.py 100.00% <100.00%> (ø)
.../utilities/data_classes/code_pipeline_job_event.py 100.00% <100.00%> (ø)
...ools/utilities/idempotency/persistence/dynamodb.py 100.00% <100.00%> (ø)
aws_lambda_powertools/utilities/parameters/base.py 99.15% <100.00%> (+0.04%) ⬆️

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@boring-cyborg boring-cyborg bot added the dependencies Pull requests that update a dependency file label May 17, 2023
@leandrodamascena leandrodamascena linked an issue May 17, 2023 that may be closed by this pull request
2 tasks
@leandrodamascena leandrodamascena changed the title feat(User-Agent): Add PT User-Agent to AWS SDK requests feat(user-agent): Add custom header User-Agent to AWS SDK requests May 17, 2023
@leandrodamascena leandrodamascena changed the title feat(user-agent): Add custom header User-Agent to AWS SDK requests feat(user-agent): add custom header User-Agent to AWS SDK requests May 17, 2023
@leandrodamascena leandrodamascena removed do-not-merge need-issue PRs that are missing related issues labels May 17, 2023
@boring-cyborg boring-cyborg bot added the typing Static typing definition related issues (mypy, pyright, etc.) label May 17, 2023
@leandrodamascena leandrodamascena linked an issue May 19, 2023 that may be closed by this pull request
@leandrodamascena
Copy link
Contributor

Hi @heitorlessa! After some hard work and efforts put into research, PoC, and exhaustive tests done by Roger and me, I think we need one last review from you on this PR before the merge.
Thanks for all the effort @roger-zhangg!

Copy link
Contributor

@heitorlessa heitorlessa left a comment

Choose a reason for hiding this comment

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

looks great! Some initial comments to make reading code and refactoring later easier.

I'll look on doc strings and for ergonomics when I have more time during the flight.

Just missing this additional area for user-agent:

aws_lambda_powertools/shared/user_agent.py Outdated Show resolved Hide resolved
aws_lambda_powertools/shared/user_agent.py Outdated Show resolved Hide resolved
aws_lambda_powertools/shared/user_agent.py Outdated Show resolved Hide resolved
aws_lambda_powertools/utilities/parameters/base.py Outdated Show resolved Hide resolved
aws_lambda_powertools/utilities/parameters/base.py Outdated Show resolved Hide resolved
@roger-zhangg
Copy link
Member Author

Hey Heitor,
Thanks for this detailed review. I've updated all files related to your comments. Please check.

Thanks!
Roger

@leandrodamascena
Copy link
Contributor

Just missing this additional area for user-agent:

Thank you for indicating this area @heitorlessa! I Didn't remember we made life easier to get objects from S3 when using CodePipelineJob :)

@leandrodamascena leandrodamascena self-requested a review May 31, 2023 08:33
Copy link
Contributor

@leandrodamascena leandrodamascena left a comment

Choose a reason for hiding this comment

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

Hello @roger-zhangg! This is a huge amount of great work! Thanks for all efforts and research to make it possible.

APPROVED!

@leandrodamascena leandrodamascena merged commit 5a36504 into aws-powertools:develop Jun 1, 2023
6 checks passed
@boring-cyborg
Copy link

boring-cyborg bot commented Jun 1, 2023

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

roger-zhangg added a commit to roger-zhangg/aws-lambda-powertools-python that referenced this pull request Jun 5, 2023
…ws-powertools#2267)

Co-authored-by: Leandro Damascena <leandro.damascena@gmail.com>
@roger-zhangg roger-zhangg deleted the user-agent branch June 6, 2023 16:12
sthulb pushed a commit that referenced this pull request Jun 19, 2023
…2267)

Co-authored-by: Leandro Damascena <leandro.damascena@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
commons dependencies Pull requests that update a dependency file feature New feature or functionality size/L Denotes a PR that changes 100-499 lines, ignoring generated files. streaming typing Static typing definition related issues (mypy, pyright, etc.)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature request: Add custom header User-Agent to SDK Calls Expose version function in package root
4 participants