Skip to content
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

[Bugfix] Delete commas when escaping tag content #301

Merged
merged 1 commit into from
Dec 17, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/datadog/statsd/serialization/tag_serializer.rb
Original file line number Diff line number Diff line change
@@ -74,8 +74,8 @@ def to_tags_list(tags)

def escape_tag_content(tag)
tag = tag.to_s
return tag unless tag.include?('|')
tag.delete('|,')
return tag unless tag.include?('|') || tag.include?(',')
tag.delete('|,')
end

def dd_tags(env = ENV)
2 changes: 2 additions & 0 deletions spec/statsd/serialization/tag_serializer_spec.rb
Original file line number Diff line number Diff line change
@@ -132,6 +132,8 @@
context '[testing serialization edge cases]' do
it 'formats tags with reserved characters' do
expect(subject.format(['name:foo,bar|foo'])).to eq 'name:foobarfoo'
expect(subject.format(['name:foobar|foo'])).to eq 'name:foobarfoo'
expect(subject.format(['name:foo, bar, and foo'])).to eq 'name:foo bar and foo'
end

it 'formats tags values with to_s' do