fluent-plugin-google-cloud 0.9.1 → 0.10.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +21 -25
- data/fluent-plugin-google-cloud.gemspec +3 -3
- data/lib/fluent/plugin/filter_analyze_config.rb +32 -23
- data/lib/fluent/plugin/monitoring.rb +29 -17
- data/lib/fluent/plugin/out_google_cloud.rb +12 -6
- data/test/plugin/base_test.rb +4 -15
- data/test/plugin/test_filter_analyze_config.rb +25 -25
- 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: a1e4077eb78db81677fa78de507e0aa13acd11a5a07a94004a4df57b3b3ee09a
|
4
|
+
data.tar.gz: 03602f3a4196b0527a164954c1015e595b7364728513843304c098f7ce440d20
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 93388ca7c2229d29dd42e6f9d35972841a4024d9e16fc5403993289c6e48f8911d7a12ff8944b73812b15b0fc2311dbf1919e11581343c90e0dfde599ad6c8a3
|
7
|
+
data.tar.gz: c04221d3ac69bfaa0a5831830a8138352a3956a3ad9adb9b99df027b1788252b8e1085e58b7ff180d574511f91cf2b408b0405c5310e3fd11982ad9f36f6d1c1
|
data/Gemfile.lock
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
fluent-plugin-google-cloud (0.
|
5
|
-
fluentd (= 1.
|
4
|
+
fluent-plugin-google-cloud (0.10.4)
|
5
|
+
fluentd (= 1.11.2)
|
6
6
|
google-api-client (= 0.30.8)
|
7
7
|
google-cloud-logging (= 1.6.6)
|
8
8
|
google-protobuf (= 3.12.2)
|
9
9
|
googleapis-common-protos (= 1.3.9)
|
10
10
|
googleauth (= 0.9.0)
|
11
|
-
grpc (= 1.
|
11
|
+
grpc (= 1.31.1)
|
12
12
|
json (= 2.2.0)
|
13
13
|
opencensus (= 0.5.0)
|
14
14
|
opencensus-stackdriver (= 0.3.2)
|
@@ -19,34 +19,31 @@ GEM
|
|
19
19
|
addressable (2.7.0)
|
20
20
|
public_suffix (>= 2.0.2, < 5.0)
|
21
21
|
ast (2.4.1)
|
22
|
-
concurrent-ruby (1.1.
|
23
|
-
cool.io (1.
|
22
|
+
concurrent-ruby (1.1.7)
|
23
|
+
cool.io (1.7.0)
|
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.
|
31
|
-
safe_yaml (~> 1.0.0)
|
30
|
+
crack (0.4.4)
|
32
31
|
declarative (0.0.20)
|
33
32
|
declarative-option (0.1.0)
|
34
|
-
dig_rb (1.0.1)
|
35
33
|
docile (1.3.2)
|
36
34
|
faraday (0.17.3)
|
37
35
|
multipart-post (>= 1.2, < 3)
|
38
|
-
fluentd (1.
|
36
|
+
fluentd (1.11.2)
|
39
37
|
cool.io (>= 1.4.5, < 2.0.0)
|
40
|
-
dig_rb (~> 1.0.0)
|
41
38
|
http_parser.rb (>= 0.5.1, < 0.7.0)
|
42
|
-
msgpack (>= 1.
|
39
|
+
msgpack (>= 1.3.1, < 2.0.0)
|
43
40
|
serverengine (>= 2.0.4, < 3.0.0)
|
44
41
|
sigdump (~> 0.2.2)
|
45
42
|
strptime (>= 0.2.2, < 1.0.0)
|
46
|
-
tzinfo (
|
43
|
+
tzinfo (>= 1.0, < 3.0)
|
47
44
|
tzinfo-data (~> 1.0)
|
48
45
|
yajl-ruby (~> 1.0)
|
49
|
-
gapic-common (0.3.
|
46
|
+
gapic-common (0.3.4)
|
50
47
|
google-protobuf (~> 3.12, >= 3.12.2)
|
51
48
|
googleapis-common-protos (>= 1.3.9, < 2.0)
|
52
49
|
googleapis-common-protos-types (>= 1.0.4, < 2.0)
|
@@ -63,7 +60,7 @@ GEM
|
|
63
60
|
google-cloud-core (1.5.0)
|
64
61
|
google-cloud-env (~> 1.0)
|
65
62
|
google-cloud-errors (~> 1.0)
|
66
|
-
google-cloud-env (1.
|
63
|
+
google-cloud-env (1.4.0)
|
67
64
|
faraday (>= 0.17.3, < 2.0)
|
68
65
|
google-cloud-errors (1.0.1)
|
69
66
|
google-cloud-logging (1.6.6)
|
@@ -82,10 +79,10 @@ GEM
|
|
82
79
|
google-cloud-trace-v1 (~> 0.0)
|
83
80
|
google-cloud-trace-v2 (~> 0.0)
|
84
81
|
stackdriver-core (~> 1.3)
|
85
|
-
google-cloud-trace-v1 (0.1.
|
82
|
+
google-cloud-trace-v1 (0.1.2)
|
86
83
|
gapic-common (~> 0.3)
|
87
84
|
google-cloud-errors (~> 1.0)
|
88
|
-
google-cloud-trace-v2 (0.1.
|
85
|
+
google-cloud-trace-v2 (0.1.2)
|
89
86
|
gapic-common (~> 0.3)
|
90
87
|
google-cloud-errors (~> 1.0)
|
91
88
|
google-gax (1.8.1)
|
@@ -108,14 +105,14 @@ GEM
|
|
108
105
|
multi_json (~> 1.11)
|
109
106
|
os (>= 0.9, < 2.0)
|
110
107
|
signet (~> 0.7)
|
111
|
-
grpc (1.
|
108
|
+
grpc (1.31.1)
|
112
109
|
google-protobuf (~> 3.12)
|
113
110
|
googleapis-common-protos-types (~> 1.0)
|
114
111
|
hashdiff (1.0.1)
|
115
112
|
http_parser.rb (0.6.0)
|
116
113
|
httpclient (2.8.3)
|
117
114
|
json (2.2.0)
|
118
|
-
jwt (2.2.
|
115
|
+
jwt (2.2.2)
|
119
116
|
memoist (0.16.2)
|
120
117
|
metaclass (0.0.4)
|
121
118
|
mini_mime (1.0.2)
|
@@ -130,14 +127,14 @@ GEM
|
|
130
127
|
google-cloud-monitoring (~> 0.32)
|
131
128
|
google-cloud-trace (~> 0.35)
|
132
129
|
opencensus (~> 0.5)
|
133
|
-
os (1.1.
|
134
|
-
parser (2.7.
|
130
|
+
os (1.1.1)
|
131
|
+
parser (2.7.2.0)
|
135
132
|
ast (~> 2.4.1)
|
136
133
|
power_assert (1.2.0)
|
137
134
|
powerpack (0.1.2)
|
138
135
|
prometheus-client (0.9.0)
|
139
136
|
quantile (~> 0.2.1)
|
140
|
-
public_suffix (4.0.
|
137
|
+
public_suffix (4.0.6)
|
141
138
|
quantile (0.2.1)
|
142
139
|
rainbow (2.2.2)
|
143
140
|
rake
|
@@ -155,7 +152,6 @@ GEM
|
|
155
152
|
ruby-progressbar (~> 1.7)
|
156
153
|
unicode-display_width (~> 1.0, >= 1.0.1)
|
157
154
|
ruby-progressbar (1.10.1)
|
158
|
-
safe_yaml (1.0.5)
|
159
155
|
serverengine (2.2.1)
|
160
156
|
sigdump (~> 0.2.2)
|
161
157
|
sigdump (0.2.4)
|
@@ -171,18 +167,18 @@ GEM
|
|
171
167
|
simplecov-html (0.10.2)
|
172
168
|
stackdriver-core (1.4.0)
|
173
169
|
google-cloud-core (~> 1.2)
|
174
|
-
strptime (0.2.
|
170
|
+
strptime (0.2.5)
|
175
171
|
sync (0.5.0)
|
176
172
|
term-ansicolor (1.7.1)
|
177
173
|
tins (~> 1.0)
|
178
174
|
test-unit (3.3.3)
|
179
175
|
power_assert
|
180
176
|
thor (1.0.1)
|
181
|
-
tins (1.
|
177
|
+
tins (1.26.0)
|
182
178
|
sync
|
183
179
|
tzinfo (2.0.2)
|
184
180
|
concurrent-ruby (~> 1.0)
|
185
|
-
tzinfo-data (1.2020.
|
181
|
+
tzinfo-data (1.2020.4)
|
186
182
|
tzinfo (>= 1.0.0)
|
187
183
|
uber (0.1.0)
|
188
184
|
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.
|
13
|
+
gem.version = '0.10.4'
|
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')
|
@@ -19,13 +19,13 @@ eos
|
|
19
19
|
gem.test_files = gem.files.grep(/^(test)/)
|
20
20
|
gem.require_paths = ['lib']
|
21
21
|
|
22
|
-
gem.add_runtime_dependency 'fluentd', '1.
|
22
|
+
gem.add_runtime_dependency 'fluentd', '1.11.2'
|
23
23
|
gem.add_runtime_dependency 'googleapis-common-protos', '1.3.9'
|
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
27
|
gem.add_runtime_dependency 'google-protobuf', '3.12.2'
|
28
|
-
gem.add_runtime_dependency 'grpc', '1.
|
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'
|
31
31
|
gem.add_runtime_dependency 'opencensus-stackdriver', '0.3.2'
|
@@ -15,6 +15,9 @@
|
|
15
15
|
require 'fileutils'
|
16
16
|
require 'fluent/config'
|
17
17
|
require 'fluent/config/v1_parser'
|
18
|
+
require 'googleauth'
|
19
|
+
require 'google/apis/logging_v2'
|
20
|
+
require 'open-uri'
|
18
21
|
require 'set'
|
19
22
|
|
20
23
|
require_relative 'common'
|
@@ -155,8 +158,8 @@ module Fluent
|
|
155
158
|
super
|
156
159
|
@log = $log # rubocop:disable Style/GlobalVars
|
157
160
|
|
158
|
-
|
159
|
-
|
161
|
+
@log.info(
|
162
|
+
'analyze_config plugin: Started the plugin to analyze configuration.')
|
160
163
|
end
|
161
164
|
|
162
165
|
def parse_config(path)
|
@@ -205,6 +208,7 @@ module Fluent
|
|
205
208
|
|
206
209
|
def configure(conf)
|
207
210
|
super
|
211
|
+
@log.info('analyze_config plugin: Starting to configure the plugin.')
|
208
212
|
if File.file?(@google_fluentd_config_path) &&
|
209
213
|
File.file?(@google_fluentd_baseline_config_path)
|
210
214
|
@log.info(
|
@@ -232,24 +236,28 @@ module Fluent
|
|
232
236
|
|
233
237
|
unless Monitoring::MonitoringRegistryFactory.supports_monitoring_type(
|
234
238
|
@monitoring_type)
|
235
|
-
@log.warn
|
236
|
-
|
239
|
+
@log.warn(
|
240
|
+
"analyze_config plugin: monitoring_type #{@monitoring_type} is " \
|
241
|
+
'unknown; there will be no metrics.')
|
237
242
|
end
|
238
243
|
registry = Monitoring::MonitoringRegistryFactory.create(
|
239
244
|
@monitoring_type, project_id, resource, @gcm_service_address)
|
240
245
|
|
241
246
|
plugin_usage = registry.counter(
|
242
|
-
:
|
243
|
-
[:plugin_name, :is_default_plugin, :
|
244
|
-
'Enabled plugins'
|
247
|
+
:enabled_plugins,
|
248
|
+
[:plugin_name, :is_default_plugin, :has_default_config],
|
249
|
+
'Enabled plugins',
|
250
|
+
'agent.googleapis.com/agent/internal/logging/config')
|
245
251
|
config_usage = registry.counter(
|
246
|
-
:
|
247
|
-
[:plugin_name, :param, :is_present, :
|
248
|
-
'
|
252
|
+
:plugin_config,
|
253
|
+
[:plugin_name, :param, :is_present, :has_default_config],
|
254
|
+
'Configuration parameter usage for plugins relevant to Google Cloud.',
|
255
|
+
'agent.googleapis.com/agent/internal/logging/config')
|
249
256
|
config_bool_values = registry.counter(
|
250
|
-
:
|
257
|
+
:config_bool_values,
|
251
258
|
[:plugin_name, :param, :value],
|
252
|
-
'Values for bool parameters in Google Cloud plugins'
|
259
|
+
'Values for bool parameters in Google Cloud plugins',
|
260
|
+
'agent.googleapis.com/agent/internal/logging/config')
|
253
261
|
|
254
262
|
config = parse_config(@google_fluentd_config_path)
|
255
263
|
baseline_config = parse_config(@google_fluentd_baseline_config_path)
|
@@ -276,17 +284,17 @@ module Fluent
|
|
276
284
|
plugin_name = default_plugin_name(e)
|
277
285
|
if baseline_elements.key?(plugin_name)
|
278
286
|
is_default_plugin = true
|
279
|
-
|
287
|
+
has_default_config = (baseline_elements[plugin_name] == e)
|
280
288
|
else
|
281
289
|
plugin_name = custom_plugin_name(e)
|
282
290
|
is_default_plugin = false
|
283
|
-
|
291
|
+
has_default_config = false
|
284
292
|
end
|
285
293
|
plugin_usage.increment(
|
286
294
|
labels: {
|
287
295
|
plugin_name: plugin_name,
|
288
296
|
is_default_plugin: is_default_plugin,
|
289
|
-
|
297
|
+
has_default_config: has_default_config,
|
290
298
|
has_ruby_snippet: embedded_ruby?(e)
|
291
299
|
},
|
292
300
|
by: 1)
|
@@ -300,7 +308,7 @@ module Fluent
|
|
300
308
|
plugin_name: e['@type'],
|
301
309
|
param: p,
|
302
310
|
is_present: e.key?(p),
|
303
|
-
|
311
|
+
has_default_config: (e.key?(p) &&
|
304
312
|
baseline_google_element.key?(p) &&
|
305
313
|
e[p] == baseline_google_element[p])
|
306
314
|
},
|
@@ -317,17 +325,18 @@ module Fluent
|
|
317
325
|
end
|
318
326
|
else
|
319
327
|
@log.info(
|
320
|
-
'google-fluentd configuration file does not
|
321
|
-
" #{@google_fluentd_config_path} or " \
|
322
|
-
'
|
323
|
-
" #{@google_fluentd_baseline_config_path}
|
324
|
-
'
|
328
|
+
'analyze_config plugin: google-fluentd configuration file does not ' \
|
329
|
+
"exist at #{@google_fluentd_config_path} or google-fluentd " \
|
330
|
+
'baseline configuration file does not exist at' \
|
331
|
+
" #{@google_fluentd_baseline_config_path}. Skipping configuration " \
|
332
|
+
'analysis.')
|
325
333
|
end
|
326
334
|
rescue => e
|
327
335
|
# Do not crash the agent due to configuration analysis failures.
|
328
336
|
@log.warn(
|
329
|
-
'Failed to optionally analyze the
|
330
|
-
" file. Proceeding anyway. Error: #{e}"
|
337
|
+
'analyze_config plugin: Failed to optionally analyze the ' \
|
338
|
+
"google-fluentd configuration file. Proceeding anyway. Error: #{e}. " \
|
339
|
+
"Trace: #{e.backtrace}")
|
331
340
|
end
|
332
341
|
|
333
342
|
def shutdown
|
@@ -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)
|
55
|
+
def counter(_name, _labels, _docstring, _prefix)
|
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)
|
78
|
+
def counter(name, _labels, docstring, _prefix)
|
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
|
@@ -97,21 +97,14 @@ module Monitoring
|
|
97
97
|
require 'opencensus'
|
98
98
|
require 'opencensus-stackdriver'
|
99
99
|
@log = $log # rubocop:disable Style/GlobalVars
|
100
|
-
@
|
101
|
-
@
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
resource_labels: monitored_resource.labels,
|
106
|
-
gcm_service_address: gcm_service_address
|
107
|
-
)
|
108
|
-
OpenCensus.configure do |c|
|
109
|
-
c.stats.exporter = @exporter
|
110
|
-
end
|
111
|
-
@log.debug "OpenCensus config=#{OpenCensus.config}"
|
100
|
+
@project_id = project_id
|
101
|
+
@metrics_monitored_resource = monitored_resource
|
102
|
+
@gcm_service_address = gcm_service_address
|
103
|
+
@recorders = {}
|
104
|
+
@exporters = {}
|
112
105
|
end
|
113
106
|
|
114
|
-
def counter(name, labels, docstring)
|
107
|
+
def counter(name, labels, docstring, prefix)
|
115
108
|
translator = MetricTranslator.new(name, labels)
|
116
109
|
measure = OpenCensus::Stats::MeasureRegistry.get(translator.name)
|
117
110
|
if measure.nil?
|
@@ -121,6 +114,17 @@ module Monitoring
|
|
121
114
|
description: docstring
|
122
115
|
)
|
123
116
|
end
|
117
|
+
unless @exporters.keys.include?(prefix)
|
118
|
+
@recorders[prefix] = OpenCensus::Stats.ensure_recorder
|
119
|
+
@exporters[prefix] = \
|
120
|
+
OpenCensus::Stats::Exporters::Stackdriver.new(
|
121
|
+
project_id: @project_id,
|
122
|
+
metric_prefix: prefix,
|
123
|
+
resource_type: @metrics_monitored_resource.type,
|
124
|
+
resource_labels: @metrics_monitored_resource.labels,
|
125
|
+
gcm_service_address: @gcm_service_address
|
126
|
+
)
|
127
|
+
end
|
124
128
|
OpenCensus::Stats.create_and_register_view(
|
125
129
|
name: translator.name,
|
126
130
|
measure: measure,
|
@@ -128,11 +132,19 @@ module Monitoring
|
|
128
132
|
description: docstring,
|
129
133
|
columns: translator.view_labels.map(&:to_s)
|
130
134
|
)
|
131
|
-
OpenCensusCounter.new(@
|
135
|
+
OpenCensusCounter.new(@recorders[prefix], measure, translator)
|
136
|
+
rescue StandardError => e
|
137
|
+
@log.warn "Failed to count metrics for #{name}.", error: e
|
138
|
+
raise e
|
132
139
|
end
|
133
140
|
|
134
141
|
def export
|
135
|
-
@
|
142
|
+
@exporters.keys.each do |prefix|
|
143
|
+
@exporters[prefix].export @recorders[prefix].views_data
|
144
|
+
end
|
145
|
+
rescue StandardError => e
|
146
|
+
@log.warn 'Failed to export some metrics.', error: e
|
147
|
+
raise e
|
136
148
|
end
|
137
149
|
end
|
138
150
|
|
@@ -563,32 +563,38 @@ module Fluent
|
|
563
563
|
# Uptime should be a gauge, but the metric definition is a counter and
|
564
564
|
# we can't change it.
|
565
565
|
@uptime_metric = @registry.counter(
|
566
|
-
:uptime, [:version], 'Uptime of Logging agent'
|
566
|
+
:uptime, [:version], 'Uptime of Logging agent',
|
567
|
+
'agent.googleapis.com/agent')
|
567
568
|
update_uptime
|
568
569
|
timer_execute(:update_uptime, 1) { update_uptime }
|
569
570
|
@successful_requests_count = @registry.counter(
|
570
571
|
:stackdriver_successful_requests_count,
|
571
572
|
[:grpc, :code],
|
572
|
-
'A number of successful requests to the Stackdriver Logging API'
|
573
|
+
'A number of successful requests to the Stackdriver Logging API',
|
574
|
+
'agent.googleapis.com/agent')
|
573
575
|
@failed_requests_count = @registry.counter(
|
574
576
|
:stackdriver_failed_requests_count,
|
575
577
|
[:grpc, :code],
|
576
578
|
'A number of failed requests to the Stackdriver Logging '\
|
577
|
-
'API, broken down by the error code'
|
579
|
+
'API, broken down by the error code',
|
580
|
+
'agent.googleapis.com/agent')
|
578
581
|
@ingested_entries_count = @registry.counter(
|
579
582
|
:stackdriver_ingested_entries_count,
|
580
583
|
[:grpc, :code],
|
581
|
-
'A number of log entries ingested by Stackdriver Logging'
|
584
|
+
'A number of log entries ingested by Stackdriver Logging',
|
585
|
+
'agent.googleapis.com/agent')
|
582
586
|
@dropped_entries_count = @registry.counter(
|
583
587
|
:stackdriver_dropped_entries_count,
|
584
588
|
[:grpc, :code],
|
585
|
-
'A number of log entries dropped by the Stackdriver output plugin'
|
589
|
+
'A number of log entries dropped by the Stackdriver output plugin',
|
590
|
+
'agent.googleapis.com/agent')
|
586
591
|
@retried_entries_count = @registry.counter(
|
587
592
|
:stackdriver_retried_entries_count,
|
588
593
|
[:grpc, :code],
|
589
594
|
'The number of log entries that failed to be ingested by '\
|
590
595
|
'the Stackdriver output plugin due to a transient error '\
|
591
|
-
'and were retried'
|
596
|
+
'and were retried',
|
597
|
+
'agent.googleapis.com/agent')
|
592
598
|
@ok_code = @use_grpc ? GRPC::Core::StatusCodes::OK : 200
|
593
599
|
end
|
594
600
|
|
data/test/plugin/base_test.rb
CHANGED
@@ -169,10 +169,11 @@ module BaseTest
|
|
169
169
|
assert_true d.instance.instance_variable_get(:@enable_monitoring)
|
170
170
|
registry = d.instance.instance_variable_get(:@registry)
|
171
171
|
assert_not_nil registry
|
172
|
-
|
173
|
-
|
172
|
+
monitored_resource = registry.instance_variable_get(
|
173
|
+
:@metrics_monitored_resource)
|
174
|
+
assert_equal('custom_resource', monitored_resource.type, "Index #{index}")
|
174
175
|
assert_equal({ 'label1' => '123', 'label2' => 'abc' },
|
175
|
-
|
176
|
+
monitored_resource.labels, "Index #{index}")
|
176
177
|
end
|
177
178
|
end
|
178
179
|
|
@@ -2018,18 +2019,6 @@ module BaseTest
|
|
2018
2019
|
}
|
2019
2020
|
end
|
2020
2021
|
|
2021
|
-
def gke_container_log_entry(log)
|
2022
|
-
{
|
2023
|
-
log: log,
|
2024
|
-
LOCAL_RESOURCE_ID_KEY =>
|
2025
|
-
"#{CONTAINER_LOCAL_RESOURCE_ID_PREFIX}.#{CONTAINER_NAMESPACE_ID}" \
|
2026
|
-
".#{K8S_POD_NAME}.#{K8S_CONTAINER_NAME}"
|
2027
|
-
}
|
2028
|
-
end
|
2029
|
-
|
2030
|
-
# TODO(qingling128): Temporary fallback for metadata agent restarts.
|
2031
|
-
# k8s resources.
|
2032
|
-
|
2033
2022
|
def k8s_container_log_entry(log,
|
2034
2023
|
local_resource_id: K8S_LOCAL_RESOURCE_ID)
|
2035
2024
|
{
|
@@ -55,81 +55,81 @@ class FilterAnalyzeConfigTest < Test::Unit::TestCase
|
|
55
55
|
|
56
56
|
# Default plugins, with default config.
|
57
57
|
assert_metric_value.call(
|
58
|
-
:
|
58
|
+
:enabled_plugins,
|
59
59
|
1,
|
60
60
|
plugin_name: 'source/syslog/tcp',
|
61
61
|
is_default_plugin: true,
|
62
|
-
|
62
|
+
has_default_config: true,
|
63
63
|
has_ruby_snippet: false)
|
64
64
|
assert_metric_value.call(
|
65
|
-
:
|
65
|
+
:enabled_plugins,
|
66
66
|
1,
|
67
67
|
plugin_name: 'source/tail/apache-access',
|
68
68
|
is_default_plugin: true,
|
69
|
-
|
69
|
+
has_default_config: true,
|
70
70
|
has_ruby_snippet: false)
|
71
71
|
assert_metric_value.call(
|
72
|
-
:
|
72
|
+
:enabled_plugins,
|
73
73
|
1,
|
74
74
|
plugin_name: 'filter/add_insert_ids',
|
75
75
|
is_default_plugin: true,
|
76
|
-
|
76
|
+
has_default_config: true,
|
77
77
|
has_ruby_snippet: false)
|
78
78
|
|
79
79
|
# Default plugins, with custom config.
|
80
80
|
assert_metric_value.call(
|
81
|
-
:
|
81
|
+
:enabled_plugins,
|
82
82
|
1,
|
83
83
|
plugin_name: 'match/google_cloud',
|
84
84
|
is_default_plugin: true,
|
85
|
-
|
85
|
+
has_default_config: false,
|
86
86
|
has_ruby_snippet: false)
|
87
87
|
|
88
88
|
# Custom plugins, some with embedded Ruby.
|
89
89
|
assert_metric_value.call(
|
90
|
-
:
|
90
|
+
:enabled_plugins,
|
91
91
|
1,
|
92
92
|
plugin_name: 'filter',
|
93
93
|
is_default_plugin: false,
|
94
|
-
|
94
|
+
has_default_config: false,
|
95
95
|
has_ruby_snippet: false)
|
96
96
|
assert_metric_value.call(
|
97
|
-
:
|
97
|
+
:enabled_plugins,
|
98
98
|
1,
|
99
99
|
plugin_name: 'filter/record_transformer',
|
100
100
|
is_default_plugin: false,
|
101
|
-
|
101
|
+
has_default_config: false,
|
102
102
|
has_ruby_snippet: true)
|
103
103
|
assert_metric_value.call(
|
104
|
-
:
|
104
|
+
:enabled_plugins,
|
105
105
|
1,
|
106
106
|
plugin_name: 'match/stdout',
|
107
107
|
is_default_plugin: false,
|
108
|
-
|
108
|
+
has_default_config: false,
|
109
109
|
has_ruby_snippet: true)
|
110
110
|
|
111
111
|
# For out_google_cloud, 3 params are present.
|
112
112
|
assert_metric_value.call(
|
113
|
-
:
|
113
|
+
:plugin_config,
|
114
114
|
1,
|
115
115
|
plugin_name: 'google_cloud',
|
116
116
|
param: 'adjust_invalid_timestamps',
|
117
117
|
is_present: true,
|
118
|
-
|
118
|
+
has_default_config: true)
|
119
119
|
assert_metric_value.call(
|
120
|
-
:
|
120
|
+
:plugin_config,
|
121
121
|
1,
|
122
122
|
plugin_name: 'google_cloud',
|
123
123
|
param: 'autoformat_stackdriver_trace',
|
124
124
|
is_present: true,
|
125
|
-
|
125
|
+
has_default_config: false)
|
126
126
|
assert_metric_value.call(
|
127
|
-
:
|
127
|
+
:plugin_config,
|
128
128
|
1,
|
129
129
|
plugin_name: 'google_cloud',
|
130
130
|
param: 'coerce_to_utf8',
|
131
131
|
is_present: true,
|
132
|
-
|
132
|
+
has_default_config: false)
|
133
133
|
# The remaining "google_cloud" params are not present.
|
134
134
|
# The are no params for "detect_exceptions".
|
135
135
|
%w(
|
@@ -163,29 +163,29 @@ class FilterAnalyzeConfigTest < Test::Unit::TestCase
|
|
163
163
|
zone
|
164
164
|
).each do |p|
|
165
165
|
assert_metric_value.call(
|
166
|
-
:
|
166
|
+
:plugin_config,
|
167
167
|
1,
|
168
168
|
plugin_name: 'google_cloud',
|
169
169
|
param: p,
|
170
170
|
is_present: false,
|
171
|
-
|
171
|
+
has_default_config: false)
|
172
172
|
end
|
173
173
|
|
174
174
|
# We also export values for the bools.
|
175
175
|
assert_metric_value.call(
|
176
|
-
:
|
176
|
+
:config_bool_values,
|
177
177
|
1,
|
178
178
|
plugin_name: 'google_cloud',
|
179
179
|
param: 'adjust_invalid_timestamps',
|
180
180
|
value: true)
|
181
181
|
assert_metric_value.call(
|
182
|
-
:
|
182
|
+
:config_bool_values,
|
183
183
|
1,
|
184
184
|
plugin_name: 'google_cloud',
|
185
185
|
param: 'autoformat_stackdriver_trace',
|
186
186
|
value: false)
|
187
187
|
assert_metric_value.call(
|
188
|
-
:
|
188
|
+
:config_bool_values,
|
189
189
|
1,
|
190
190
|
plugin_name: 'google_cloud',
|
191
191
|
param: 'coerce_to_utf8',
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fluent-plugin-google-cloud
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.10.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stackdriver Agents Team
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-10-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: fluentd
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - '='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 1.
|
19
|
+
version: 1.11.2
|
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
|
-
version: 1.
|
26
|
+
version: 1.11.2
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: googleapis-common-protos
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -100,14 +100,14 @@ dependencies:
|
|
100
100
|
requirements:
|
101
101
|
- - '='
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version: 1.
|
103
|
+
version: 1.31.1
|
104
104
|
type: :runtime
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
108
|
- - '='
|
109
109
|
- !ruby/object:Gem::Version
|
110
|
-
version: 1.
|
110
|
+
version: 1.31.1
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
112
|
name: json
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|