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 support for tracing of generators using capture_method decorator #113

Merged
merged 4 commits into from
Aug 20, 2020

Conversation

to-mc
Copy link
Contributor

@to-mc to-mc commented Aug 17, 2020

Issue #, if available: #112

Description of changes:

Added checks to capture_method to test if decorated function is a generator (and/or a context manager) and handle those cases appropriately.

Checklist

Breaking change checklist

RFC issue #:

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

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

@to-mc to-mc marked this pull request as draft August 17, 2020 14:25
@codecov-commenter
Copy link

codecov-commenter commented Aug 17, 2020

Codecov Report

Merging #113 into develop will decrease coverage by 1.28%.
The diff coverage is 89.85%.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop     #113      +/-   ##
===========================================
- Coverage   100.00%   98.71%   -1.29%     
===========================================
  Files           17       17              
  Lines          499      546      +47     
  Branches        46       48       +2     
===========================================
+ Hits           499      539      +40     
- Misses           0        7       +7     
Impacted Files Coverage Δ
aws_lambda_powertools/tracing/tracer.py 95.85% <89.85%> (-4.15%) ⬇️
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 6b66e0b...955646a. Read the comment docs.

@to-mc
Copy link
Contributor Author

to-mc commented Aug 18, 2020

This solves for the example reported in the issue (generator context managers) as well as plain generator functions, but I'd like to get some more eyes on it to make sure we aren't introducing unwanted side effects.

Screenshot 2020-08-17 at 15 59 51

@to-mc to-mc marked this pull request as ready for review August 18, 2020 14:30
@to-mc to-mc changed the title feat: add support for tracing of generators using capture_method decorator (WIP) feat: add support for tracing of generators using capture_method decorator Aug 18, 2020
@to-mc to-mc requested a review from heitorlessa August 19, 2020 09:27
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.

Changes look great, and docs are clear to me :)

Thanks a lot Tom for pulling this together.

@to-mc to-mc merged commit dbfbf55 into develop Aug 20, 2020
@to-mc to-mc deleted the feat/support_tracing_generators branch August 20, 2020 15:56
heitorlessa referenced this pull request in heitorlessa/aws-lambda-powertools-python Aug 22, 2020
* develop:
  chore: version bump to 1.3.1
  fix(capture_method): should yield inside with (#124)
  chore: bump version to 1.3.0 (#122)
  chore(deps): bump prismjs from 1.20.0 to 1.21.0 in /docs
  chore(deps): bump elliptic from 6.5.2 to 6.5.3 in /docs
  feat: add parameter utility (#96)
  chore: bump version to 1.2.0 (#119)
  feat: add support for tracing of generators using capture_method decorator (#113)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants