dogstatsd-ruby 5.6.1 → 5.6.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/datadog/statsd/message_buffer.rb +2 -1
- data/lib/datadog/statsd/serialization/stat_serializer.rb +25 -15
- data/lib/datadog/statsd/serialization/tag_serializer.rb +3 -1
- data/lib/datadog/statsd/version.rb +1 -1
- data/lib/datadog/statsd.rb +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2f866425de553f6c35e54932dcfa114094ffca6061c8db730f81ebc7a6dbcca5
|
4
|
+
data.tar.gz: 8fd14544e331d78fc05d4530d5f0226cc4c654f91f86ad8a6dfbd4699af719ed
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 68852fd8801cc884e7df8f23377479156185065f279270758b9c668a1167019dae6fcb7a5cb818457bcc08644e86b308f91813467d7c45a323c9eb3bd57197b6
|
7
|
+
data.tar.gz: e921bc57cc7d68765189f4314e22652a4979ca9d043b76cd50c39b0cce884bd90dac600d8b2b890113b6c480cd2487de1d02d93864bc29f60e839ebaa45e508e
|
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.
|
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
|
-
|
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(
|
14
|
-
|
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}#{
|
18
|
+
"#{@prefix_str}#{metric_name}:#{delta}|#{type}|@#{sample_rate}|##{tags_list}"
|
19
19
|
else
|
20
|
-
"#{@prefix_str}#{
|
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}#{
|
24
|
+
"#{@prefix_str}#{metric_name}:#{delta}|#{type}|##{tags_list}"
|
25
25
|
else
|
26
|
-
"#{@prefix_str}#{
|
26
|
+
"#{@prefix_str}#{metric_name}:#{delta}|#{type}"
|
27
27
|
end
|
28
28
|
end
|
29
29
|
end
|
@@ -37,17 +37,27 @@ module Datadog
|
|
37
37
|
attr_reader :prefix
|
38
38
|
attr_reader :tag_serializer
|
39
39
|
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
40
|
+
if RUBY_VERSION < '3'
|
41
|
+
def metric_name_to_string(metric_name)
|
42
|
+
metric_name.to_s
|
43
|
+
end
|
44
|
+
else
|
45
|
+
def metric_name_to_string(metric_name)
|
46
|
+
Symbol === metric_name ? metric_name.name : metric_name.to_s
|
47
47
|
end
|
48
|
+
end
|
48
49
|
|
49
|
-
|
50
|
-
|
50
|
+
def formatted_metric_name(metric_name)
|
51
|
+
formatted = metric_name_to_string(metric_name)
|
52
|
+
if formatted.include?('::')
|
53
|
+
formatted = formatted.gsub('::', '.')
|
54
|
+
formatted.tr!(':|@', '_')
|
55
|
+
formatted
|
56
|
+
elsif formatted.include?(':') || formatted.include?('@') || formatted.include?('|')
|
57
|
+
formatted.tr(':|@', '_')
|
58
|
+
else
|
59
|
+
formatted
|
60
|
+
end
|
51
61
|
end
|
52
62
|
end
|
53
63
|
end
|
data/lib/datadog/statsd.rb
CHANGED
@@ -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
|
-
[
|
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.
|
4
|
+
version: 5.6.3
|
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:
|
12
|
+
date: 2024-11-04 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.
|
48
|
-
documentation_uri: https://www.rubydoc.info/gems/dogstatsd-ruby/5.6.
|
49
|
-
source_code_uri: https://github.com/DataDog/dogstatsd-ruby/tree/v5.6.
|
47
|
+
changelog_uri: https://github.com/DataDog/dogstatsd-ruby/blob/v5.6.3/CHANGELOG.md
|
48
|
+
documentation_uri: https://www.rubydoc.info/gems/dogstatsd-ruby/5.6.3
|
49
|
+
source_code_uri: https://github.com/DataDog/dogstatsd-ruby/tree/v5.6.3
|
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.
|
69
|
+
rubygems_version: 3.4.6
|
70
70
|
signing_key:
|
71
71
|
specification_version: 4
|
72
72
|
summary: A Ruby DogStatsd client
|