Skip to content

improv: override Tracer auto-capture response/exception via env vars #259

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

Merged

Conversation

heitorlessa
Copy link
Contributor

@heitorlessa heitorlessa commented Jan 12, 2021

Issue #, if available: Feature parity with Java powertools PR aws-powertools/powertools-lambda-java#249

Description of changes:

Adds env var support to override default behaviour in Tracer of auto-capturing both response and error:

Environment variable Description
POWERTOOLS_TRACER_CAPTURE_RESPONSE disable auto-capture response as metadata (e.g. "true", "True", "TRUE")
POWERTOOLS_TRACER_CAPTURE_ERROR disable auto-capture error as metadata (e.g. "true", "True", "TRUE")

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.

@heitorlessa heitorlessa self-assigned this Jan 12, 2021
@heitorlessa heitorlessa marked this pull request as draft January 12, 2021 17:30
@codecov-io
Copy link

codecov-io commented Jan 12, 2021

Codecov Report

Merging #259 (97fdaae) into develop (1131541) will decrease coverage by 0.07%.
The diff coverage is 92.00%.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop     #259      +/-   ##
===========================================
- Coverage    99.81%   99.74%   -0.08%     
===========================================
  Files           76       78       +2     
  Lines         2763     2777      +14     
  Branches       113      114       +1     
===========================================
+ Hits          2758     2770      +12     
- Misses           4        5       +1     
- Partials         1        2       +1     
Impacted Files Coverage Δ
aws_lambda_powertools/tracing/tracer.py 98.89% <89.47%> (-1.11%) ⬇️
aws_lambda_powertools/shared/constants.py 100.00% <100.00%> (ø)
aws_lambda_powertools/shared/functions.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 1131541...97fdaae. Read the comment docs.

@heitorlessa heitorlessa changed the title [WIP] improv: add capture_response, capture_error env vars to override default Tracer behaviour improv: add capture_response, capture_error env vars to override default Tracer behaviour Jan 13, 2021
@heitorlessa heitorlessa marked this pull request as ready for review January 13, 2021 13:54
@heitorlessa heitorlessa changed the title improv: add capture_response, capture_error env vars to override default Tracer behaviour improv: override Tracer auto-capture response/exception via env vars Jan 13, 2021
@heitorlessa
Copy link
Contributor Author

Addressed all your comments and some other oversights I've noticed too - Here's the doc too. Over to you @nmoutschen

image

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.

LGTM

@heitorlessa heitorlessa merged commit 8ad7e04 into aws-powertools:develop Jan 13, 2021
@heitorlessa heitorlessa deleted the improv/tracer-capture-flags branch January 13, 2021 15:43
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
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants