Remove illegal characters from tags#517
Merged
zippolyte merged 5 commits intoDataDog:masterfrom Mar 3, 2020
Merged
Conversation
jirikuncar
commented
Jan 21, 2020
tests/unit/dogstatsd/test_statsd.py
Outdated
|
|
||
| def test_pipe_in_tags(self): | ||
| self.statsd.gauge('gt', 123.4, tags=['pipe|in:tag', 'red']) | ||
| assert_equal_telemetry('gt:123.4|g|#pipe?in:tag,red', self.recv()) |
Contributor
Author
There was a problem hiding this comment.
what should go there instead of ??
jirikuncar
commented
Jan 22, 2020
hush-hush
previously approved these changes
Jan 23, 2020
|
This issue has been automatically marked as stale because it has not had activity in the last 30 days. |
jirikuncar
commented
Feb 28, 2020
datadog/util/format.py
Outdated
| import json | ||
| import re | ||
|
|
||
| TAG_INVALID_CHARS_RE = re.compile(r"[^\w\d_\-:/\.]") |
Contributor
Author
There was a problem hiding this comment.
shall we allow space?
jirikuncar
commented
Feb 28, 2020
datadog/util/format.py
Outdated
| import json | ||
| import re | ||
|
|
||
| TAG_INVALID_CHARS_RE = re.compile(r"[^\w\d_\-:/\.]") |
Contributor
Author
There was a problem hiding this comment.
Suggested change
| TAG_INVALID_CHARS_RE = re.compile(r"[^\w\d_\-:/\.]") | |
| TAG_INVALID_CHARS_RE = re.compile(r"[^\w\d_\-:/\. ]") |
jirikuncar
commented
Feb 28, 2020
| tag_list_test = ["tag1, tag2", "tag3 ,tag4", "tag5,tag6"] | ||
| tag_list_final = normalize_tags(tag_list_test) | ||
| assert tag_list_final == ["tag1_ tag2", "tag3 _tag4", "tag5_tag6"] | ||
| assert tag_list_final == ["tag1__tag2", "tag3__tag4", "tag5_tag6"] |
Contributor
Author
There was a problem hiding this comment.
in case we want to keep space https://github.com/DataDog/datadogpy/pull/517/files#r385638649
Suggested change
| assert tag_list_final == ["tag1__tag2", "tag3__tag4", "tag5_tag6"] | |
| assert tag_list_final == ["tag1_ tag2", "tag3 _tag4", "tag5_tag6"] |
Contributor
Author
|
/azp run DataDog.datadogpy.integration |
|
Azure Pipelines successfully started running 1 pipeline(s). |
zippolyte
approved these changes
Feb 28, 2020
hush-hush
approved these changes
Feb 28, 2020
walerian777
pushed a commit
to walerian777/datadogpy
that referenced
this pull request
Dec 12, 2022
According to the documentation https://docs.datadoghq.com/metrics/custom_metrics/#naming-custom-metrics metric names contain only ASCII alphanumerics, underscores, and periods, while other characters are converted to underscores. This commit ensures we replace all invalid characters with underscores for both namespaces and metric names. A similar thing has been already done for tags in DataDog#489 and DataDog#517, so I followed the example. It solves DataDog#740.
walerian777
pushed a commit
to walerian777/datadogpy
that referenced
this pull request
Dec 12, 2022
According to the documentation https://docs.datadoghq.com/metrics/custom_metrics/#naming-custom-metrics metric names contain only ASCII alphanumerics, underscores, and periods, while other characters are converted to underscores. This commit ensures we replace all invalid characters with underscores for both namespaces and metric names. A similar thing has been already done for tags in DataDog#489 and DataDog#517, so I followed the example. It solves DataDog#740.
walerian777
pushed a commit
to walerian777/datadogpy
that referenced
this pull request
Dec 12, 2022
According to the documentation https://docs.datadoghq.com/metrics/custom_metrics/#naming-custom-metrics metric names contain only ASCII alphanumerics, underscores, and periods, while other characters are converted to underscores. This commit ensures we replace all invalid characters with underscores for both namespaces and metric names. A similar thing has been already done for tags in DataDog#489 and DataDog#517, so I followed the example. It solves DataDog#740.
6 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Check behavior of pipe character in tags.
Description of the Change
Added a test-case.
Alternate Designs
Possible Drawbacks
Verification Process
Additional Notes
addresses #19
Release Notes
Review checklist (to be filled by reviewers)
changelog/label attached. If applicable it should have thebackward-incompatiblelabel attached.do-not-merge/label attached.kind/andseverity/labels attached at least.