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 +4 -4
- data/lib/logstash/outputs/dogstatsd.rb +6 -12
- data/logstash-output-dogstatsd.gemspec +1 -1
- data/spec/outputs/dogstatsd_spec.rb +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b5ddb05f4531bbcabcd244a0dba19614a95a003a
|
4
|
+
data.tar.gz: b8a1da9467d14137a19f35320b9c40f35fbc81d5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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 => :
|
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
|
-
|
87
|
-
|
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.
|
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' =>
|
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
|
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.
|
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-
|
11
|
+
date: 2015-08-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: logstash-core
|