statsd-instrument 2.3.1 → 2.3.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.github/probots.yml +2 -0
- data/CHANGELOG.md +8 -0
- data/Rakefile +1 -1
- data/lib/statsd/instrument.rb +1 -1
- data/lib/statsd/instrument/metric.rb +12 -3
- data/lib/statsd/instrument/version.rb +1 -1
- data/test/metric_test.rb +6 -0
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 03ab2f74c3b653690d20eea1102515c64d901f739599816a0813cb9ab748d950
|
4
|
+
data.tar.gz: 528dee5c361d7080a16a6a4da64057cc81596bbd9906eeb220fc731b30feb4f2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3c4ecdac1ee080fb1f92ca316f24669cccdc803fbb205ce577fbe45a58cb313cae98e9e7e04fc579ab230a99d1ae1353cfafe0d8d7c056ff7a98a3af35d1ea9e
|
7
|
+
data.tar.gz: d9f9161e46aa12696eeaabf9d975cac6a64118e608d2b16978a3528b50459014dbf1f50623a54e8021fba7b504067c6c8a942e4e36907830fa939338588cb60f
|
data/.github/probots.yml
ADDED
data/CHANGELOG.md
CHANGED
@@ -5,6 +5,14 @@ please at an entry to the "unreleased changes" section below.
|
|
5
5
|
|
6
6
|
### Unreleased changes
|
7
7
|
|
8
|
+
## Version 2.3.2
|
9
|
+
|
10
|
+
- Add option to override global prefix for metrics (#148)
|
11
|
+
|
12
|
+
## Version 2.3.1
|
13
|
+
|
14
|
+
- Add mutex around UDP socket invalidation (#147)
|
15
|
+
|
8
16
|
### Version 2.3.0
|
9
17
|
|
10
18
|
- No changes from `beta6`, distribtions are GA at DataDog so making the distribution changes GA in gem
|
data/Rakefile
CHANGED
data/lib/statsd/instrument.rb
CHANGED
@@ -448,7 +448,7 @@ module StatsD
|
|
448
448
|
|
449
449
|
# Instantiates a metric, and sends it to the backend for further processing.
|
450
450
|
# @param options (see StatsD::Instrument::Metric#initialize)
|
451
|
-
# @return [StatsD::Instrument::Metric] The
|
451
|
+
# @return [StatsD::Instrument::Metric] The metric that was sent to the backend.
|
452
452
|
def collect_metric(type, name, value, metric_options)
|
453
453
|
value, metric_options = parse_options(value, metric_options)
|
454
454
|
|
@@ -4,7 +4,9 @@
|
|
4
4
|
# @return [Symbol] The metric type. Must be one of {StatsD::Instrument::Metric::TYPES}
|
5
5
|
# @!attribute name
|
6
6
|
# @return [String] The name of the metric. {StatsD#prefix} will automatically be applied
|
7
|
-
# to the metric in the constructor, unless the <tt>:no_prefix</tt> option is set
|
7
|
+
# to the metric in the constructor, unless the <tt>:no_prefix</tt> option is set or is
|
8
|
+
# overridden by the <tt>:prefix</tt> option. Note that <tt>:no_prefix</tt> has greater
|
9
|
+
# precedence than <tt>:prefix</tt>.
|
8
10
|
# @!attribute value
|
9
11
|
# @see #default_value
|
10
12
|
# @return [Numeric, String] The value to collect for the metric. Depending on the metric
|
@@ -36,7 +38,8 @@ class StatsD::Instrument::Metric
|
|
36
38
|
#
|
37
39
|
# @option options [Symbol] :type The type of the metric.
|
38
40
|
# @option options [String] :name The name of the metric without prefix.
|
39
|
-
# @option options [
|
41
|
+
# @option options [String] :prefix Override the default StatsD prefix.
|
42
|
+
# @option options [Boolean] :no_prefix Set to <tt>true</tt> if you don't want to apply a prefix.
|
40
43
|
# @option options [Numeric, String, nil] :value The value to collect for the metric. If set to
|
41
44
|
# <tt>nil>/tt>, {#default_value} will be used.
|
42
45
|
# @option options [Numeric, nil] :sample_rate The sample rate to use. If not set, it will use
|
@@ -47,7 +50,13 @@ class StatsD::Instrument::Metric
|
|
47
50
|
@type = options[:type] or raise ArgumentError, "Metric :type is required."
|
48
51
|
@name = options[:name] or raise ArgumentError, "Metric :name is required."
|
49
52
|
@name = normalize_name(@name)
|
50
|
-
|
53
|
+
unless options[:no_prefix]
|
54
|
+
@name = if options[:prefix]
|
55
|
+
"#{options[:prefix]}.#{@name}"
|
56
|
+
else
|
57
|
+
StatsD.prefix ? "#{StatsD.prefix}.#{@name}" : @name
|
58
|
+
end
|
59
|
+
end
|
51
60
|
|
52
61
|
@value = options[:value] || default_value
|
53
62
|
@sample_rate = options[:sample_rate] || StatsD.default_sample_rate
|
data/test/metric_test.rb
CHANGED
@@ -22,6 +22,12 @@ class MetricTest < Minitest::Test
|
|
22
22
|
|
23
23
|
m = StatsD::Instrument::Metric.new(type: :c, name: 'counter', no_prefix: true)
|
24
24
|
assert_equal 'counter', m.name
|
25
|
+
|
26
|
+
m = StatsD::Instrument::Metric.new(type: :c, name: 'counter', prefix: "foobar")
|
27
|
+
assert_equal 'foobar.counter', m.name
|
28
|
+
|
29
|
+
m = StatsD::Instrument::Metric.new(type: :c, name: 'counter', prefix: "foobar", no_prefix: true)
|
30
|
+
assert_equal 'counter', m.name
|
25
31
|
end
|
26
32
|
|
27
33
|
def test_bad_metric_name
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: statsd-instrument
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.3.
|
4
|
+
version: 2.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jesse Storimer
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2018-11-
|
13
|
+
date: 2018-11-28 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rake
|
@@ -104,6 +104,7 @@ executables: []
|
|
104
104
|
extensions: []
|
105
105
|
extra_rdoc_files: []
|
106
106
|
files:
|
107
|
+
- ".github/probots.yml"
|
107
108
|
- ".gitignore"
|
108
109
|
- ".travis.yml"
|
109
110
|
- CHANGELOG.md
|
@@ -163,7 +164,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
163
164
|
version: '0'
|
164
165
|
requirements: []
|
165
166
|
rubyforge_project:
|
166
|
-
rubygems_version: 2.6
|
167
|
+
rubygems_version: 2.7.6
|
167
168
|
signing_key:
|
168
169
|
specification_version: 4
|
169
170
|
summary: A StatsD client for Ruby apps
|