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: Add AppConfig parameter provider #236

Merged
merged 2 commits into from
Jan 15, 2021

Conversation

ran-isenberg
Copy link
Contributor

#187
this is a poc for the app conf provider.
there's a lot of work in the docs department and in the tests.
There's just one test at the moment but it works.
There's also the issue of handling yaml confs. This might require a new transform with pyyaml package maybe.

Is the UX ok?

@heitorlessa heitorlessa added area/utilities feature New feature or functionality labels Dec 9, 2020
Copy link
Contributor

@nmoutschen nmoutschen left a comment

Choose a reason for hiding this comment

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

Hey Ran!

Thanks a lot for your PR! Overall, from an UX perspective, I just have two main questions:

  • Should we rename the helper function to get_app_config() instead?
  • Should we allow developers to control the client ID?

I've also flagged 2-3 things just for tracking purposes (e.g examples, a todo).

"BaseProvider",
"GetParameterError",
"DynamoDBProvider",
"SecretsProvider",
"SSMProvider",
"TransformParameterError",
"get_configuration",
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm wondering if this could cause confusion. Should this be get_app_config?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sure, good idea.

aws_lambda_powertools/utilities/parameters/appconf.py Outdated Show resolved Hide resolved

from .base import DEFAULT_PROVIDERS, BaseProvider

CLIENT_ID = str(uuid4())
Copy link
Contributor

Choose a reason for hiding this comment

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

Question: should we keep this configurable when initializing the class?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

is that auditable in some way ? if not, i suppose it's best to keep things simple.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think this is a good default, but I'm wondering if there could be cases where someone might want to share a client ID across multiple execution environment.

aws_lambda_powertools/utilities/parameters/base.py Outdated Show resolved Hide resolved
@ran-isenberg ran-isenberg force-pushed the appconf branch 2 times, most recently from e1091f1 to 1df31c1 Compare December 20, 2020 09:14
@ran-isenberg ran-isenberg changed the title [DRAFT POC] feat: Add AppConfig parameter provider feat: Add AppConfig parameter provider Dec 20, 2020
@codecov-io
Copy link

codecov-io commented Dec 20, 2020

Codecov Report

Merging #236 (b8a5b25) into develop (06d58d4) will decrease coverage by 0.10%.
The diff coverage is 90.62%.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop     #236      +/-   ##
===========================================
- Coverage    99.81%   99.71%   -0.11%     
===========================================
  Files           76       77       +1     
  Lines         2768     2804      +36     
  Branches       112      113       +1     
===========================================
+ Hits          2763     2796      +33     
- Misses           4        6       +2     
- Partials         1        2       +1     
Impacted Files Coverage Δ
...ambda_powertools/utilities/parameters/appconfig.py 89.65% <89.65%> (ø)
...lambda_powertools/utilities/parameters/__init__.py 100.00% <100.00%> (ø)
aws_lambda_powertools/utilities/parameters/base.py 100.00% <100.00%> (ø)
aws_lambda_powertools/logging/logger.py 100.00% <0.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 06d58d4...b8a5b25. Read the comment docs.

@ran-isenberg
Copy link
Contributor Author

ran-isenberg commented Dec 20, 2020

@heitorlessa @nmoutschen added docs and more tests. Please review :)
also, i'm not really sure why it says the test coverage has decreased.

Copy link
Contributor

@nmoutschen nmoutschen left a comment

Choose a reason for hiding this comment

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

Hey Ran!

Overall looks good. I just have two remarks. On one, I think there's an indentation issue. On the second one, I think we should remove the mention of the yaml transform since it's not supported.

aws_lambda_powertools/utilities/parameters/appconfig.py Outdated Show resolved Hide resolved
aws_lambda_powertools/utilities/parameters/base.py Outdated Show resolved Hide resolved
@heitorlessa
Copy link
Contributor

I know Ran is currently ill (wishing him a speedy recovery), so I'll wait until Friday morning before we send those fixes ourselves to ensure this gets shipped in 1.10.0 this week -- ;)

@heitorlessa
Copy link
Contributor

@nmoutschen can we merge to release 1.10 with this feat?

@nmoutschen
Copy link
Contributor

Yep! LGTM here. I'll let you do it since I pushed changes.

@heitorlessa heitorlessa merged commit 8931390 into aws-powertools:develop Jan 15, 2021
heitorlessa referenced this pull request in heitorlessa/aws-lambda-powertools-python Jan 17, 2021
* develop:
  chore: move env names to constant file (#264)
  docs: fix import (#267)
  feat: Add AppConfig parameter provider (#236)
  chore: update stale bot
  improv: override Tracer auto-capture response/exception via env vars (#259)
  docs: add info about extras layer (#260)
  feat: support extra parameter in Logger messages (#257)
  chore: general simplifications and cleanup (#255)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants