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(api-gateway): add debug mode #507

Merged
merged 12 commits into from
Jul 9, 2021

Conversation

michaelbrewer
Copy link
Contributor

@michaelbrewer michaelbrewer commented Jul 4, 2021

Issue #, if available:

Pairs with #506

Description of changes:

Add debug mode support:

  • Pretty print json request
  • Pretty print json responses
  • Output full stack trace

Checklist

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/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Jul 4, 2021
@michaelbrewer michaelbrewer changed the title feat(api-gateway): add debug mode feat(api-gateway): add debug mode [WIP] Jul 4, 2021
@codecov-commenter
Copy link

codecov-commenter commented Jul 4, 2021

Codecov Report

Merging #507 (f1e6faa) into develop (f61b02f) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff            @@
##           develop     #507   +/-   ##
========================================
  Coverage    99.90%   99.90%           
========================================
  Files          107      107           
  Lines         4266     4280   +14     
  Branches       208      212    +4     
========================================
+ Hits          4262     4276   +14     
  Misses           1        1           
  Partials         3        3           
Impacted Files Coverage Δ
aws_lambda_powertools/event_handler/api_gateway.py 100.00% <100.00%> (ø)
...s_lambda_powertools/event_handler/content_types.py 100.00% <100.00%> (ø)
aws_lambda_powertools/shared/constants.py 100.00% <100.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 f61b02f...f1e6faa. Read the comment docs.

@michaelbrewer michaelbrewer changed the title feat(api-gateway): add debug mode [WIP] feat(api-gateway): add debug mode Jul 5, 2021
@michaelbrewer michaelbrewer marked this pull request as ready for review July 5, 2021 00:29
@pull-request-size pull-request-size bot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Jul 5, 2021
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 good! One minor change in env var. QQ: how helpful would it be to literally print the event when this flag is enabled too?

I think this could be handled by Logger with the LOG_EVENT piece, so I'm on the fence.

aws_lambda_powertools/event_handler/api_gateway.py Outdated Show resolved Hide resolved
aws_lambda_powertools/shared/constants.py Outdated Show resolved Hide resolved
@heitorlessa heitorlessa added the feature New feature or functionality label Jul 5, 2021
@michaelbrewer
Copy link
Contributor Author

Looks good! One minor change in env var. QQ: how helpful would it be to literally print the event when this flag is enabled too?

I think this could be handled by Logger with the LOG_EVENT piece, so I'm on the fence.

Maybe as a debug tip to turn on log event environment variable.

@michaelbrewer
Copy link
Contributor Author

@heitorlessa ok it is all merged up.

@michaelbrewer
Copy link
Contributor Author

@heitorlessa i added the print of the request

@michaelbrewer
Copy link
Contributor Author

Looks good! One minor change in env var. QQ: how helpful would it be to literally print the event when this flag is enabled too?

I think this could be handled by Logger with the LOG_EVENT piece, so I'm on the fence.

I added the print part

@michaelbrewer
Copy link
Contributor Author

@heitorlessa any other updates needed?

@heitorlessa
Copy link
Contributor

heitorlessa commented Jul 7, 2021 via email

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.

That's great, one tiny change so we don't use mock in a functional test and capture stdout instead, then it's good to merge :)

You know, it'd be great to have permissions to push these so I don't have to bother ya ;)

tests/functional/event_handler/test_api_gateway.py Outdated Show resolved Hide resolved
Michael Brewer and others added 2 commits July 9, 2021 01:24
Co-authored-by: Heitor Lessa <heitor.lessa@hotmail.com>
@michaelbrewer
Copy link
Contributor Author

That's great, one tiny change so we don't use mock in a functional test and capture stdout instead, then it's good to merge :)

You know, it'd be great to have permissions to push these so I don't have to bother ya ;)

i think that only works if i do it via my personal account :)

@heitorlessa heitorlessa added this to the 1.18.0 milestone Jul 9, 2021
@heitorlessa heitorlessa merged commit 43b828e into aws-powertools:develop Jul 9, 2021
heitorlessa added a commit to heitorlessa/aws-lambda-powertools-python that referenced this pull request Jul 17, 2021
* develop:
  chore(deps): bump boto3 from 1.18.0 to 1.18.1 (aws-powertools#528)
  fix(tracer): mypy generic to preserve decorated method signature (aws-powertools#529)
  fix(parser): Make ApiGateway version, authorizer fields optional (aws-powertools#532)
  fix(mypy): fixes to resolve no implicit optional errors (aws-powertools#521)
  chore(deps): bump boto3 from 1.17.110 to 1.18.0 (aws-powertools#527)
  feat(feat-toggle): New simple feature toggles rule engine (WIP) (aws-powertools#494)
  chore(deps-dev): bump mkdocs-material from 7.1.9 to 7.1.10 (aws-powertools#522)
  chore(deps): bump boto3 from 1.17.102 to 1.17.110 (aws-powertools#523)
  chore(deps-dev): bump isort from 5.9.1 to 5.9.2 (aws-powertools#514)
  feat(mypy): add mypy support to makefile (aws-powertools#508)
  feat(api-gateway): add debug mode (aws-powertools#507)
@michaelbrewer michaelbrewer deleted the feat-api-debug branch August 3, 2021 23:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or functionality size/L Denotes a PR that changes 100-499 lines, ignoring generated files. tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants