dogstatsd-ruby 5.6.1 → 5.6.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8069234fd7b43382f85606fa53a858c502025937168c275347a0ec5552f566fc
4
- data.tar.gz: 81945812b5810033cc2f511364d3a962a1c932e771d4faa2a4366391fe447414
3
+ metadata.gz: fb5fc01f7ac477b0d99986331aba69b1556b2160246ff379a60f394be8fb0968
4
+ data.tar.gz: fc254d901ec1071acbef8fa724e30f54b0fd4c65592a726e68805ea484c54811
5
5
  SHA512:
6
- metadata.gz: 5b589a6f599dc547f980587c8902eed4012b4d627fd6abe28c21829f299ee695e33f38f2fe386fb3d9f7828327134f69831f0365ee4ff16d84b7de3830178081
7
- data.tar.gz: 05cb95baf12dbe3b2f17c835c8278f32198ce21d2d66ca14b4714aa90a12dd6a4976c48e9d9f326ca51cc66d95c83dd269e55aa6fe6e08409c61cec8866a9798
6
+ metadata.gz: 719c9f76ce1cc501fddff67f3e563eec94d612c40b8b29aa93bed1c270bc4d6d785eed088d5f4df513034f4eff38b1c1e67f2538c86372b07f353f29f6f0a18c
7
+ data.tar.gz: 7b2812a927a160ec0452e3366ed0eed9166ec95ecf88dc8ab325726d18e60d683d8bfb75845608f1e025a6af80871acd8a6e4d16a08c4d21c749731b1d327643
data/README.md CHANGED
@@ -226,7 +226,7 @@ As much as possible, we will add a "future deprecation" message in the minor rel
226
226
 
227
227
  ## Ruby Versions
228
228
 
229
- This gem supports and is tested on Ruby minor versions 2.1 through 3.1.
229
+ This gem supports and is tested on Ruby minor versions 2.1 through 3.3.
230
230
  Support for Ruby 2.0 was dropped in version 5.4.0.
231
231
 
232
232
  ## Credits
@@ -28,7 +28,8 @@ module Datadog
28
28
  # Serializes the message if it hasn't been already. Part of the
29
29
  # delay_serialization feature.
30
30
  if message.is_a?(Array)
31
- message = @serializer.to_stat(*message[0], **message[1])
31
+ stat, delta, type, tags, sample_rate = message
32
+ message = @serializer.to_stat(stat, delta, type, tags: tags, sample_rate: sample_rate)
32
33
  end
33
34
 
34
35
  message_size = message.bytesize
@@ -10,20 +10,20 @@ module Datadog
10
10
  @tag_serializer = TagSerializer.new(global_tags)
11
11
  end
12
12
 
13
- def format(name, delta, type, tags: [], sample_rate: 1)
14
- name = formated_name(name)
13
+ def format(metric_name, delta, type, tags: [], sample_rate: 1)
14
+ metric_name = formatted_metric_name(metric_name)
15
15
 
16
16
  if sample_rate != 1
17
17
  if tags_list = tag_serializer.format(tags)
18
- "#{@prefix_str}#{name}:#{delta}|#{type}|@#{sample_rate}|##{tags_list}"
18
+ "#{@prefix_str}#{metric_name}:#{delta}|#{type}|@#{sample_rate}|##{tags_list}"
19
19
  else
20
- "#{@prefix_str}#{name}:#{delta}|#{type}|@#{sample_rate}"
20
+ "#{@prefix_str}#{metric_name}:#{delta}|#{type}|@#{sample_rate}"
21
21
  end
22
22
  else
23
23
  if tags_list = tag_serializer.format(tags)
24
- "#{@prefix_str}#{name}:#{delta}|#{type}|##{tags_list}"
24
+ "#{@prefix_str}#{metric_name}:#{delta}|#{type}|##{tags_list}"
25
25
  else
26
- "#{@prefix_str}#{name}:#{delta}|#{type}"
26
+ "#{@prefix_str}#{metric_name}:#{delta}|#{type}"
27
27
  end
