Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Add dimension, metric and namespace validation #91

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 5 commits into from
Sep 15, 2022

Conversation

markkuhn
Copy link
Contributor

@markkuhn markkuhn commented Sep 7, 2022

Related to:

Description of changes:
Added validation for dimension, metric and namespace

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 changed the title add dimension, metric and namespace validation Add dimension, metric and namespace validation Sep 14, 2022
@markkuhn markkuhn merged commit 132159c into awslabs:master Sep 15, 2022
@markkuhn markkuhn linked an issue Sep 15, 2022 that may be closed by this pull request
@markkuhn markkuhn deleted the validation branch December 18, 2023 22:38
@hussam789
Copy link

PR Code Suggestions ✨

CategorySuggestion                                                                                                                                    Impact
Possible issue
Fix incorrect constant usage

The metric name length validation is using the wrong constant. It should use
MAX_METRIC_NAME_LENGTH instead of MAX_DIMENSION_NAME_LENGTH.

aws_embedded_metrics/validator.py [75-76]

-if len(name) > constants.MAX_DIMENSION_NAME_LENGTH:
-    raise InvalidMetricError(f"Metric name cannot be longer than {constants.MAX_DIMENSION_NAME_LENGTH} characters")
+if len(name) > constants.MAX_METRIC_NAME_LENGTH:
+    raise InvalidMetricError(f"Metric name cannot be longer than {constants.MAX_METRIC_NAME_LENGTH} characters")
  • Apply this suggestion
Suggestion importance[1-10]: 9

__

Why: The suggestion correctly identifies a bug where the metric name length is validated against the wrong constant, and replacing MAX_DIMENSION_NAME_LENGTH with MAX_METRIC_NAME_LENGTH ensures metrics are correctly validated.

High
  • 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.

Add validation for metrics, dimensions and namespace
4 participants