From cbe3b720f13e60e2a8a853353500c8ff5636bb6a Mon Sep 17 00:00:00 2001 From: David Elner Date: Thu, 9 Apr 2020 12:32:31 -0400 Subject: [PATCH] Fixed: TagSerializer not handling bad ':' tag --- lib/datadog/statsd/serialization/tag_serializer.rb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/datadog/statsd/serialization/tag_serializer.rb b/lib/datadog/statsd/serialization/tag_serializer.rb index 7dd93333..29b960b2 100644 --- a/lib/datadog/statsd/serialization/tag_serializer.rb +++ b/lib/datadog/statsd/serialization/tag_serializer.rb @@ -37,11 +37,11 @@ def to_tags_hash(tags) tags.dup when Array Hash[ - tags.collect do |string| - string.split(':').tap do |tokens| - tokens << nil if tokens.length == 1 - end - end + tags.map do |string| + tokens = string.split(':') + tokens << nil if tokens.length == 1 + tokens.length == 2 ? tokens : nil + end.compact ] else {}