fluent-plugin-google-cloud 0.6.4 → 0.6.5.pre.1
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 -21
- data/fluent-plugin-google-cloud.gemspec +5 -4
- data/lib/fluent/plugin/out_google_cloud.rb +812 -360
- data/test/plugin/base_test.rb +389 -77
- data/test/plugin/constants.rb +163 -0
- metadata +31 -11
data/test/plugin/constants.rb
CHANGED
@@ -23,6 +23,7 @@ module Constants
|
|
23
23
|
# Attributes used for the GCE metadata service.
|
24
24
|
PROJECT_ID = 'test-project-id'
|
25
25
|
ZONE = 'us-central1-b'
|
26
|
+
ZONE2 = 'us-central1-c'
|
26
27
|
FULLY_QUALIFIED_ZONE = 'projects/' + PROJECT_ID + '/zones/' + ZONE
|
27
28
|
VM_ID = '9876543210'
|
28
29
|
|
@@ -51,6 +52,19 @@ module Constants
|
|
51
52
|
MANAGED_VM_BACKEND_NAME = 'default'
|
52
53
|
MANAGED_VM_BACKEND_VERSION = 'guestbook2.0'
|
53
54
|
|
55
|
+
# Docker Container labels.
|
56
|
+
DOCKER_CONTAINER_ID = '0d0f03ff8d3c42688692536d1af77a28cd135c0a5c531f25a31'
|
57
|
+
DOCKER_CONTAINER_ID2 = '42688692536d1af77a28cd135c0a5c531f25a0317d37da427e3'
|
58
|
+
DOCKER_CONTAINER_NAME = 'happy_hippo'
|
59
|
+
DOCKER_CONTAINER_NAME2 = 'sad_panda'
|
60
|
+
DOCKER_CONTAINER_STREAM_STDOUT = 'stdout'
|
61
|
+
DOCKER_CONTAINER_STREAM_STDERR = 'stderr'
|
62
|
+
# Timestamp for 1234567890 seconds and 987654321 nanoseconds since epoch.
|
63
|
+
DOCKER_CONTAINER_TIMESTAMP = '2009-02-13T23:31:30.987654321Z'
|
64
|
+
DOCKER_CONTAINER_SECONDS_EPOCH = 1_234_567_890
|
65
|
+
DOCKER_CONTAINER_NANOS = 987_654_321
|
66
|
+
DOCKER_CONTAINER_APPLICATION_LOG_TAG = 'nginx-access-log'
|
67
|
+
|
54
68
|
# Container Engine / Kubernetes specific labels.
|
55
69
|
CONTAINER_CLUSTER_NAME = 'cluster-1'
|
56
70
|
CONTAINER_NAMESPACE_ID = '898268c8-4a36-11e5-9d81-42010af0194c'
|
@@ -145,6 +159,14 @@ module Constants
|
|
145
159
|
monitoring_type prometheus
|
146
160
|
)
|
147
161
|
|
162
|
+
ENABLE_METADATA_AGENT_CONFIG = %(
|
163
|
+
enable_metadata_agent true
|
164
|
+
)
|
165
|
+
|
166
|
+
DISABLE_METADATA_AGENT_CONFIG = %(
|
167
|
+
enable_metadata_agent false
|
168
|
+
)
|
169
|
+
|
148
170
|
CUSTOM_METADATA_CONFIG = %(
|
149
171
|
project_id #{CUSTOM_PROJECT_ID}
|
150
172
|
zone #{CUSTOM_ZONE}
|
@@ -196,7 +218,17 @@ module Constants
|
|
196
218
|
label_map { "name": "#{ML_CONSTANTS[:service]}/job_id/log_area" }
|
197
219
|
)
|
198
220
|
|
221
|
+
CONFIG_KEEP_TRACE_KEY_TRUE = %(
|
222
|
+
keep_trace_key true
|
223
|
+
)
|
224
|
+
|
225
|
+
CONFIG_CUSTOM_TRACE_KEY_SPECIFIED = %(
|
226
|
+
trace_key custom_trace_key
|
227
|
+
)
|
228
|
+
|
199
229
|
# Service configurations for various services.
|
230
|
+
|
231
|
+
# GCE.
|
200
232
|
COMPUTE_PARAMS = {
|
201
233
|
resource: {
|
202
234
|
type: COMPUTE_CONSTANTS[:resource_type],
|
@@ -212,6 +244,7 @@ module Constants
|
|
212
244
|
}
|
213
245
|
}
|
214
246
|
|
247
|
+
# GAE.
|
215
248
|
VMENGINE_PARAMS = {
|
216
249
|
resource: {
|
217
250
|
type: APPENGINE_CONSTANTS[:resource_type],
|
@@ -229,6 +262,7 @@ module Constants
|
|
229
262
|
}
|
230
263
|
}
|
231
264
|
|
265
|
+
# GKE Container.
|
232
266
|
CONTAINER_TAG = "kubernetes.#{CONTAINER_POD_NAME}_" \
|
233
267
|
"#{CONTAINER_NAMESPACE_NAME}_#{CONTAINER_CONTAINER_NAME}"
|
234
268
|
|
@@ -281,6 +315,79 @@ module Constants
|
|
281
315
|
}
|
282
316
|
}
|
283
317
|
|
318
|
+
CONTAINER_FROM_APPLICATION_PARAMS = {
|
319
|
+
resource: {
|
320
|
+
type: CONTAINER_CONSTANTS[:resource_type],
|
321
|
+
labels: {
|
322
|
+
'cluster_name' => CONTAINER_CLUSTER_NAME,
|
323
|
+
'namespace_id' => CONTAINER_NAMESPACE_ID,
|
324
|
+
'instance_id' => VM_ID,
|
325
|
+
'pod_id' => CONTAINER_POD_ID,
|
326
|
+
'container_name' => CONTAINER_CONTAINER_NAME,
|
327
|
+
'zone' => ZONE
|
328
|
+
}
|
329
|
+
},
|
330
|
+
log_name: 'test',
|
331
|
+
project_id: PROJECT_ID,
|
332
|
+
labels: {
|
333
|
+
"#{COMPUTE_CONSTANTS[:service]}/resource_name" => HOSTNAME
|
334
|
+
}
|
335
|
+
}
|
336
|
+
|
337
|
+
# Docker Container.
|
338
|
+
DOCKER_CONTAINER_TAG = "container.#{DOCKER_CONTAINER_ID}." \
|
339
|
+
"#{DOCKER_CONTAINER_NAME}"
|
340
|
+
DOCKER_CONTAINER_TAG_WITH_APPLICATION =
|
341
|
+
"application-container.#{DOCKER_CONTAINER_NAME}." \
|
342
|
+
"#{DOCKER_CONTAINER_APPLICATION_LOG_TAG}"
|
343
|
+
|
344
|
+
DOCKER_CONTAINER_PARAMS = {
|
345
|
+
resource: {
|
346
|
+
type: DOCKER_CONSTANTS[:resource_type],
|
347
|
+
labels: {
|
348
|
+
'container_id' => DOCKER_CONTAINER_ID,
|
349
|
+
'location' => ZONE
|
350
|
+
}
|
351
|
+
},
|
352
|
+
log_name: "container.#{DOCKER_CONTAINER_ID}.#{DOCKER_CONTAINER_NAME}",
|
353
|
+
project_id: PROJECT_ID,
|
354
|
+
labels: {
|
355
|
+
"#{COMPUTE_CONSTANTS[:service]}/resource_id" => VM_ID,
|
356
|
+
"#{COMPUTE_CONSTANTS[:service]}/resource_name" => HOSTNAME,
|
357
|
+
"#{DOCKER_CONSTANTS[:service]}/container_name" => DOCKER_CONTAINER_NAME
|
358
|
+
}
|
359
|
+
}
|
360
|
+
DOCKER_CONTAINER_PARAMS_WITH_STREAM_STDOUT = DOCKER_CONTAINER_PARAMS.merge(
|
361
|
+
labels: DOCKER_CONTAINER_PARAMS[:labels].merge(
|
362
|
+
"#{DOCKER_CONSTANTS[:service]}/stream" => DOCKER_CONTAINER_STREAM_STDOUT
|
363
|
+
)
|
364
|
+
)
|
365
|
+
DOCKER_CONTAINER_PARAMS_WITH_METADATA_OVERWRITTEN = \
|
366
|
+
DOCKER_CONTAINER_PARAMS.merge(
|
367
|
+
resource: DOCKER_CONTAINER_PARAMS[:resource].merge(
|
368
|
+
labels: DOCKER_CONTAINER_PARAMS[:resource][:labels].merge(
|
369
|
+
'container_id' => DOCKER_CONTAINER_ID2
|
370
|
+
)
|
371
|
+
),
|
372
|
+
labels: DOCKER_CONTAINER_PARAMS[:labels].merge(
|
373
|
+
"#{DOCKER_CONSTANTS[:service]}/container_name" =>
|
374
|
+
DOCKER_CONTAINER_NAME2,
|
375
|
+
"#{DOCKER_CONSTANTS[:service]}/stream" =>
|
376
|
+
DOCKER_CONTAINER_STREAM_STDERR
|
377
|
+
)
|
378
|
+
)
|
379
|
+
DOCKER_CONTAINER_PARAMS_WITH_ZONE2 = DOCKER_CONTAINER_PARAMS.merge(
|
380
|
+
resource: DOCKER_CONTAINER_PARAMS[:resource].merge(
|
381
|
+
labels: DOCKER_CONTAINER_PARAMS[:resource][:labels].merge(
|
382
|
+
'location' => ZONE2
|
383
|
+
)
|
384
|
+
)
|
385
|
+
)
|
386
|
+
DOCKER_CONTAINER_WITH_APPLICATION_PARAMS = DOCKER_CONTAINER_PARAMS.merge(
|
387
|
+
log_name: DOCKER_CONTAINER_TAG_WITH_APPLICATION
|
388
|
+
)
|
389
|
+
|
390
|
+
# Cloud Functions.
|
284
391
|
CLOUDFUNCTIONS_TAG = "kubernetes.#{CLOUDFUNCTIONS_POD_NAME}_" \
|
285
392
|
"#{CLOUDFUNCTIONS_NAMESPACE_NAME}_" \
|
286
393
|
"#{CLOUDFUNCTIONS_CONTAINER_NAME}"
|
@@ -326,6 +433,7 @@ module Constants
|
|
326
433
|
}
|
327
434
|
}
|
328
435
|
|
436
|
+
# Cloud Dataflow.
|
329
437
|
DATAFLOW_PARAMS = {
|
330
438
|
resource: {
|
331
439
|
type: DATAFLOW_CONSTANTS[:resource_type],
|
@@ -345,6 +453,7 @@ module Constants
|
|
345
453
|
}
|
346
454
|
}
|
347
455
|
|
456
|
+
# Cloud Dataproc.
|
348
457
|
DATAPROC_PARAMS = {
|
349
458
|
resource: {
|
350
459
|
type: DATAPROC_CONSTANTS[:resource_type],
|
@@ -363,6 +472,7 @@ module Constants
|
|
363
472
|
}
|
364
473
|
}
|
365
474
|
|
475
|
+
# Cloud ML.
|
366
476
|
ML_PARAMS = {
|
367
477
|
resource: {
|
368
478
|
type: ML_CONSTANTS[:resource_type],
|
@@ -449,4 +559,57 @@ module Constants
|
|
449
559
|
'' => '_'
|
450
560
|
}
|
451
561
|
ALL_TAGS = VALID_TAGS.merge(INVALID_TAGS)
|
562
|
+
|
563
|
+
# Stub value for Monitored resources from Metadata Agent.
|
564
|
+
MONITORED_RESOURCE_STUBS = {
|
565
|
+
# Implicit GCE instance.
|
566
|
+
IMPLICIT_MONITORED_RESOURCE_UNIQUE_KEY => {
|
567
|
+
'unique_id' => IMPLICIT_MONITORED_RESOURCE_UNIQUE_KEY,
|
568
|
+
'monitored_resource' => '{' \
|
569
|
+
"\"type\": \"#{COMPUTE_CONSTANTS[:resource_type]}\"," \
|
570
|
+
'"labels": {' \
|
571
|
+
"\"zone\": \"#{ZONE}\"," \
|
572
|
+
"\"instance_id\": \"#{VM_ID}\"" \
|
573
|
+
'}' \
|
574
|
+
'}'
|
575
|
+
},
|
576
|
+
# Docker container stderr / stdout logs.
|
577
|
+
DOCKER_CONSTANTS[:resource_type] => {
|
578
|
+
'unique_id' => "container.#{DOCKER_CONTAINER_ID}",
|
579
|
+
'monitored_resource' => '{' \
|
580
|
+
"\"type\": \"#{DOCKER_CONSTANTS[:resource_type]}\"," \
|
581
|
+
'"labels": {' \
|
582
|
+
"\"location\": \"#{ZONE2}\"," \
|
583
|
+
"\"container_id\": \"#{DOCKER_CONTAINER_ID}\"" \
|
584
|
+
'}' \
|
585
|
+
'}'
|
586
|
+
},
|
587
|
+
# Docker container application logs.
|
588
|
+
"#{DOCKER_CONSTANTS[:resource_type]}_application" => {
|
589
|
+
'unique_id' => "containerName.#{DOCKER_CONTAINER_NAME}",
|
590
|
+
'monitored_resource' => '{' \
|
591
|
+
"\"type\": \"#{DOCKER_CONSTANTS[:resource_type]}\"," \
|
592
|
+
'"labels": {' \
|
593
|
+
"\"location\": \"#{ZONE}\"," \
|
594
|
+
"\"container_id\": \"#{DOCKER_CONTAINER_ID}\"" \
|
595
|
+
'}' \
|
596
|
+
'}'
|
597
|
+
},
|
598
|
+
# GKE container application logs.
|
599
|
+
"#{CONTAINER_CONSTANTS[:resource_type]}_application" => {
|
600
|
+
'unique_id' => "gke_containerName.#{CONTAINER_NAMESPACE_ID}" \
|
601
|
+
".#{CONTAINER_POD_NAME}.#{CONTAINER_CONTAINER_NAME}",
|
602
|
+
'monitored_resource' => '{' \
|
603
|
+
"\"type\": \"#{CONTAINER_CONSTANTS[:resource_type]}\"," \
|
604
|
+
'"labels": {' \
|
605
|
+
"\"cluster_name\": \"#{CONTAINER_CLUSTER_NAME}\"," \
|
606
|
+
"\"container_name\": \"#{CONTAINER_CONTAINER_NAME}\"," \
|
607
|
+
"\"instance_id\": \"#{VM_ID}\"," \
|
608
|
+
"\"namespace_id\": \"#{CONTAINER_NAMESPACE_ID}\"," \
|
609
|
+
"\"pod_id\": \"#{CONTAINER_POD_ID}\"," \
|
610
|
+
"\"zone\": \"#{ZONE}\"" \
|
611
|
+
'}' \
|
612
|
+
'}'
|
613
|
+
}
|
614
|
+
}
|
452
615
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fluent-plugin-google-cloud
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.5.pre.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Todd Derr
|
@@ -9,8 +9,22 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2017-
|
12
|
+
date: 2017-08-11 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: excon
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
requirements:
|
18
|
+
- - "~>"
|
19
|
+
- !ruby/object:Gem::Version
|
20
|
+
version: 0.57.1
|
21
|
+
type: :runtime
|
22
|
+
prerelease: false
|
23
|
+
version_requirements: !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - "~>"
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
version: 0.57.1
|
14
28
|
- !ruby/object:Gem::Dependency
|
15
29
|
name: fluentd
|
16
30
|
requirement: !ruby/object:Gem::Requirement
|
@@ -57,16 +71,16 @@ dependencies:
|
|
57
71
|
name: google-cloud-logging
|
58
72
|
requirement: !ruby/object:Gem::Requirement
|
59
73
|
requirements:
|
60
|
-
- -
|
74
|
+
- - '='
|
61
75
|
- !ruby/object:Gem::Version
|
62
|
-
version: 0.
|
76
|
+
version: 0.24.1
|
63
77
|
type: :runtime
|
64
78
|
prerelease: false
|
65
79
|
version_requirements: !ruby/object:Gem::Requirement
|
66
80
|
requirements:
|
67
|
-
- -
|
81
|
+
- - '='
|
68
82
|
- !ruby/object:Gem::Version
|
69
|
-
version: 0.
|
83
|
+
version: 0.24.1
|
70
84
|
- !ruby/object:Gem::Dependency
|
71
85
|
name: googleauth
|
72
86
|
requirement: !ruby/object:Gem::Requirement
|
@@ -74,6 +88,9 @@ dependencies:
|
|
74
88
|
- - "~>"
|
75
89
|
- !ruby/object:Gem::Version
|
76
90
|
version: '0.4'
|
91
|
+
- - "<"
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: 0.5.2
|
77
94
|
type: :runtime
|
78
95
|
prerelease: false
|
79
96
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -81,6 +98,9 @@ dependencies:
|
|
81
98
|
- - "~>"
|
82
99
|
- !ruby/object:Gem::Version
|
83
100
|
version: '0.4'
|
101
|
+
- - "<"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: 0.5.2
|
84
104
|
- !ruby/object:Gem::Dependency
|
85
105
|
name: grpc
|
86
106
|
requirement: !ruby/object:Gem::Requirement
|
@@ -163,14 +183,14 @@ dependencies:
|
|
163
183
|
requirements:
|
164
184
|
- - "~>"
|
165
185
|
- !ruby/object:Gem::Version
|
166
|
-
version:
|
186
|
+
version: 2.3.1
|
167
187
|
type: :development
|
168
188
|
prerelease: false
|
169
189
|
version_requirements: !ruby/object:Gem::Requirement
|
170
190
|
requirements:
|
171
191
|
- - "~>"
|
172
192
|
- !ruby/object:Gem::Version
|
173
|
-
version:
|
193
|
+
version: 2.3.1
|
174
194
|
- !ruby/object:Gem::Dependency
|
175
195
|
name: test-unit
|
176
196
|
requirement: !ruby/object:Gem::Requirement
|
@@ -243,12 +263,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
243
263
|
version: '2.0'
|
244
264
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
245
265
|
requirements:
|
246
|
-
- - "
|
266
|
+
- - ">"
|
247
267
|
- !ruby/object:Gem::Version
|
248
|
-
version:
|
268
|
+
version: 1.3.1
|
249
269
|
requirements: []
|
250
270
|
rubyforge_project:
|
251
|
-
rubygems_version: 2.
|
271
|
+
rubygems_version: 2.4.8
|
252
272
|
signing_key:
|
253
273
|
specification_version: 4
|
254
274
|
summary: fluentd output plugin for the Stackdriver Logging API
|