Skip to content

feat: toggle to disable log deduplication locally for pytest live log #262 #268

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

Conversation

heitorlessa
Copy link
Contributor

@heitorlessa heitorlessa commented Jan 17, 2021

Issue #, if available: #262

Description of changes:

This allows customers to disable log deduplication filter protection to use Pytest Live Log feature (and similar). When root logger is configured, Powertools Logger will intercept any propagated message to prevent duplicates. This feature overrides this protection.

Pytest Live Log feature with this feature

image

Pytest Live Log feature without the explicit override

image

Docs

image

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.

@codecov-io
Copy link

codecov-io commented Jan 17, 2021

Codecov Report

Merging #268 (7abc043) into develop (454d669) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff            @@
##           develop     #268   +/-   ##
========================================
  Coverage    99.75%   99.75%           
========================================
  Files           79       79           
  Lines         2820     2823    +3     
  Branches       115      116    +1     
========================================
+ Hits          2813     2816    +3     
  Misses           5        5           
  Partials         2        2           
Impacted Files Coverage Δ
aws_lambda_powertools/logging/logger.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 454d669...7abc043. Read the comment docs.

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 - Just some small nitpicks.

@@ -129,12 +129,14 @@ def __init__(
self.sampling_rate = resolve_env_var_choice(
choice=sampling_rate, env=os.getenv(constants.LOGGER_LOG_SAMPLING_RATE, 0.0)
)
self._is_deduplication_disabled = resolve_truthy_env_var_choice(
Copy link
Contributor

Choose a reason for hiding this comment

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

NIT: We store whether the deduplication is disabled rather than enabled, then (line 175) we check against this flag not being true. It makes this flag a bit hard to read IMHO. Should we invert this?

@heitorlessa heitorlessa merged commit 54d8967 into aws-powertools:develop Jan 18, 2021
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