Skip to content

Preserve logger context across flushes #12

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
merged 1 commit into from
Jan 31, 2020
Merged

Conversation

jaredcnance
Copy link
Member

@jaredcnance jaredcnance commented Dec 12, 2019

Closes #11

@jaredcnance jaredcnance changed the title Jared/fix #11 Preserve logger context across flushes Jan 10, 2020
@jaredcnance jaredcnance merged commit e89d63b into master Jan 31, 2020
@hussam789
Copy link

PR Code Suggestions ✨

CategorySuggestion                                                                                                                                    Impact
General
Initialize empty metrics dictionary

The method doesn't copy metrics as mentioned in the docstring "Creates a deep
copy of the context excluding metrics", but there's no explicit code to ensure
metrics are excluded. Add code to initialize an empty metrics dictionary in the
new context.

aws_embedded_metrics/logger/metrics_context.py [138-141]

 new_dimensions: List[Dict] = []
 
 new_default_dimensions: Dict = {}
 new_default_dimensions.update(self.default_dimensions)
 
+# Ensure metrics are not copied as per method docstring
+new_metrics: Dict = {}
+
  • Apply this suggestion
Suggestion importance[1-10]: 7

__

Why: The suggestion correctly identifies that the method's docstring promises to exclude metrics and that tests expect an empty metrics collection; however, the proposed change only adds an isolated initialization without showing its integration into the new context construction, so its impact on overall functionality is moderate.

Medium
  • More

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.

Preserve logger context across flushes
2 participants