fluent-plugin-dd 0.1.3 → 0.1.4
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 +13 -5
- data/README.md +1 -0
- data/fluent-plugin-dd.gemspec +1 -1
- data/lib/fluent/plugin/out_dd.rb +28 -0
- data/spec/out_dd_spec.rb +14 -0
- data/spec/spec_helper.rb +4 -10
- metadata +13 -14
checksums.yaml
CHANGED
@@ -1,7 +1,15 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
ODQ1NTNjMTEyZjZhOTAyNTAzOGFlN2VlMDQ2MGFjMzYxZmM4ZmI5ZQ==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
OWQxOTE3ZmQzM2Y2NmZkODZhYjlhNjkxMDhkNWJiN2ZjYTYxYTI2Nw==
|
5
7
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
YTIyMmE0YmMwNWU4NDNlZGM0YTRlNjM1NWY4OGQ5YzZlMGI5MGExNjRjODdj
|
10
|
+
M2Q2OWFmMGYwMGJhNjAxZTBlMDg2NzkwZmNiOTBjMzc1NWVmNTgyOWYyMThl
|
11
|
+
YWQ2YjA1ODUwNDYxZDdlYTMyMWY0Y2I3ZTczYTljNDE1MDM2NDY=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
ZmEzNjMwMTQ5NDFkODI3ZTM5ODgyMzNmZjI1M2Y5YTc2NTJkYmIwN2JlM2Ix
|
14
|
+
M2I3NGU3ZGFiZWJlNmE2YjRhZDY0Y2Y2MjM0ZTA0NTgzNmEyYzc5YjY3ZjM0
|
15
|
+
NzU5YzdkYTYwNDdkZGVmZWE3MGEwZTU0MjVjMzJlNjg5NTJlOGU=
|
data/README.md
CHANGED
data/fluent-plugin-dd.gemspec
CHANGED
data/lib/fluent/plugin/out_dd.rb
CHANGED
@@ -8,19 +8,37 @@ class Fluent::DdOutput < Fluent::BufferedOutput
|
|
8
8
|
config_param :dd_api_key, :string
|
9
9
|
config_param :host, :string, :default => nil
|
10
10
|
config_param :use_fluentd_tag_for_datadog_tag, :bool, :default => false
|
11
|
+
config_param :emit_in_background, :bool, :default => false
|
11
12
|
|
12
13
|
def initialize
|
13
14
|
super
|
14
15
|
require 'dogapi'
|
15
16
|
require 'socket'
|
17
|
+
require 'thread'
|
16
18
|
end
|
17
19
|
|
18
20
|
def start
|
19
21
|
super
|
22
|
+
|
23
|
+
if @emit_in_background
|
24
|
+
@queue = Queue.new
|
25
|
+
|
26
|
+
@thread = Thread.start do
|
27
|
+
while(chunk = @queue.pop)
|
28
|
+
emit_points(chunk)
|
29
|
+
Thread.pass
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
20
33
|
end
|
21
34
|
|
22
35
|
def shutdown
|
23
36
|
super
|
37
|
+
|
38
|
+
if @emit_in_background
|
39
|
+
@queue.push(false)
|
40
|
+
@thread.join
|
41
|
+
end
|
24
42
|
end
|
25
43
|
|
26
44
|
def configure(conf)
|
@@ -43,6 +61,16 @@ class Fluent::DdOutput < Fluent::BufferedOutput
|
|
43
61
|
end
|
44
62
|
|
45
63
|
def write(chunk)
|
64
|
+
if @emit_in_background
|
65
|
+
@queue.push(chunk)
|
66
|
+
else
|
67
|
+
emit_points(chunk)
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
private
|
72
|
+
|
73
|
+
def emit_points(chunk)
|
46
74
|
enum = chunk.to_enum(:msgpack_each)
|
47
75
|
|
48
76
|
enum.select {|tag, time, record|
|
data/spec/out_dd_spec.rb
CHANGED
@@ -22,6 +22,20 @@ describe Fluent::DdOutput do
|
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
25
|
+
it 'should be called emit_points in the background' do
|
26
|
+
run_driver(:emit_in_background => true) do |d, dog|
|
27
|
+
dog.should_receive(:emit_points).with(
|
28
|
+
"some.metric.name",
|
29
|
+
[[Time.parse("2014-02-08 04:14:15 UTC"), 50.0],
|
30
|
+
[Time.parse("2014-02-08 04:14:15 UTC"), 100.0]],
|
31
|
+
{}
|
32
|
+
)
|
33
|
+
|
34
|
+
d.emit({"metric" => "some.metric.name", "value" => 50.0}, time)
|
35
|
+
d.emit({"metric" => "some.metric.name", "value" => 100.0}, time)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
25
39
|
it 'should be called emit_points with tag' do
|
26
40
|
run_driver(:use_fluentd_tag_for_datadog_tag => true) do |d, dog|
|
27
41
|
dog.should_receive(:emit_points).with(
|
data/spec/spec_helper.rb
CHANGED
@@ -15,17 +15,11 @@ end
|
|
15
15
|
def run_driver(options = {})
|
16
16
|
options = options.dup
|
17
17
|
|
18
|
-
dd_api_key = options
|
19
|
-
host = options
|
18
|
+
dd_api_key = options.delete(:dd_api_key) || 'test_dd_api_key'
|
19
|
+
host = options.delete(:host) || 'test_host'
|
20
20
|
|
21
|
-
|
22
|
-
|
23
|
-
]
|
24
|
-
|
25
|
-
additional_options = option_keys.map {|key|
|
26
|
-
if options[key]
|
27
|
-
"#{key} #{options[key]}"
|
28
|
-
end
|
21
|
+
additional_options = options.map {|key, value|
|
22
|
+
"#{key} #{value}"
|
29
23
|
}.join("\n")
|
30
24
|
|
31
25
|
fluentd_conf = <<-EOS
|
metadata
CHANGED
@@ -1,41 +1,41 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fluent-plugin-dd
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Genki Sugawara
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-02-
|
11
|
+
date: 2014-02-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: fluentd
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - '>='
|
17
|
+
- - ! '>='
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - '>='
|
24
|
+
- - ! '>='
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: dogapi
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - '>='
|
31
|
+
- - ! '>='
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '0'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - '>='
|
38
|
+
- - ! '>='
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
@@ -56,28 +56,28 @@ dependencies:
|
|
56
56
|
name: rake
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - '>='
|
59
|
+
- - ! '>='
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '0'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- - '>='
|
66
|
+
- - ! '>='
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: rspec
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- - '>='
|
73
|
+
- - ! '>='
|
74
74
|
- !ruby/object:Gem::Version
|
75
75
|
version: 2.11.0
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- - '>='
|
80
|
+
- - ! '>='
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: 2.11.0
|
83
83
|
description: Output plugin for Datadog
|
@@ -107,21 +107,20 @@ require_paths:
|
|
107
107
|
- lib
|
108
108
|
required_ruby_version: !ruby/object:Gem::Requirement
|
109
109
|
requirements:
|
110
|
-
- - '>='
|
110
|
+
- - ! '>='
|
111
111
|
- !ruby/object:Gem::Version
|
112
112
|
version: '0'
|
113
113
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
114
114
|
requirements:
|
115
|
-
- - '>='
|
115
|
+
- - ! '>='
|
116
116
|
- !ruby/object:Gem::Version
|
117
117
|
version: '0'
|
118
118
|
requirements: []
|
119
119
|
rubyforge_project:
|
120
|
-
rubygems_version: 2.
|
120
|
+
rubygems_version: 2.1.11
|
121
121
|
signing_key:
|
122
122
|
specification_version: 4
|
123
123
|
summary: Output plugin for Datadog
|
124
124
|
test_files:
|
125
125
|
- spec/out_dd_spec.rb
|
126
126
|
- spec/spec_helper.rb
|
127
|
-
has_rdoc:
|