fluent-plugin-google-cloud 0.10.4 → 0.10.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +39 -37
- data/fluent-plugin-google-cloud.gemspec +3 -3
- data/lib/fluent/plugin/filter_analyze_config.rb +44 -12
- data/lib/fluent/plugin/monitoring.rb +42 -11
- data/lib/fluent/plugin/out_google_cloud.rb +6 -6
- data/test/plugin/asserts.rb +22 -12
- data/test/plugin/base_test.rb +148 -17
- data/test/plugin/test_filter_analyze_config.rb +43 -1
- data/test/plugin/test_out_google_cloud.rb +51 -75
- data/test/plugin/test_out_google_cloud_grpc.rb +58 -89
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cfb8318e26804ad6f09d4e16777e3bbef7448a671f6a81dc3c2c2e30fd5e8a92
|
4
|
+
data.tar.gz: 4410e23d39d9dacf8fad1b9053be2fc9da055c37e3be1fcd13916a04f0ae3758
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f28ea72b58f2ed3d8eedea65b002fad2dda4ffc8a62b4b0a5c5c26fd54e04a058d680ea9745199fa8dcfbae5b1b984400a3cae5e88332b563453eb0c6415967e
|
7
|
+
data.tar.gz: 2992d107c0617ba61f6637d6f0e57d997b6b19068d9c67bbd7794adef43489a8bf7dc133601ddfe59d1a150f47ce6b41388fb0decbded25a4d49b35dfabf2b00
|
data/Gemfile.lock
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
fluent-plugin-google-cloud (0.10.
|
4
|
+
fluent-plugin-google-cloud (0.10.9)
|
5
5
|
fluentd (= 1.11.2)
|
6
6
|
google-api-client (= 0.30.8)
|
7
7
|
google-cloud-logging (= 1.6.6)
|
8
|
-
google-protobuf (= 3.
|
9
|
-
googleapis-common-protos (= 1.3.
|
8
|
+
google-protobuf (= 3.15.8)
|
9
|
+
googleapis-common-protos (= 1.3.10)
|
10
10
|
googleauth (= 0.9.0)
|
11
11
|
grpc (= 1.31.1)
|
12
12
|
json (= 2.2.0)
|
@@ -18,20 +18,20 @@ GEM
|
|
18
18
|
specs:
|
19
19
|
addressable (2.7.0)
|
20
20
|
public_suffix (>= 2.0.2, < 5.0)
|
21
|
-
ast (2.4.
|
22
|
-
concurrent-ruby (1.1.
|
23
|
-
cool.io (1.7.
|
21
|
+
ast (2.4.2)
|
22
|
+
concurrent-ruby (1.1.8)
|
23
|
+
cool.io (1.7.1)
|
24
24
|
coveralls (0.8.23)
|
25
25
|
json (>= 1.8, < 3)
|
26
26
|
simplecov (~> 0.16.1)
|
27
27
|
term-ansicolor (~> 1.3)
|
28
28
|
thor (>= 0.19.4, < 2.0)
|
29
29
|
tins (~> 1.6)
|
30
|
-
crack (0.4.
|
30
|
+
crack (0.4.5)
|
31
|
+
rexml
|
31
32
|
declarative (0.0.20)
|
32
|
-
|
33
|
-
|
34
|
-
faraday (0.17.3)
|
33
|
+
docile (1.3.5)
|
34
|
+
faraday (0.17.4)
|
35
35
|
multipart-post (>= 1.2, < 3)
|
36
36
|
fluentd (1.11.2)
|
37
37
|
cool.io (>= 1.4.5, < 2.0.0)
|
@@ -57,12 +57,12 @@ GEM
|
|
57
57
|
representable (~> 3.0)
|
58
58
|
retriable (>= 2.0, < 4.0)
|
59
59
|
signet (~> 0.10)
|
60
|
-
google-cloud-core (1.
|
60
|
+
google-cloud-core (1.6.0)
|
61
61
|
google-cloud-env (~> 1.0)
|
62
62
|
google-cloud-errors (~> 1.0)
|
63
|
-
google-cloud-env (1.
|
63
|
+
google-cloud-env (1.5.0)
|
64
64
|
faraday (>= 0.17.3, < 2.0)
|
65
|
-
google-cloud-errors (1.0
|
65
|
+
google-cloud-errors (1.1.0)
|
66
66
|
google-cloud-logging (1.6.6)
|
67
67
|
concurrent-ruby (~> 1.1)
|
68
68
|
google-cloud-core (~> 1.2)
|
@@ -73,16 +73,16 @@ GEM
|
|
73
73
|
google-gax (~> 1.8)
|
74
74
|
googleapis-common-protos (>= 1.3.9, < 2.0)
|
75
75
|
googleapis-common-protos-types (>= 1.0.4, < 2.0)
|
76
|
-
google-cloud-trace (0.
|
76
|
+
google-cloud-trace (0.41.0)
|
77
77
|
concurrent-ruby (~> 1.1)
|
78
78
|
google-cloud-core (~> 1.5)
|
79
79
|
google-cloud-trace-v1 (~> 0.0)
|
80
80
|
google-cloud-trace-v2 (~> 0.0)
|
81
81
|
stackdriver-core (~> 1.3)
|
82
|
-
google-cloud-trace-v1 (0.
|
82
|
+
google-cloud-trace-v1 (0.3.0)
|
83
83
|
gapic-common (~> 0.3)
|
84
84
|
google-cloud-errors (~> 1.0)
|
85
|
-
google-cloud-trace-v2 (0.
|
85
|
+
google-cloud-trace-v2 (0.3.0)
|
86
86
|
gapic-common (~> 0.3)
|
87
87
|
google-cloud-errors (~> 1.0)
|
88
88
|
google-gax (1.8.1)
|
@@ -91,13 +91,13 @@ GEM
|
|
91
91
|
googleauth (~> 0.9)
|
92
92
|
grpc (~> 1.24)
|
93
93
|
rly (~> 0.2.3)
|
94
|
-
google-protobuf (3.
|
95
|
-
googleapis-common-protos (1.3.
|
96
|
-
google-protobuf (~> 3.0)
|
97
|
-
googleapis-common-protos-types (~> 1.0)
|
98
|
-
grpc (~> 1.0)
|
99
|
-
googleapis-common-protos-types (1.0.5)
|
94
|
+
google-protobuf (3.15.8)
|
95
|
+
googleapis-common-protos (1.3.10)
|
100
96
|
google-protobuf (~> 3.11)
|
97
|
+
googleapis-common-protos-types (>= 1.0.5, < 2.0)
|
98
|
+
grpc (~> 1.27)
|
99
|
+
googleapis-common-protos-types (1.0.6)
|
100
|
+
google-protobuf (~> 3.14)
|
101
101
|
googleauth (0.9.0)
|
102
102
|
faraday (~> 0.12)
|
103
103
|
jwt (>= 1.4, < 3.0)
|
@@ -112,13 +112,13 @@ GEM
|
|
112
112
|
http_parser.rb (0.6.0)
|
113
113
|
httpclient (2.8.3)
|
114
114
|
json (2.2.0)
|
115
|
-
jwt (2.2.
|
115
|
+
jwt (2.2.3)
|
116
116
|
memoist (0.16.2)
|
117
117
|
metaclass (0.0.4)
|
118
|
-
mini_mime (1.0
|
118
|
+
mini_mime (1.1.0)
|
119
119
|
mocha (1.9.0)
|
120
120
|
metaclass (~> 0.0.1)
|
121
|
-
msgpack (1.
|
121
|
+
msgpack (1.4.2)
|
122
122
|
multi_json (1.15.0)
|
123
123
|
multipart-post (2.1.1)
|
124
124
|
opencensus (0.5.0)
|
@@ -130,8 +130,8 @@ GEM
|
|
130
130
|
os (1.1.1)
|
131
131
|
parser (2.7.2.0)
|
132
132
|
ast (~> 2.4.1)
|
133
|
-
power_assert (
|
134
|
-
powerpack (0.1.
|
133
|
+
power_assert (2.0.0)
|
134
|
+
powerpack (0.1.3)
|
135
135
|
prometheus-client (0.9.0)
|
136
136
|
quantile (~> 0.2.1)
|
137
137
|
public_suffix (4.0.6)
|
@@ -139,11 +139,12 @@ GEM
|
|
139
139
|
rainbow (2.2.2)
|
140
140
|
rake
|
141
141
|
rake (10.5.0)
|
142
|
-
representable (3.
|
142
|
+
representable (3.1.1)
|
143
143
|
declarative (< 0.1.0)
|
144
|
-
|
144
|
+
trailblazer-option (>= 0.1.1, < 0.2.0)
|
145
145
|
uber (< 0.2.0)
|
146
146
|
retriable (3.1.2)
|
147
|
+
rexml (3.2.5)
|
147
148
|
rly (0.2.3)
|
148
149
|
rubocop (0.39.0)
|
149
150
|
parser (>= 2.3.0.7, < 3.0)
|
@@ -151,11 +152,11 @@ GEM
|
|
151
152
|
rainbow (>= 1.99.1, < 3.0)
|
152
153
|
ruby-progressbar (~> 1.7)
|
153
154
|
unicode-display_width (~> 1.0, >= 1.0.1)
|
154
|
-
ruby-progressbar (1.
|
155
|
-
serverengine (2.2.
|
155
|
+
ruby-progressbar (1.11.0)
|
156
|
+
serverengine (2.2.3)
|
156
157
|
sigdump (~> 0.2.2)
|
157
158
|
sigdump (0.2.4)
|
158
|
-
signet (0.
|
159
|
+
signet (0.15.0)
|
159
160
|
addressable (~> 2.3)
|
160
161
|
faraday (>= 0.17.3, < 2.0)
|
161
162
|
jwt (>= 1.5, < 3.0)
|
@@ -165,7 +166,7 @@ GEM
|
|
165
166
|
json (>= 1.8, < 3)
|
166
167
|
simplecov-html (~> 0.10.0)
|
167
168
|
simplecov-html (0.10.2)
|
168
|
-
stackdriver-core (1.
|
169
|
+
stackdriver-core (1.5.0)
|
169
170
|
google-cloud-core (~> 1.2)
|
170
171
|
strptime (0.2.5)
|
171
172
|
sync (0.5.0)
|
@@ -173,12 +174,13 @@ GEM
|
|
173
174
|
tins (~> 1.0)
|
174
175
|
test-unit (3.3.3)
|
175
176
|
power_assert
|
176
|
-
thor (1.0
|
177
|
-
tins (1.
|
177
|
+
thor (1.1.0)
|
178
|
+
tins (1.28.0)
|
178
179
|
sync
|
179
|
-
|
180
|
+
trailblazer-option (0.1.1)
|
181
|
+
tzinfo (2.0.4)
|
180
182
|
concurrent-ruby (~> 1.0)
|
181
|
-
tzinfo-data (1.
|
183
|
+
tzinfo-data (1.2021.1)
|
182
184
|
tzinfo (>= 1.0.0)
|
183
185
|
uber (0.1.0)
|
184
186
|
unicode-display_width (1.7.0)
|
@@ -10,7 +10,7 @@ eos
|
|
10
10
|
gem.homepage =
|
11
11
|
'https://github.com/GoogleCloudPlatform/fluent-plugin-google-cloud'
|
12
12
|
gem.license = 'Apache-2.0'
|
13
|
-
gem.version = '0.10.
|
13
|
+
gem.version = '0.10.9'
|
14
14
|
gem.authors = ['Stackdriver Agents Team']
|
15
15
|
gem.email = ['stackdriver-agents@google.com']
|
16
16
|
gem.required_ruby_version = Gem::Requirement.new('>= 2.2')
|
@@ -20,11 +20,11 @@ eos
|
|
20
20
|
gem.require_paths = ['lib']
|
21
21
|
|
22
22
|
gem.add_runtime_dependency 'fluentd', '1.11.2'
|
23
|
-
gem.add_runtime_dependency 'googleapis-common-protos', '1.3.
|
23
|
+
gem.add_runtime_dependency 'googleapis-common-protos', '1.3.10'
|
24
24
|
gem.add_runtime_dependency 'googleauth', '0.9.0'
|
25
25
|
gem.add_runtime_dependency 'google-api-client', '0.30.8'
|
26
26
|
gem.add_runtime_dependency 'google-cloud-logging', '1.6.6'
|
27
|
-
gem.add_runtime_dependency 'google-protobuf', '3.
|
27
|
+
gem.add_runtime_dependency 'google-protobuf', '3.15.8'
|
28
28
|
gem.add_runtime_dependency 'grpc', '1.31.1'
|
29
29
|
gem.add_runtime_dependency 'json', '2.2.0'
|
30
30
|
gem.add_runtime_dependency 'opencensus', '0.5.0'
|
@@ -15,6 +15,7 @@
|
|
15
15
|
require 'fileutils'
|
16
16
|
require 'fluent/config'
|
17
17
|
require 'fluent/config/v1_parser'
|
18
|
+
require 'fluent/plugin_helper'
|
18
19
|
require 'googleauth'
|
19
20
|
require 'google/apis/logging_v2'
|
20
21
|
require 'open-uri'
|
@@ -32,6 +33,10 @@ module Fluent
|
|
32
33
|
include Fluent::Config
|
33
34
|
Fluent::Plugin.register_filter('analyze_config', self)
|
34
35
|
|
36
|
+
# Required for the timer_execute method below
|
37
|
+
include PluginHelper::Mixin
|
38
|
+
helpers :timer
|
39
|
+
|
35
40
|
module Constants
|
36
41
|
# Built-in plugins that are ok to reference in metrics.
|
37
42
|
KNOWN_PLUGINS = {
|
@@ -212,7 +217,7 @@ module Fluent
|
|
212
217
|
if File.file?(@google_fluentd_config_path) &&
|
213
218
|
File.file?(@google_fluentd_baseline_config_path)
|
214
219
|
@log.info(
|
215
|
-
'google-fluentd configuration file found at' \
|
220
|
+
'analyze_config plugin: google-fluentd configuration file found at' \
|
216
221
|
" #{@google_fluentd_config_path}. " \
|
217
222
|
'google-fluentd baseline configuration file found at' \
|
218
223
|
" #{@google_fluentd_baseline_config_path}. " \
|
@@ -240,27 +245,49 @@ module Fluent
|
|
240
245
|
"analyze_config plugin: monitoring_type #{@monitoring_type} is " \
|
241
246
|
'unknown; there will be no metrics.')
|
242
247
|
end
|
243
|
-
|
248
|
+
|
249
|
+
@registry = Monitoring::MonitoringRegistryFactory.create(
|
244
250
|
@monitoring_type, project_id, resource, @gcm_service_address)
|
251
|
+
# Export metrics every 60 seconds.
|
252
|
+
timer_execute(:export_config_analysis_metrics, 60) { @registry.export }
|
245
253
|
|
246
|
-
|
254
|
+
@log.info('analyze_config plugin: Registering counters.')
|
255
|
+
enabled_plugins_counter = @registry.counter(
|
247
256
|
:enabled_plugins,
|
248
|
-
[:plugin_name, :is_default_plugin,
|
257
|
+
[:plugin_name, :is_default_plugin,
|
258
|
+
:has_default_config, :has_ruby_snippet],
|
249
259
|
'Enabled plugins',
|
250
|
-
'agent.googleapis.com/agent/internal/logging/config'
|
251
|
-
|
260
|
+
'agent.googleapis.com/agent/internal/logging/config',
|
261
|
+
'GAUGE')
|
262
|
+
@log.info(
|
263
|
+
'analyze_config plugin: registered enable_plugins counter. ' \
|
264
|
+
"#{enabled_plugins_counter}")
|
265
|
+
plugin_config_counter = @registry.counter(
|
252
266
|
:plugin_config,
|
253
267
|
[:plugin_name, :param, :is_present, :has_default_config],
|
254
268
|
'Configuration parameter usage for plugins relevant to Google Cloud.',
|
255
|
-
'agent.googleapis.com/agent/internal/logging/config'
|
256
|
-
|
269
|
+
'agent.googleapis.com/agent/internal/logging/config',
|
270
|
+
'GAUGE')
|
271
|
+
@log.info('analyze_config plugin: registered plugin_config counter. ' \
|
272
|
+
"#{plugin_config_counter}")
|
273
|
+
config_bool_values_counter = @registry.counter(
|
257
274
|
:config_bool_values,
|
258
275
|
[:plugin_name, :param, :value],
|
259
276
|
'Values for bool parameters in Google Cloud plugins',
|
260
|
-
'agent.googleapis.com/agent/internal/logging/config'
|
277
|
+
'agent.googleapis.com/agent/internal/logging/config',
|
278
|
+
'GAUGE')
|
279
|
+
@log.info('analyze_config plugin: registered config_bool_values ' \
|
280
|
+
"counter. #{config_bool_values_counter}")
|
261
281
|
|
262
282
|
config = parse_config(@google_fluentd_config_path)
|
283
|
+
@log.debug(
|
284
|
+
'analyze_config plugin: successfully parsed google-fluentd' \
|
285
|
+
" configuration file at #{@google_fluentd_config_path}. #{config}")
|
263
286
|
baseline_config = parse_config(@google_fluentd_baseline_config_path)
|
287
|
+
@log.debug(
|
288
|
+
'analyze_config plugin: successfully parsed google-fluentd' \
|
289
|
+
' baseline configuration file at' \
|
290
|
+
" #{@google_fluentd_baseline_config_path}: #{baseline_config}")
|
264
291
|
|
265
292
|
# Create hash of all baseline elements by their plugin names.
|
266
293
|
baseline_elements = Hash[baseline_config.elements.collect do |e|
|
@@ -290,7 +317,7 @@ module Fluent
|
|
290
317
|
is_default_plugin = false
|
291
318
|
has_default_config = false
|
292
319
|
end
|
293
|
-
|
320
|
+
enabled_plugins_counter.increment(
|
294
321
|
labels: {
|
295
322
|
plugin_name: plugin_name,
|
296
323
|
is_default_plugin: is_default_plugin,
|
@@ -303,7 +330,7 @@ module Fluent
|
|
303
330
|
# detect_exceptions).
|
304
331
|
next unless GOOGLE_PLUGIN_PARAMS.key?(e['@type'])
|
305
332
|
GOOGLE_PLUGIN_PARAMS[e['@type']].each do |p|
|
306
|
-
|
333
|
+
plugin_config_counter.increment(
|
307
334
|
labels: {
|
308
335
|
plugin_name: e['@type'],
|
309
336
|
param: p,
|
@@ -314,7 +341,7 @@ module Fluent
|
|
314
341
|
},
|
315
342
|
by: 1)
|
316
343
|
next unless e.key?(p) && %w(true false).include?(e[p])
|
317
|
-
|
344
|
+
config_bool_values_counter.increment(
|
318
345
|
labels: {
|
319
346
|
plugin_name: e['@type'],
|
320
347
|
param: p,
|
@@ -323,6 +350,8 @@ module Fluent
|
|
323
350
|
by: 1)
|
324
351
|
end
|
325
352
|
end
|
353
|
+
@log.info(
|
354
|
+
'analyze_config plugin: Successfully finished analyzing config.')
|
326
355
|
else
|
327
356
|
@log.info(
|
328
357
|
'analyze_config plugin: google-fluentd configuration file does not ' \
|
@@ -341,6 +370,9 @@ module Fluent
|
|
341
370
|
|
342
371
|
def shutdown
|
343
372
|
super
|
373
|
+
# Export metrics on shutdown. This is a best-effort attempt, and it might
|
374
|
+
# fail, for instance if there was a recent write to the same time series.
|
375
|
+
@registry.export unless @registry.nil?
|
344
376
|
end
|
345
377
|
|
346
378
|
# rubocop:disable Lint/UnusedMethodArgument
|
@@ -52,7 +52,7 @@ module Monitoring
|
|
52
52
|
def initialize(_project_id, _monitored_resource, _gcm_service_address)
|
53
53
|
end
|
54
54
|
|
55
|
-
def counter(_name, _labels, _docstring, _prefix)
|
55
|
+
def counter(_name, _labels, _docstring, _prefix, _aggregation)
|
56
56
|
BaseCounter.new
|
57
57
|
end
|
58
58
|
|
@@ -75,7 +75,7 @@ module Monitoring
|
|
75
75
|
end
|
76
76
|
|
77
77
|
# Exception-driven behavior to avoid synchronization errors.
|
78
|
-
def counter(name, _labels, docstring, _prefix)
|
78
|
+
def counter(name, _labels, docstring, _prefix, _aggregation)
|
79
79
|
# When we upgrade to Prometheus client 0.10.0 or higher, pass the
|
80
80
|
# labels in the metric constructor. The 'labels' field in
|
81
81
|
# Prometheus client 0.9.0 has a different function and will not
|
@@ -102,12 +102,18 @@ module Monitoring
|
|
102
102
|
@gcm_service_address = gcm_service_address
|
103
103
|
@recorders = {}
|
104
104
|
@exporters = {}
|
105
|
+
@log.info(
|
106
|
+
'monitoring module: Successfully initialized Open Census monitoring ' \
|
107
|
+
'registry.')
|
105
108
|
end
|
106
109
|
|
107
|
-
def counter(name, labels, docstring, prefix)
|
110
|
+
def counter(name, labels, docstring, prefix, aggregation)
|
108
111
|
translator = MetricTranslator.new(name, labels)
|
109
112
|
measure = OpenCensus::Stats::MeasureRegistry.get(translator.name)
|
110
113
|
if measure.nil?
|
114
|
+
@log.info(
|
115
|
+
'monitoring module: Registering a new measure registry for ' \
|
116
|
+
"#{translator.name}")
|
111
117
|
measure = OpenCensus::Stats.create_measure_int(
|
112
118
|
name: translator.name,
|
113
119
|
unit: OpenCensus::Stats::Measure::UNIT_NONE,
|
@@ -115,7 +121,10 @@ module Monitoring
|
|
115
121
|
)
|
116
122
|
end
|
117
123
|
unless @exporters.keys.include?(prefix)
|
118
|
-
@
|
124
|
+
@log.info(
|
125
|
+
'monitoring module: Registering a new exporter for ' \
|
126
|
+
"#{prefix}")
|
127
|
+
@recorders[prefix] = OpenCensus::Stats::Recorder.new
|
119
128
|
@exporters[prefix] = \
|
120
129
|
OpenCensus::Stats::Exporters::Stackdriver.new(
|
121
130
|
project_id: @project_id,
|
@@ -124,25 +133,47 @@ module Monitoring
|
|
124
133
|
resource_labels: @metrics_monitored_resource.labels,
|
125
134
|
gcm_service_address: @gcm_service_address
|
126
135
|
)
|
136
|
+
@log.info(
|
137
|
+
'monitoring module: Registered recorders and exporters for ' \
|
138
|
+
"#{prefix}.\n#{@exporters[prefix]}")
|
127
139
|
end
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
140
|
+
if aggregation == 'GAUGE'
|
141
|
+
stats_aggregation = OpenCensus::Stats.create_last_value_aggregation
|
142
|
+
else
|
143
|
+
stats_aggregation = OpenCensus::Stats.create_sum_aggregation
|
144
|
+
end
|
145
|
+
@recorders[prefix].register_view(
|
146
|
+
OpenCensus::Stats::View.new(
|
147
|
+
name: translator.name,
|
148
|
+
measure: measure,
|
149
|
+
aggregation: stats_aggregation,
|
150
|
+
description: docstring,
|
151
|
+
columns: translator.view_labels.map(&:to_s)
|
152
|
+
)
|
134
153
|
)
|
135
|
-
OpenCensusCounter.new(@recorders[prefix], measure, translator)
|
154
|
+
counter = OpenCensusCounter.new(@recorders[prefix], measure, translator)
|
155
|
+
@log.info(
|
156
|
+
'monitoring module: Successfully initialized Open Census counter for ' \
|
157
|
+
"#{prefix}/#{name}.")
|
158
|
+
counter
|
136
159
|
rescue StandardError => e
|
137
160
|
@log.warn "Failed to count metrics for #{name}.", error: e
|
138
161
|
raise e
|
139
162
|
end
|
140
163
|
|
141
164
|
def export
|
165
|
+
@log.debug(
|
166
|
+
"monitoring module: Exporting metrics for #{@exporters.keys}.")
|
142
167
|
@exporters.keys.each do |prefix|
|
168
|
+
@log.debug(
|
169
|
+
"monitoring module: Exporting metrics for #{prefix}. " \
|
170
|
+
"#{@recorders[prefix].views_data}")
|
143
171
|
@exporters[prefix].export @recorders[prefix].views_data
|
144
172
|
end
|
145
173
|
rescue StandardError => e
|
174
|
+
# TODO(lingshi): Fix the error handling here. Seems like the export is
|
175
|
+
# done asynchronously. So any failure happens silently. More details at
|
176
|
+
# https://github.com/census-ecosystem/opencensus-ruby-exporter-stackdriver/blob/f8de506204972548ca535eff6010d15f328df6c3/lib/opencensus/stats/exporters/stackdriver.rb#L156
|
146
177
|
@log.warn 'Failed to export some metrics.', error: e
|
147
178
|
raise e
|
148
179
|
end
|
@@ -564,37 +564,37 @@ module Fluent
|
|
564
564
|
# we can't change it.
|
565
565
|
@uptime_metric = @registry.counter(
|
566
566
|
:uptime, [:version], 'Uptime of Logging agent',
|
567
|
-
'agent.googleapis.com/agent')
|
567
|
+
'agent.googleapis.com/agent', 'CUMULATIVE')
|
568
568
|
update_uptime
|
569
569
|
timer_execute(:update_uptime, 1) { update_uptime }
|
570
570
|
@successful_requests_count = @registry.counter(
|
571
571
|
:stackdriver_successful_requests_count,
|
572
572
|
[:grpc, :code],
|
573
573
|
'A number of successful requests to the Stackdriver Logging API',
|
574
|
-
'agent.googleapis.com/agent')
|
574
|
+
'agent.googleapis.com/agent', 'CUMULATIVE')
|
575
575
|
@failed_requests_count = @registry.counter(
|
576
576
|
:stackdriver_failed_requests_count,
|
577
577
|
[:grpc, :code],
|
578
578
|
'A number of failed requests to the Stackdriver Logging '\
|
579
579
|
'API, broken down by the error code',
|
580
|
-
'agent.googleapis.com/agent')
|
580
|
+
'agent.googleapis.com/agent', 'CUMULATIVE')
|
581
581
|
@ingested_entries_count = @registry.counter(
|
582
582
|
:stackdriver_ingested_entries_count,
|
583
583
|
[:grpc, :code],
|
584
584
|
'A number of log entries ingested by Stackdriver Logging',
|
585
|
-
'agent.googleapis.com/agent')
|
585
|
+
'agent.googleapis.com/agent', 'CUMULATIVE')
|
586
586
|
@dropped_entries_count = @registry.counter(
|
587
587
|
:stackdriver_dropped_entries_count,
|
588
588
|
[:grpc, :code],
|
589
589
|
'A number of log entries dropped by the Stackdriver output plugin',
|
590
|
-
'agent.googleapis.com/agent')
|
590
|
+
'agent.googleapis.com/agent', 'CUMULATIVE')
|
591
591
|
@retried_entries_count = @registry.counter(
|
592
592
|
:stackdriver_retried_entries_count,
|
593
593
|
[:grpc, :code],
|
594
594
|
'The number of log entries that failed to be ingested by '\
|
595
595
|
'the Stackdriver output plugin due to a transient error '\
|
596
596
|
'and were retried',
|
597
|
-
'agent.googleapis.com/agent')
|
597
|
+
'agent.googleapis.com/agent', 'CUMULATIVE')
|
598
598
|
@ok_code = @use_grpc ? GRPC::Core::StatusCodes::OK : 200
|
599
599
|
end
|
600
600
|
|