adp-fluent-plugin-graphite 0.0.18 → 0.0.19
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/adp-fluent-plugin-graphite.gemspec +1 -1
- data/lib/fluent/plugin/out_graphite.rb +18 -8
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4ec7994190ada35fdac587e172689dbf5dbac317a81908e9c887ef5b9bcff086
|
4
|
+
data.tar.gz: a7d66b34f986653f8746d27bb6f5831f53ff9c3e4c486a4d55af041421b14b7b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 510c48db7df2865b141198ad3f0eb0f14a4a9994e197673b55659558a1b10442cc1d70e159d8a2a49b3ae878c2d6081f99f82182ebca51cea0418bb2c6b988fc
|
7
|
+
data.tar.gz: 0b6b35d3afba2374aa90e204c88cbb2ec850ad3d90169030d48464e7a19f9eece20a678df9ad1a9c1de4107aeba81f0bd1869228a56d840752c1ef4960b9e000
|
@@ -8,8 +8,8 @@ module Fluent::Plugin
|
|
8
8
|
config_param :port, :integer, default: 2003
|
9
9
|
config_param :prefix, :string, default: 'adp-fluentd-agent'
|
10
10
|
config_param :monitoring_key, :string
|
11
|
-
config_param :name_key_pattern, :string, default: nil
|
12
11
|
config_param :max_retries, :integer, default: 3
|
12
|
+
config_param :log_level, :string, default: 'info'
|
13
13
|
|
14
14
|
def initialize
|
15
15
|
super
|
@@ -24,15 +24,11 @@ module Fluent::Plugin
|
|
24
24
|
|
25
25
|
def configure(conf)
|
26
26
|
super
|
27
|
-
if @name_keys
|
28
|
-
@name_keys = @name_keys.split(',')
|
29
|
-
end
|
30
27
|
end
|
31
28
|
|
32
29
|
def process(tag, es)
|
33
30
|
es.each do |time, record|
|
34
31
|
emit_tag = tag.dup
|
35
|
-
log.info("Emit graphite plugin: #{record}")
|
36
32
|
metrics = format_metrics(emit_tag, record)
|
37
33
|
|
38
34
|
# implemented to immediate call post method in this loop, because graphite-api.gem has the buffers.
|
@@ -51,7 +47,6 @@ module Fluent::Plugin
|
|
51
47
|
def post(metric, time)
|
52
48
|
trial ||= 1
|
53
49
|
@client.metrics(metric, time)
|
54
|
-
log.warn("Sending metrics: #{metric}")
|
55
50
|
rescue Errno::ETIMEDOUT
|
56
51
|
# after long periods with nothing emitted, the connection will be closed and result in timeout
|
57
52
|
if trial <= @max_retries
|
@@ -70,6 +65,21 @@ module Fluent::Plugin
|
|
70
65
|
log.error "out_graphite: ERROR: #{e}"
|
71
66
|
end
|
72
67
|
|
68
|
+
def init_logger
|
69
|
+
if @log_level == 'debug'
|
70
|
+
GraphiteAPI::Logger.init level: :debug
|
71
|
+
end
|
72
|
+
if @log_level == 'warn'
|
73
|
+
GraphiteAPI::Logger.init level: :warn
|
74
|
+
end
|
75
|
+
if @log_level == 'info'
|
76
|
+
GraphiteAPI::Logger.init level: :info
|
77
|
+
end
|
78
|
+
if @log_level == 'error'
|
79
|
+
GraphiteAPI::Logger.init level: :error
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
73
83
|
def connect_client!
|
74
84
|
options = {
|
75
85
|
# Required: valid URI {udp,tcp}://host:port/?timeout=seconds
|
@@ -85,8 +95,8 @@ module Fluent::Plugin
|
|
85
95
|
cache: 4 * 60 * 60,
|
86
96
|
}
|
87
97
|
@client = GraphiteAPI.new options
|
88
|
-
|
89
|
-
log.info("
|
98
|
+
init_logger
|
99
|
+
log.info("Starting graphite client")
|
90
100
|
end
|
91
101
|
end
|
92
102
|
end
|