fluent-plugin-dogstatsd 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/fluent/plugin/dogstatsd/version.rb +1 -1
- data/lib/fluent/plugin/out_dogstatsd.rb +10 -6
- data/test/plugin/test_out_dogstatsd.rb +24 -0
- 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: bb0069527436a3f8212e8656e72708cb57050244
|
4
|
+
data.tar.gz: 121fc2d3d1faf0dc90cafde23438776e2f921fe0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 76b195e133d9cb9bb1c2bfb1d496cbcd8b558218fa96c49131671269f9f0e01217ac28eba702f36696dbeeef9c88a217335d0426e0d9723e14e2d2485c66c05f
|
7
|
+
data.tar.gz: d6fd640212d1a9e5a7825f3e00947dbd21e67909dd07e894e8eec38565c4bb6db9b17c52bdf62c07689eb2af521cb0d10e58accb1b967b2e1e8ae2d6487f096e
|
@@ -6,9 +6,10 @@ module Fluent
|
|
6
6
|
config_param :port, :integer, :default => nil
|
7
7
|
config_param :use_tag_as_key, :bool, :default => false
|
8
8
|
config_param :flat_tags, :bool, :default => false
|
9
|
-
config_param :flat_tag, :bool, :default => false #
|
9
|
+
config_param :flat_tag, :bool, :default => false # obsolete
|
10
10
|
config_param :metric_type, :string, :default => nil
|
11
11
|
config_param :value_key, :string, :default => nil
|
12
|
+
config_param :sample_rate, :float, :default => nil
|
12
13
|
|
13
14
|
unless method_defined?(:log)
|
14
15
|
define_method(:log) { $log }
|
@@ -52,17 +53,20 @@ module Fluent
|
|
52
53
|
value = record.delete(@value_key || 'value')
|
53
54
|
|
54
55
|
options = {}
|
56
|
+
title = record.delete('title')
|
57
|
+
text = record.delete('text')
|
58
|
+
type = @metric_type || record.delete('type')
|
59
|
+
sample_rate = @sample_rate || record.delete('sample_rate')
|
60
|
+
|
61
|
+
if sample_rate
|
62
|
+
options[:sample_rate] = sample_rate
|
63
|
+
end
|
55
64
|
|
56
65
|
tags = if @flat_tags || @flat_tag
|
57
66
|
record
|
58
67
|
else
|
59
68
|
record['tags']
|
60
69
|
end
|
61
|
-
|
62
|
-
title = record.delete('title')
|
63
|
-
text = record.delete('text')
|
64
|
-
type = @metric_type || record.delete('type')
|
65
|
-
|
66
70
|
if tags
|
67
71
|
options[:tags] = tags.map do |k, v|
|
68
72
|
"#{k}:#{v}"
|
@@ -117,6 +117,30 @@ use_tag_as_key true
|
|
117
117
|
])
|
118
118
|
end
|
119
119
|
|
120
|
+
def test_sample_rate_config
|
121
|
+
d = create_driver(<<-EOC)
|
122
|
+
#{default_config}
|
123
|
+
sample_rate .5
|
124
|
+
EOC
|
125
|
+
|
126
|
+
d.emit({'type' => 'increment'}, Time.now.to_i)
|
127
|
+
d.run
|
128
|
+
|
129
|
+
assert_equal(d.instance.statsd.messages, [
|
130
|
+
[:increment, 'dogstatsd.tag', {sample_rate: 0.5}],
|
131
|
+
])
|
132
|
+
end
|
133
|
+
|
134
|
+
def test_sample_rate
|
135
|
+
d = create_driver
|
136
|
+
d.emit({'type' => 'increment', 'sample_rate' => 0.5}, Time.now.to_i)
|
137
|
+
d.run
|
138
|
+
|
139
|
+
assert_equal(d.instance.statsd.messages, [
|
140
|
+
[:increment, 'dogstatsd.tag', {sample_rate: 0.5}],
|
141
|
+
])
|
142
|
+
end
|
143
|
+
|
120
144
|
private
|
121
145
|
def default_config
|
122
146
|
<<-EOC
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fluent-plugin-dogstatsd
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryota Arai
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-11-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: fluentd
|