logstash-output-dogstatsd 1.2.0 → 1.3.0

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
  SHA1:
3
- metadata.gz: 0cb8720939c32309a703107f259983b53df4207c
4
- data.tar.gz: 754cac540de40f10618bbadbfa4f0494bc014721
3
+ metadata.gz: b5ddb05f4531bbcabcd244a0dba19614a95a003a
4
+ data.tar.gz: b8a1da9467d14137a19f35320b9c40f35fbc81d5
5
5
  SHA512:
6
- metadata.gz: 892f9d95c67a7ecfb8e4ce7529559efa1d622be0f87d3beb3f931a9ec10408c7eedbe419b587b99485027ace7600d371e0dbd43909b3d06a3c55028891551fdc
7
- data.tar.gz: d2f85fb11a8d0dc3d0639d72e3a89fe3b89c9b66d533c02f8a3a53949612e3165ebf8f30a03dcefdf130680becb22ec25944ba6811d0d438b9ceca225e58dcfa
6
+ metadata.gz: 7b63850c1cf2c3e37e80297d04ee405f05f96eed298676353158387ba477c6f709b6cfda1bdc5f75c33f976281de56c66c07443687c0eab7ad12124afee8b969
7
+ data.tar.gz: e1e90e25ed3fb81c8864bd3f0dafafc24dcb7e7d0f3836e5fcef700c0386ff82cf7d19dce4bc301005aa87a4c09762b4f87f3264cf2ad9601c4529a07f2ce2ca
@@ -29,9 +29,7 @@ end
29
29
  # [source,ruby]
30
30
  # output {
31
31
  # dogstatsd {
32
- # metric_tags => {
33
- # "host" => "%{host}"
34
- # }
32
+ # metric_tags => ["host:%{host}","role:foo"]
35
33
  # count => {
36
34
  # "http.bytes" => "%{bytes}"
37
35
  # }
@@ -71,7 +69,7 @@ class LogStash::Outputs::Dogstatsd < LogStash::Outputs::Base
71
69
  config :sample_rate, :validate => :number, :default => 1
72
70
 
73
71
  # The tags to apply to each metric.
74
- config :metric_tags, :validate => :hash, :default => {}
72
+ config :metric_tags, :validate => :array, :default => []
75
73
 
76
74
  public
77
75
  def register
@@ -83,8 +81,10 @@ class LogStash::Outputs::Dogstatsd < LogStash::Outputs::Base
83
81
  return unless output?(event)
84
82
  @logger.debug? and @logger.debug("Event: #{event}")
85
83
 
86
- tags = process_tags(event, @metric_tags)
87
- metric_opts = { :sample_rate => @sample_rate, :tags => tags }
84
+ metric_opts = {
85
+ :sample_rate => @sample_rate,
86
+ :tags => @metric_tags.map { |t| event.sprintf(t) }
87
+ }
88
88
 
89
89
  @increment.each do |metric|
90
90
  @client.increment(event.sprintf(metric), metric_opts)
@@ -110,10 +110,4 @@ class LogStash::Outputs::Dogstatsd < LogStash::Outputs::Base
110
110
  @client.gauge(event.sprintf(metric), event.sprintf(val), metric_opts)
111
111
  end
112
112
  end # def receive
113
-
114
- private
115
- # Returns an array of tags like ["tag1:value1", "tag2:value2"]
116
- def process_tags(event, tags)
117
- tags.map { |k, v| event.sprintf(k) + ':' + event.sprintf(v) }
118
- end
119
113
  end # class LogStash::Outputs::Statsd
@@ -1,7 +1,7 @@
1
1
  Gem::Specification.new do |s|
2
2
 
3
3
  s.name = 'logstash-output-dogstatsd'
4
- s.version = '1.2.0'
4
+ s.version = '1.3.0'
5
5
  s.licenses = ['Apache License (2.0)']
6
6
  s.summary = "Send metrics to StatsD"
7
7
  s.description = "This gem is a logstash plugin required to be installed on top of the Logstash core pipeline using $LS_HOME/bin/plugin install gemname. This gem is not a stand-alone program"
@@ -39,7 +39,7 @@ describe LogStash::Outputs::Dogstatsd do
39
39
  end
40
40
 
41
41
  context 'with tags' do
42
- let(:metric_config) { super().merge('metric_tags' => { 'foo' => '%{value}' }) }
42
+ let(:metric_config) { super().merge('metric_tags' => ['foo:%{value}']) }
43
43
  let(:event) { { 'value' => 'helloworld' } }
44
44
 
45
45
  it 'sprintf tags' do
@@ -55,7 +55,7 @@ describe LogStash::Outputs::Dogstatsd do
55
55
  let(:metric_config) { { 'histogram' => { '%{metric_name}' => '%{track_value}' } } }
56
56
  let(:event) { super().merge('metric_name' => metric_to_track, 'track_value' => 123) }
57
57
 
58
- context 'with tags in the metric name and value' do
58
+ context 'with event fields in the metric name and value' do
59
59
  it 'tracks' do
60
60
  expect_any_instance_of(Datadog::Statsd).to receive(:send_to_socket)
61
61
  .with("#{metric_to_track}:123|h")
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logstash-output-dogstatsd
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tom Dooner
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-08-27 00:00:00.000000000 Z
11
+ date: 2015-08-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: logstash-core