Skip to content

Commit

Permalink
[Bugfix] Delete commas when escaping tag content (#301)
Browse files Browse the repository at this point in the history
  • Loading branch information
mattwd7 authored Dec 17, 2024
1 parent 694f421 commit 107c417
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/datadog/statsd/serialization/tag_serializer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 2 additions & 0 deletions spec/statsd/serialization/tag_serializer_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 107c417

Please sign in to comment.