Skip to content

Support clear custom dimensions and related enhancements #89

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 11 commits into from
Aug 26, 2022

Conversation

Stephen-Bao
Copy link
Contributor

@Stephen-Bao Stephen-Bao commented Aug 22, 2022

Issue #, if available:
#87

Description of changes:
Added support to clear custom dimensions, configure the behavior of flush on custom dimensions, and related enhancement. This is the equivalent feature implementation as in the Java library:

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

@markkuhn markkuhn added the enhancement New feature or request label Aug 22, 2022
@Stephen-Bao Stephen-Bao requested a review from markkuhn August 22, 2022 20:41
@Stephen-Bao Stephen-Bao requested a review from markkuhn August 24, 2022 14:15
Co-authored-by: Himtanaya Bhadada <[email protected]>
@hussam789
Copy link

PR Code Suggestions ✨

CategorySuggestion                                                                                                                                    Impact
Possible issue
Make parameter keyword-only

The use_default parameter should be marked as keyword-only to match the
documentation in README.md which states it's a "keyword-only parameter". Without
this, users could accidentally pass a boolean as a positional argument, causing
unexpected behavior.

aws_embedded_metrics/logger/metrics_logger.py [68-70]

-def set_dimensions(self, *dimensions: Dict[str, str], use_default: bool = False) -> "MetricsLogger":
+def set_dimensions(self, *dimensions: Dict[str, str], *, use_default: bool = False) -> "MetricsLogger":
     self.context.set_dimensions(list(dimensions), use_default)
     return self
  • Apply this suggestion
Suggestion importance[1-10]: 7

__

Why: The suggestion correctly updates the function signature to enforce the keyword-only nature of the 'use_default' parameter, aligning it with the README.md documentation. This helps prevent unintended behavior from passing a boolean as a positional argument.

Medium
  • More

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants