statsd-instrument 2.3.1 → 2.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 29a69f0f787438aaac68b43dc26ed9ef07cd9b54
4
- data.tar.gz: 1f383bbdca11cab8563cf0eab7309a1b98c43339
2
+ SHA256:
3
+ metadata.gz: 03ab2f74c3b653690d20eea1102515c64d901f739599816a0813cb9ab748d950
4
+ data.tar.gz: 528dee5c361d7080a16a6a4da64057cc81596bbd9906eeb220fc731b30feb4f2
5
5
  SHA512:
6
- metadata.gz: b0fc4b08fcb0e19bafc8e6353b8a49f5692acbf60a0d4baa0df9a97802fa374fdb61e4d5c0fb245b693357ec128a649d305963380af3365be97d9842ee7ccf6a
7
- data.tar.gz: 8e9ed32da19d0ea35ef96711bd34528c19d49edcf025b2a6e3a309c8689fd2e9c2d9b79154a696151a1e3380771b781c4adc2f6a725ea5ee320c3b44c56773e0
6
+ metadata.gz: 3c4ecdac1ee080fb1f92ca316f24669cccdc803fbb205ce577fbe45a58cb313cae98e9e7e04fc579ab230a99d1ae1353cfafe0d8d7c056ff7a98a3af35d1ea9e
7
+ data.tar.gz: d9f9161e46aa12696eeaabf9d975cac6a64118e608d2b16978a3528b50459014dbf1f50623a54e8021fba7b504067c6c8a942e4e36907830fa939338588cb60f
@@ -0,0 +1,2 @@
1
+ enabled:
2
+ - cla
@@ -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
@@ -2,7 +2,7 @@ require 'bundler/gem_tasks'
2
2
  require 'rake/testtask'
3
3
 
4
4
  Rake::TestTask.new('test') do |t|
5
- t.ruby_opts << '-rubygems'
5
+ t.ruby_opts << '-r rubygems'
6
6
  t.libs << 'lib' << 'test'
7
7
  t.test_files = FileList['test/*.rb']
8
8
  end
@@ -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 meric that was sent to the backend.
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 [Boolean] :no_prefix Set to <tt>true</tt> if you don't want to apply {StatsD#prefix}
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
- @name = StatsD.prefix ? "#{StatsD.prefix}.#{@name}" : @name unless options[:no_prefix]
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
@@ -1,5 +1,5 @@
1
1
  module StatsD
2
2
  module Instrument
3
- VERSION = "2.3.1"
3
+ VERSION = "2.3.2"
4
4
  end
5
5
  end
@@ -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.1
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-07 00:00:00.000000000 Z
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.14
167
+ rubygems_version: 2.7.6
167
168
  signing_key:
168
169
  specification_version: 4
169
170
  summary: A StatsD client for Ruby apps