28
28
  end
29
29
  end
@@ -37,17 +37,18 @@ module Datadog
37
37
  attr_reader :prefix
38
38
  attr_reader :tag_serializer
39
39
 
40
- def formated_name(name)
41
- if name.is_a?(String)
42
- # DEV: gsub is faster than dup.gsub!
43
- formated = name.gsub('::', '.')
40
+ def formatted_metric_name(metric_name)
41
+ formatted = Symbol === metric_name ? metric_name.name : metric_name.to_s
42
+
43
+ if formatted.include?('::')
44
+ formatted = formatted.gsub('::', '.')
45
+ formatted.tr!(':|@', '_')
46
+ formatted
47
+ elsif formatted.include?(':') || formatted.include?('@') || formatted.include?('|')
48
+ formatted.tr(':|@', '_')
44
49
  else
45
- formated = name.to_s
46
- formated.gsub!('::', '.')
50
+ formatted
47
51
  end
48
-
49
- formated.tr!(':|@', '_')
50
- formated
51
52
  end
52
53
  end
53
54
  end
@@ -73,7 +73,9 @@ module Datadog
73
73
  end
74
74
 
75
75
  def escape_tag_content(tag)
76
- tag.to_s.delete('|,')
76
+ tag = tag.to_s
77
+ return tag unless tag.include?('|')
78
+ tag.delete('|,')
77
79
  end
78
80
 
79
81
  def dd_tags(env = ENV)
@@ -4,6 +4,6 @@ require_relative 'connection'
4
4
 
5
5
  module Datadog
6
6
  class Statsd
7
- VERSION = '5.6.1'
7
+ VERSION = '5.6.2'
8
8
  end
9
9
  end
@@ -431,7 +431,7 @@ module Datadog
431
431
  if sample_rate == 1 || opts[:pre_sampled] || rand <= sample_rate
432
432
  full_stat =
433
433
  if @delay_serialization
434
- [[stat, delta, type], {tags: opts[:tags], sample_rate: sample_rate}]
434
+ [stat, delta, type, opts[:tags], sample_rate]
435
435
  else
436
436
  serializer.to_stat(stat, delta, type, tags: opts[:tags], sample_rate: sample_rate)
437
437
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dogstatsd-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.6.1
4
+ version: 5.6.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rein Henrichs
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2023-09-07 00:00:00.000000000 Z
12
+ date: 2024-09-20 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: A Ruby DogStatsd client
15
15
  email: code@datadoghq.com
@@ -44,9 +44,9 @@ licenses:
44
44
  - MIT
45
45
  metadata:
46
46
  bug_tracker_uri: https://github.com/DataDog/dogstatsd-ruby/issues
47
- changelog_uri: https://github.com/DataDog/dogstatsd-ruby/blob/v5.6.1/CHANGELOG.md
48
- documentation_uri: https://www.rubydoc.info/gems/dogstatsd-ruby/5.6.1
49
- source_code_uri: https://github.com/DataDog/dogstatsd-ruby/tree/v5.6.1
47
+ changelog_uri: https://github.com/DataDog/dogstatsd-ruby/blob/v5.6.2/CHANGELOG.md
48
+ documentation_uri: https://www.rubydoc.info/gems/dogstatsd-ruby/5.6.2
49
+ source_code_uri: https://github.com/DataDog/dogstatsd-ruby/tree/v5.6.2
50
50
  post_install_message: |2+
51
51
 
52
52
  If you are upgrading from v4.x of the dogstatsd-ruby library, note the major change to the threading model:
@@ -66,7 +66,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
66
66
  - !ruby/object:Gem::Version
67
67
  version: '0'
68
68
  requirements: []
69
- rubygems_version: 3.2.3
69
+ rubygems_version: 3.1.6
70
70
  signing_key:
71
71
  specification_version: 4
72
72
  summary: A Ruby DogStatsd client