fluent-plugin-dogstatsd-soluto 0.0.1
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 +7 -0
- data/.github/workflows/gempush.yml +29 -0
- data/.github/workflows/run_tests.yml +20 -0
- data/.gitignore +22 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +23 -0
- data/README.md +108 -0
- data/Rakefile +9 -0
- data/fluent-plugin-dogstatsd.gemspec +26 -0
- data/lib/fluent/plugin/dogstatsd.rb +9 -0
- data/lib/fluent/plugin/dogstatsd/version.rb +7 -0
- data/lib/fluent/plugin/out_dogstatsd.rb +108 -0
- data/test/plugin/test_out_dogstatsd.rb +171 -0
- data/test/test_helper.rb +3 -0
- metadata +134 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 7a6dabb02edcae148aa3b5b082258f23e257ecb19c186e6bef72ae8d0c72f741
|
4
|
+
data.tar.gz: '071587cee1ded3bd7b4978052d02aacdcf3692a59044dd4b7efc0194115c157a'
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 5156da0001e52c95a19906ec2ae67043ae96872f45d92b5f585f604da0ef81ae6822a390996e75b28cc4e94f3a84956778693e78c95b89f3a968e33d2b8f7343
|
7
|
+
data.tar.gz: 3b9449c91f445f2068ac6a08d6786f89be3b223d9740ca8f6c62c8c16af2318ffdc290260200f195010d07fda73a2a59c69f5254d03377897f63d4426a5e794f
|
@@ -0,0 +1,29 @@
|
|
1
|
+
name: Ruby Gem
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
branches:
|
6
|
+
- master
|
7
|
+
|
8
|
+
jobs:
|
9
|
+
build:
|
10
|
+
name: Build + Publish
|
11
|
+
runs-on: ubuntu-latest
|
12
|
+
|
13
|
+
steps:
|
14
|
+
- uses: actions/checkout@v2
|
15
|
+
- name: Set up Ruby 2.6
|
16
|
+
uses: actions/setup-ruby@v1
|
17
|
+
with:
|
18
|
+
version: 2.6.x
|
19
|
+
|
20
|
+
- name: Publish to RubyGems
|
21
|
+
run: |
|
22
|
+
mkdir -p $HOME/.gem
|
23
|
+
touch $HOME/.gem/credentials
|
24
|
+
chmod 0600 $HOME/.gem/credentials
|
25
|
+
printf -- "---\n:rubygems_api_key: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
|
26
|
+
gem build *.gemspec
|
27
|
+
gem push *.gem
|
28
|
+
env:
|
29
|
+
GEM_HOST_API_KEY: ${{secrets.RUBYGEMS_AUTH_TOKEN}}
|
@@ -0,0 +1,20 @@
|
|
1
|
+
name: Ruby
|
2
|
+
|
3
|
+
on: [pull_request]
|
4
|
+
|
5
|
+
jobs:
|
6
|
+
test:
|
7
|
+
|
8
|
+
runs-on: ubuntu-latest
|
9
|
+
|
10
|
+
steps:
|
11
|
+
- uses: actions/checkout@v2
|
12
|
+
- name: Set up Ruby 2.6
|
13
|
+
uses: actions/setup-ruby@v1
|
14
|
+
with:
|
15
|
+
ruby-version: 2.6.x
|
16
|
+
- name: Build and test with Rake
|
17
|
+
run: |
|
18
|
+
gem install bundler -v 2.0.2
|
19
|
+
bundle install --jobs 4 --retry 3
|
20
|
+
bundle exec rake test
|
data/.gitignore
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
*.gem
|
2
|
+
*.rbc
|
3
|
+
.bundle
|
4
|
+
.config
|
5
|
+
.yardoc
|
6
|
+
Gemfile.lock
|
7
|
+
InstalledFiles
|
8
|
+
_yardoc
|
9
|
+
coverage
|
10
|
+
doc/
|
11
|
+
lib/bundler/man
|
12
|
+
pkg
|
13
|
+
rdoc
|
14
|
+
spec/reports
|
15
|
+
test/tmp
|
16
|
+
test/version_tmp
|
17
|
+
tmp
|
18
|
+
*.bundle
|
19
|
+
*.so
|
20
|
+
*.o
|
21
|
+
*.a
|
22
|
+
mkmf.log
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
Portions Copyright (c) 2020 Soluto
|
2
|
+
Portions Copyright (c) 2014 Ryota Arai
|
3
|
+
|
4
|
+
MIT License
|
5
|
+
|
6
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
7
|
+
a copy of this software and associated documentation files (the
|
8
|
+
"Software"), to deal in the Software without restriction, including
|
9
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
10
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
11
|
+
permit persons to whom the Software is furnished to do so, subject to
|
12
|
+
the following conditions:
|
13
|
+
|
14
|
+
The above copyright notice and this permission notice shall be
|
15
|
+
included in all copies or substantial portions of the Software.
|
16
|
+
|
17
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
18
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
19
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
20
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
21
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
22
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
23
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,108 @@
|
|
1
|
+
# fluent-plugin-dogstatsd
|
2
|
+
|
3
|
+
Fluend plugin for Dogstatsd, that is statsd server for Datadog.
|
4
|
+
This plugin was forked to use dogstatsd-ruby package version 4, which provide better performance (DNS Caching included).
|
5
|
+
|
6
|
+
## Installation
|
7
|
+
|
8
|
+
$ gem install fluent-plugin-dogstatsd
|
9
|
+
|
10
|
+
## Usage
|
11
|
+
|
12
|
+
```
|
13
|
+
$ echo '{"type": "increment", "key": "apache.requests", "tags": {"url": "/"}}' | fluent-cat dogstatsd.hello
|
14
|
+
$ echo '{"type": "histogram", "key": "apache.response_time", "value": 10.5, "tags": {"url": "/hello"}}' | fluent-cat dogstatsd.hello
|
15
|
+
$ echo '{"type": "event", "title": "Deploy", "text": "New revision"}' | fluent-cat dogstatsd.hello
|
16
|
+
```
|
17
|
+
|
18
|
+
Supported types are `increment`, `decrement`, `count`, `gauge`, `histogram`, `timing`, `set` and `event`.
|
19
|
+
|
20
|
+
## Configuration
|
21
|
+
|
22
|
+
```
|
23
|
+
<match dogstatsd.*>
|
24
|
+
type dogstatsd
|
25
|
+
|
26
|
+
# Dogstatsd host
|
27
|
+
host localhost
|
28
|
+
|
29
|
+
# Dogstatsd port
|
30
|
+
port 8125
|
31
|
+
|
32
|
+
# Use tag of fluentd record as key sent to Dogstatsd
|
33
|
+
use_tag_as_key false
|
34
|
+
|
35
|
+
# (Treat fields in a record as tags)
|
36
|
+
# flat_tags true
|
37
|
+
|
38
|
+
# (Metric type in Datadog.)
|
39
|
+
# metric_type increment
|
40
|
+
|
41
|
+
# Default: "value"
|
42
|
+
# value_key Value
|
43
|
+
</match>
|
44
|
+
```
|
45
|
+
|
46
|
+
## Example
|
47
|
+
|
48
|
+
### Count log lines
|
49
|
+
|
50
|
+
```apache
|
51
|
+
<source>
|
52
|
+
type tail
|
53
|
+
path /tmp/sample.log
|
54
|
+
tag datadog.increment.sample
|
55
|
+
format ...
|
56
|
+
</source>
|
57
|
+
|
58
|
+
<match datadog.increment.*>
|
59
|
+
type dogstatsd
|
60
|
+
metric_type increment
|
61
|
+
flat_tags true
|
62
|
+
use_tag_as_key true
|
63
|
+
</match>
|
64
|
+
```
|
65
|
+
|
66
|
+
### Histogram
|
67
|
+
|
68
|
+
```apache
|
69
|
+
<source>
|
70
|
+
type tail
|
71
|
+
path /tmp/sample.log
|
72
|
+
tag datadog.histogram.sample
|
73
|
+
format /^(?<value>[^ ]*) (?<host>[^ ]*)$/
|
74
|
+
</source>
|
75
|
+
|
76
|
+
<match datadog.histogram.*>
|
77
|
+
type dogstatsd
|
78
|
+
metric_type histogram
|
79
|
+
flat_tags true
|
80
|
+
use_tag_as_key true
|
81
|
+
</match>
|
82
|
+
```
|
83
|
+
|
84
|
+
### MySQL threads
|
85
|
+
|
86
|
+
```apache
|
87
|
+
<source>
|
88
|
+
type mysql_query
|
89
|
+
tag datadog.histogram.mysql_threads
|
90
|
+
query SHOW VARIABLES LIKE 'Thread_%'
|
91
|
+
</source>
|
92
|
+
|
93
|
+
<match datadog.histogram.mysql_threads>
|
94
|
+
type dogstatsd
|
95
|
+
metric_type histogram
|
96
|
+
value_key Value
|
97
|
+
flat_tags true
|
98
|
+
use_tag_as_key true
|
99
|
+
</match>
|
100
|
+
```
|
101
|
+
|
102
|
+
## Contributing
|
103
|
+
|
104
|
+
1. Fork it ( https://github.com/soluto/fluent-plugin-dogstatsd/fork )
|
105
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
106
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
107
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
108
|
+
5. Create a new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'fluent/plugin/dogstatsd/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "fluent-plugin-dogstatsd-soluto"
|
8
|
+
spec.version = Fluent::Plugin::Dogstatsd::VERSION
|
9
|
+
spec.authors = ["Shai Katz"]
|
10
|
+
spec.email = ["shai@soluto.com"]
|
11
|
+
spec.summary = %q{Fluent plugin for Dogstatsd, that is statsd server for Datadog.}
|
12
|
+
spec.homepage = "https://github.com/soluto/fluent-plugin-dogstatsd"
|
13
|
+
spec.license = "MIT"
|
14
|
+
|
15
|
+
spec.files = `git ls-files -z`.split("\x0")
|
16
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
17
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
18
|
+
spec.require_paths = ["lib"]
|
19
|
+
|
20
|
+
spec.add_dependency "fluentd", [">= 0.14.10", "< 2"]
|
21
|
+
spec.add_dependency "dogstatsd-ruby", "~> 4.7.0"
|
22
|
+
|
23
|
+
spec.add_development_dependency "bundler", "~> 2.0.2"
|
24
|
+
spec.add_development_dependency "rake"
|
25
|
+
spec.add_development_dependency "test-unit"
|
26
|
+
end
|
@@ -0,0 +1,108 @@
|
|
1
|
+
module Fluent
|
2
|
+
class DogstatsdOutput < BufferedOutput
|
3
|
+
Plugin.register_output('dogstatsd', self)
|
4
|
+
|
5
|
+
config_param :host, :string, :default => nil
|
6
|
+
config_param :port, :integer, :default => nil
|
7
|
+
config_param :use_tag_as_key, :bool, :default => false
|
8
|
+
config_param :use_tag_as_key_if_missing, :bool, :default => false
|
9
|
+
config_param :flat_tags, :bool, :default => false
|
10
|
+
config_param :flat_tag, :bool, :default => false # obsolete
|
11
|
+
config_param :metric_type, :string, :default => nil
|
12
|
+
config_param :value_key, :string, :default => nil
|
13
|
+
config_param :sample_rate, :float, :default => nil
|
14
|
+
|
15
|
+
unless method_defined?(:log)
|
16
|
+
define_method(:log) { $log }
|
17
|
+
end
|
18
|
+
|
19
|
+
attr_accessor :statsd
|
20
|
+
|
21
|
+
def initialize
|
22
|
+
super
|
23
|
+
|
24
|
+
require 'datadog/statsd' # dogstatsd-ruby
|
25
|
+
end
|
26
|
+
|
27
|
+
def start
|
28
|
+
super
|
29
|
+
|
30
|
+
host = @host || '127.0.0.1'
|
31
|
+
port = @port || 8125
|
32
|
+
|
33
|
+
@statsd ||= Datadog::Statsd.new(host, port)
|
34
|
+
end
|
35
|
+
|
36
|
+
def format(tag, time, record)
|
37
|
+
[tag, time, record].to_msgpack
|
38
|
+
end
|
39
|
+
|
40
|
+
def write(chunk)
|
41
|
+
@statsd.batch do |s|
|
42
|
+
chunk.msgpack_each do |tag, time, record|
|
43
|
+
key = if @use_tag_as_key
|
44
|
+
tag
|
45
|
+
else
|
46
|
+
record.delete('key')
|
47
|
+
end
|
48
|
+
|
49
|
+
if !key && @use_tag_as_key_if_missing
|
50
|
+
key = tag
|
51
|
+
end
|
52
|
+
|
53
|
+
unless key
|
54
|
+
log.warn "'key' is not specified. skip this record:", tag: tag
|
55
|
+
next
|
56
|
+
end
|
57
|
+
|
58
|
+
value = record.delete(@value_key || 'value')
|
59
|
+
|
60
|
+
options = {}
|
61
|
+
title = record.delete('title')
|
62
|
+
text = record.delete('text')
|
63
|
+
type = @metric_type || record.delete('type')
|
64
|
+
sample_rate = @sample_rate || record.delete('sample_rate')
|
65
|
+
|
66
|
+
if sample_rate
|
67
|
+
options[:sample_rate] = sample_rate
|
68
|
+
end
|
69
|
+
|
70
|
+
tags = if @flat_tags || @flat_tag
|
71
|
+
record
|
72
|
+
else
|
73
|
+
record['tags']
|
74
|
+
end
|
75
|
+
if tags
|
76
|
+
options[:tags] = tags.map do |k, v|
|
77
|
+
"#{k}:#{v}"
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
case type
|
82
|
+
when 'increment'
|
83
|
+
s.increment(key, options)
|
84
|
+
when 'decrement'
|
85
|
+
s.decrement(key, options)
|
86
|
+
when 'count'
|
87
|
+
s.count(key, value, options)
|
88
|
+
when 'gauge'
|
89
|
+
s.gauge(key, value, options)
|
90
|
+
when 'histogram'
|
91
|
+
s.histogram(key, value, options)
|
92
|
+
when 'timing'
|
93
|
+
s.timing(key, value, options)
|
94
|
+
when 'set'
|
95
|
+
s.set(key, value, options)
|
96
|
+
when 'event'
|
97
|
+
options[:alert_type] = record['alert_type']
|
98
|
+
s.event(title, text, options)
|
99
|
+
when nil
|
100
|
+
log.warn "type is not provided (You can provide type via `metric_type` in config or `type` field in a record."
|
101
|
+
else
|
102
|
+
log.warn "Type '#{type}' is unknown."
|
103
|
+
end
|
104
|
+
end
|
105
|
+
end
|
106
|
+
end
|
107
|
+
end
|
108
|
+
end
|
@@ -0,0 +1,171 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class DummyStatsd
|
4
|
+
attr_reader :messages
|
5
|
+
|
6
|
+
def initialize
|
7
|
+
@messages = []
|
8
|
+
end
|
9
|
+
|
10
|
+
def batch
|
11
|
+
yield(self)
|
12
|
+
end
|
13
|
+
|
14
|
+
%i!increment decrement count gauge histogram timing set event!.each do |name|
|
15
|
+
define_method(name) do |*args|
|
16
|
+
@messages << [name, args].flatten
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
class DogstatsdOutputTest < Test::Unit::TestCase
|
22
|
+
def setup
|
23
|
+
Fluent::Test.setup
|
24
|
+
require 'fluent/plugin/out_dogstatsd'
|
25
|
+
end
|
26
|
+
|
27
|
+
def teardown
|
28
|
+
end
|
29
|
+
|
30
|
+
def test_configure
|
31
|
+
d = create_driver(<<-EOC)
|
32
|
+
type dogstatsd
|
33
|
+
host HOST
|
34
|
+
port 12345
|
35
|
+
EOC
|
36
|
+
|
37
|
+
assert_equal('HOST', d.instance.host)
|
38
|
+
assert_equal(12345, d.instance.port)
|
39
|
+
end
|
40
|
+
|
41
|
+
def test_write
|
42
|
+
d = create_driver
|
43
|
+
|
44
|
+
d.emit({'type' => 'increment', 'key' => 'hello.world1'}, Time.now.to_i)
|
45
|
+
d.emit({'type' => 'increment', 'key' => 'hello.world2'}, Time.now.to_i)
|
46
|
+
d.emit({'type' => 'decrement', 'key' => 'hello.world'}, Time.now.to_i)
|
47
|
+
d.emit({'type' => 'count', 'value' => 10, 'key' => 'hello.world'}, Time.now.to_i)
|
48
|
+
d.emit({'type' => 'gauge', 'value' => 10, 'key' => 'hello.world'}, Time.now.to_i)
|
49
|
+
d.emit({'type' => 'histogram', 'value' => 10, 'key' => 'hello.world'}, Time.now.to_i)
|
50
|
+
d.emit({'type' => 'timing', 'value' => 10, 'key' => 'hello.world'}, Time.now.to_i)
|
51
|
+
d.emit({'type' => 'set', 'value' => 10, 'key' => 'hello.world'}, Time.now.to_i)
|
52
|
+
d.emit({'type' => 'event', 'title' => 'Deploy', 'text' => 'Revision', 'alert_type' => 'test', 'key' => 'hello.world'}, Time.now.to_i)
|
53
|
+
d.run
|
54
|
+
|
55
|
+
assert_equal([
|
56
|
+
[:increment, 'hello.world1', {}],
|
57
|
+
[:increment, 'hello.world2', {}],
|
58
|
+
[:decrement, 'hello.world', {}],
|
59
|
+
[:count, 'hello.world', 10, {}],
|
60
|
+
[:gauge, 'hello.world', 10, {}],
|
61
|
+
[:histogram, 'hello.world', 10, {}],
|
62
|
+
[:timing, 'hello.world', 10, {}],
|
63
|
+
[:set, 'hello.world', 10, {}],
|
64
|
+
[:event, 'Deploy', 'Revision', {:'alert_type' => 'test'}],
|
65
|
+
], d.instance.statsd.messages)
|
66
|
+
end
|
67
|
+
|
68
|
+
def test_flat_tag
|
69
|
+
d = create_driver(<<-EOC)
|
70
|
+
#{default_config}
|
71
|
+
flat_tag true
|
72
|
+
EOC
|
73
|
+
|
74
|
+
d.emit({'type' => 'increment', 'key' => 'hello.world', 'tagKey' => 'tagValue'}, Time.now.to_i)
|
75
|
+
d.run
|
76
|
+
|
77
|
+
assert_equal([
|
78
|
+
[:increment, 'hello.world', {tags: ["tagKey:tagValue"]}],
|
79
|
+
], d.instance.statsd.messages,)
|
80
|
+
end
|
81
|
+
|
82
|
+
def test_metric_type
|
83
|
+
d = create_driver(<<-EOC)
|
84
|
+
#{default_config}
|
85
|
+
metric_type decrement
|
86
|
+
EOC
|
87
|
+
|
88
|
+
d.emit({'key' => 'hello.world', 'tags' => {'tagKey' => 'tagValue'}}, Time.now.to_i)
|
89
|
+
d.run
|
90
|
+
|
91
|
+
assert_equal([
|
92
|
+
[:decrement, 'hello.world', {tags: ["tagKey:tagValue"]}],
|
93
|
+
], d.instance.statsd.messages)
|
94
|
+
end
|
95
|
+
|
96
|
+
def test_use_tag_as_key
|
97
|
+
d = create_driver(<<-EOC)
|
98
|
+
#{default_config}
|
99
|
+
use_tag_as_key true
|
100
|
+
EOC
|
101
|
+
|
102
|
+
d.emit({'type' => 'increment'}, Time.now.to_i)
|
103
|
+
d.run
|
104
|
+
|
105
|
+
assert_equal([
|
106
|
+
[:increment, 'dogstatsd.tag', {}],
|
107
|
+
], d.instance.statsd.messages, )
|
108
|
+
end
|
109
|
+
|
110
|
+
def test_use_tag_as_key_fallback
|
111
|
+
d = create_driver(<<-EOC)
|
112
|
+
#{default_config}
|
113
|
+
use_tag_as_key_if_missing true
|
114
|
+
EOC
|
115
|
+
|
116
|
+
d.emit({'type' => 'increment'}, Time.now.to_i)
|
117
|
+
d.run
|
118
|
+
|
119
|
+
assert_equal([
|
120
|
+
[:increment, 'dogstatsd.tag', {}],
|
121
|
+
], d.instance.statsd.messages, )
|
122
|
+
end
|
123
|
+
|
124
|
+
def test_tags
|
125
|
+
d = create_driver
|
126
|
+
d.emit({'type' => 'increment', 'key' => 'hello.world', 'tags' => {'key' => 'value'}}, Time.now.to_i)
|
127
|
+
d.run
|
128
|
+
|
129
|
+
assert_equal([
|
130
|
+
[:increment, 'hello.world', {tags: ["key:value"]}],
|
131
|
+
], d.instance.statsd.messages)
|
132
|
+
end
|
133
|
+
|
134
|
+
def test_sample_rate_config
|
135
|
+
d = create_driver(<<-EOC)
|
136
|
+
#{default_config}
|
137
|
+
sample_rate .5
|
138
|
+
EOC
|
139
|
+
|
140
|
+
d.emit({'type' => 'increment', 'key' => 'tag'}, Time.now.to_i)
|
141
|
+
d.run
|
142
|
+
|
143
|
+
assert_equal([
|
144
|
+
[:increment, 'tag', {sample_rate: 0.5}],
|
145
|
+
], d.instance.statsd.messages)
|
146
|
+
end
|
147
|
+
|
148
|
+
def test_sample_rate
|
149
|
+
d = create_driver
|
150
|
+
d.emit({'type' => 'increment', 'sample_rate' => 0.5, 'key' => 'tag'}, Time.now.to_i)
|
151
|
+
d.run
|
152
|
+
|
153
|
+
assert_equal([
|
154
|
+
[:increment, 'tag', {sample_rate: 0.5}],
|
155
|
+
], d.instance.statsd.messages)
|
156
|
+
end
|
157
|
+
|
158
|
+
private
|
159
|
+
def default_config
|
160
|
+
<<-EOC
|
161
|
+
type dogstatsd
|
162
|
+
EOC
|
163
|
+
end
|
164
|
+
|
165
|
+
def create_driver(conf = default_config)
|
166
|
+
Fluent::Test::BufferedOutputTestDriver.new(Fluent::DogstatsdOutput, 'dogstatsd.tag').configure(conf).tap do |d|
|
167
|
+
d.instance.statsd = DummyStatsd.new
|
168
|
+
end
|
169
|
+
end
|
170
|
+
end
|
171
|
+
|
data/test/test_helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,134 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: fluent-plugin-dogstatsd-soluto
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Shai Katz
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2020-03-01 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: fluentd
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 0.14.10
|
20
|
+
- - "<"
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: '2'
|
23
|
+
type: :runtime
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
requirements:
|
27
|
+
- - ">="
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 0.14.10
|
30
|
+
- - "<"
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '2'
|
33
|
+
- !ruby/object:Gem::Dependency
|
34
|
+
name: dogstatsd-ruby
|
35
|
+
requirement: !ruby/object:Gem::Requirement
|
36
|
+
requirements:
|
37
|
+
- - "~>"
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: 4.7.0
|
40
|
+
type: :runtime
|
41
|
+
prerelease: false
|
42
|
+
version_requirements: !ruby/object:Gem::Requirement
|
43
|
+
requirements:
|
44
|
+
- - "~>"
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: 4.7.0
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: bundler
|
49
|
+
requirement: !ruby/object:Gem::Requirement
|
50
|
+
requirements:
|
51
|
+
- - "~>"
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: 2.0.2
|
54
|
+
type: :development
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
requirements:
|
58
|
+
- - "~>"
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: 2.0.2
|
61
|
+
- !ruby/object:Gem::Dependency
|
62
|
+
name: rake
|
63
|
+
requirement: !ruby/object:Gem::Requirement
|
64
|
+
requirements:
|
65
|
+
- - ">="
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
version: '0'
|
68
|
+
type: :development
|
69
|
+
prerelease: false
|
70
|
+
version_requirements: !ruby/object:Gem::Requirement
|
71
|
+
requirements:
|
72
|
+
- - ">="
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
version: '0'
|
75
|
+
- !ruby/object:Gem::Dependency
|
76
|
+
name: test-unit
|
77
|
+
requirement: !ruby/object:Gem::Requirement
|
78
|
+
requirements:
|
79
|
+
- - ">="
|
80
|
+
- !ruby/object:Gem::Version
|
81
|
+
version: '0'
|
82
|
+
type: :development
|
83
|
+
prerelease: false
|
84
|
+
version_requirements: !ruby/object:Gem::Requirement
|
85
|
+
requirements:
|
86
|
+
- - ">="
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
version: '0'
|
89
|
+
description:
|
90
|
+
email:
|
91
|
+
- shai@soluto.com
|
92
|
+
executables: []
|
93
|
+
extensions: []
|
94
|
+
extra_rdoc_files: []
|
95
|
+
files:
|
96
|
+
- ".github/workflows/gempush.yml"
|
97
|
+
- ".github/workflows/run_tests.yml"
|
98
|
+
- ".gitignore"
|
99
|
+
- Gemfile
|
100
|
+
- LICENSE.txt
|
101
|
+
- README.md
|
102
|
+
- Rakefile
|
103
|
+
- fluent-plugin-dogstatsd.gemspec
|
104
|
+
- lib/fluent/plugin/dogstatsd.rb
|
105
|
+
- lib/fluent/plugin/dogstatsd/version.rb
|
106
|
+
- lib/fluent/plugin/out_dogstatsd.rb
|
107
|
+
- test/plugin/test_out_dogstatsd.rb
|
108
|
+
- test/test_helper.rb
|
109
|
+
homepage: https://github.com/soluto/fluent-plugin-dogstatsd
|
110
|
+
licenses:
|
111
|
+
- MIT
|
112
|
+
metadata: {}
|
113
|
+
post_install_message:
|
114
|
+
rdoc_options: []
|
115
|
+
require_paths:
|
116
|
+
- lib
|
117
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
118
|
+
requirements:
|
119
|
+
- - ">="
|
120
|
+
- !ruby/object:Gem::Version
|
121
|
+
version: '0'
|
122
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
123
|
+
requirements:
|
124
|
+
- - ">="
|
125
|
+
- !ruby/object:Gem::Version
|
126
|
+
version: '0'
|
127
|
+
requirements: []
|
128
|
+
rubygems_version: 3.0.3
|
129
|
+
signing_key:
|
130
|
+
specification_version: 4
|
131
|
+
summary: Fluent plugin for Dogstatsd, that is statsd server for Datadog.
|
132
|
+
test_files:
|
133
|
+
- test/plugin/test_out_dogstatsd.rb
|
134
|
+
- test/test_helper.rb
|