fluent-plugin-google-cloud 0.6.3 → 0.6.4.pre.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -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'
@@ -83,6 +97,11 @@ module Constants
83
97
  DATAFLOW_STEP_ID = 'step_1'
84
98
  DATAFLOW_TAG = 'dataflow.googleapis.com/worker'
85
99
 
100
+ # Dataproc specific labels.
101
+ DATAPROC_CLUSTER_NAME = 'test-cluster'
102
+ DATAPROC_CLUSTER_UUID = '00000000-0000-0000-0000-000000000000'
103
+ DATAPROC_REGION = 'unittest'
104
+
86
105
  # ML specific labels.
87
106
  ML_REGION = 'us-central1'
88
107
  ML_JOB_ID = 'job_name_1'
@@ -135,6 +154,14 @@ module Constants
135
154
  detect_subservice false
136
155
  )
137
156
 
157
+ ENABLE_METADATA_AGENT_CONFIG = %(
158
+ enable_metadata_agent true
159
+ )
160
+
161
+ DISABLE_METADATA_AGENT_CONFIG = %(
162
+ enable_metadata_agent false
163
+ )
164
+
138
165
  CUSTOM_METADATA_CONFIG = %(
139
166
  project_id #{CUSTOM_PROJECT_ID}
140
167
  zone #{CUSTOM_ZONE}
@@ -187,6 +214,8 @@ module Constants
187
214
  )
188
215
 
189
216
  # Service configurations for various services.
217
+
218
+ # GCE.
190
219
  COMPUTE_PARAMS = {
191
220
  resource: {
192
221
  type: COMPUTE_CONSTANTS[:resource_type],
@@ -202,6 +231,7 @@ module Constants
202
231
  }
203
232
  }
204
233
 
234
+ # GAE.
205
235
  VMENGINE_PARAMS = {
206
236
  resource: {
207
237
  type: APPENGINE_CONSTANTS[:resource_type],
@@ -219,6 +249,7 @@ module Constants
219
249
  }
220
250
  }
221
251
 
252
+ # GKE Container.
222
253
  CONTAINER_TAG = "kubernetes.#{CONTAINER_POD_NAME}_" \
223
254
  "#{CONTAINER_NAMESPACE_NAME}_#{CONTAINER_CONTAINER_NAME}"
224
255
 
@@ -271,6 +302,60 @@ module Constants
271
302
  }
272
303
  }
273
304
 
305
+ # Docker Container.
306
+ DOCKER_CONTAINER_TAG = "container.#{DOCKER_CONTAINER_ID}." \
307
+ "#{DOCKER_CONTAINER_NAME}"
308
+ DOCKER_CONTAINER_TAG_WITH_APPLICATION =
309
+ "application-container.#{DOCKER_CONTAINER_NAME}." \
310
+ "#{DOCKER_CONTAINER_APPLICATION_LOG_TAG}"
311
+
312
+ DOCKER_CONTAINER_PARAMS = {
313
+ resource: {
314
+ type: DOCKER_CONSTANTS[:resource_type],
315
+ labels: {
316
+ 'container_id' => DOCKER_CONTAINER_ID,
317
+ 'location' => ZONE
318
+ }
319
+ },
320
+ log_name: "container.#{DOCKER_CONTAINER_ID}.#{DOCKER_CONTAINER_NAME}",
321
+ project_id: PROJECT_ID,
322
+ labels: {
323
+ "#{COMPUTE_CONSTANTS[:service]}/resource_id" => VM_ID,
324
+ "#{COMPUTE_CONSTANTS[:service]}/resource_name" => HOSTNAME,
325
+ "#{DOCKER_CONSTANTS[:service]}/container_name" => DOCKER_CONTAINER_NAME
326
+ }
327
+ }
328
+ DOCKER_CONTAINER_PARAMS_WITH_STREAM_STDOUT = DOCKER_CONTAINER_PARAMS.merge(
329
+ labels: DOCKER_CONTAINER_PARAMS[:labels].merge(
330
+ "#{DOCKER_CONSTANTS[:service]}/stream" => DOCKER_CONTAINER_STREAM_STDOUT
331
+ )
332
+ )
333
+ DOCKER_CONTAINER_PARAMS_WITH_METADATA_OVERWRITTEN = \
334
+ DOCKER_CONTAINER_PARAMS.merge(
335
+ resource: DOCKER_CONTAINER_PARAMS[:resource].merge(
336
+ labels: DOCKER_CONTAINER_PARAMS[:resource][:labels].merge(
337
+ 'container_id' => DOCKER_CONTAINER_ID2
338
+ )
339
+ ),
340
+ labels: DOCKER_CONTAINER_PARAMS[:labels].merge(
341
+ "#{DOCKER_CONSTANTS[:service]}/container_name" =>
342
+ DOCKER_CONTAINER_NAME2,
343
+ "#{DOCKER_CONSTANTS[:service]}/stream" =>
344
+ DOCKER_CONTAINER_STREAM_STDERR
345
+ )
346
+ )
347
+ DOCKER_CONTAINER_PARAMS_WITH_ZONE2 = DOCKER_CONTAINER_PARAMS.merge(
348
+ resource: DOCKER_CONTAINER_PARAMS[:resource].merge(
349
+ labels: DOCKER_CONTAINER_PARAMS[:resource][:labels].merge(
350
+ 'location' => ZONE2
351
+ )
352
+ )
353
+ )
354
+ DOCKER_CONTAINER_WITH_APPLICATION_PARAMS = DOCKER_CONTAINER_PARAMS.merge(
355
+ log_name: DOCKER_CONTAINER_TAG_WITH_APPLICATION
356
+ )
357
+
358
+ # Cloud Functions.
274
359
  CLOUDFUNCTIONS_TAG = "kubernetes.#{CLOUDFUNCTIONS_POD_NAME}_" \
275
360
  "#{CLOUDFUNCTIONS_NAMESPACE_NAME}_" \
276
361
  "#{CLOUDFUNCTIONS_CONTAINER_NAME}"
@@ -316,6 +401,7 @@ module Constants
316
401
  }
317
402
  }
318
403
 
404
+ # Cloud Dataflow.
319
405
  DATAFLOW_PARAMS = {
320
406
  resource: {
321
407
  type: DATAFLOW_CONSTANTS[:resource_type],
@@ -335,6 +421,26 @@ module Constants
335
421
  }
336
422
  }
337
423
 
424
+ # Cloud Dataproc.
425
+ DATAPROC_PARAMS = {
426
+ resource: {
427
+ type: DATAPROC_CONSTANTS[:resource_type],
428
+ labels: {
429
+ 'cluster_name' => DATAPROC_CLUSTER_NAME,
430
+ 'cluster_uuid' => DATAPROC_CLUSTER_UUID,
431
+ 'region' => DATAPROC_REGION
432
+ }
433
+ },
434
+ log_name: 'test',
435
+ project_id: PROJECT_ID,
436
+ labels: {
437
+ "#{COMPUTE_CONSTANTS[:service]}/resource_name" => HOSTNAME,
438
+ "#{COMPUTE_CONSTANTS[:service]}/resource_id" => VM_ID,
439
+ "#{COMPUTE_CONSTANTS[:service]}/zone" => ZONE
440
+ }
441
+ }
442
+
443
+ # Cloud ML.
338
444
  ML_PARAMS = {
339
445
  resource: {
340
446
  type: ML_CONSTANTS[:resource_type],
@@ -421,4 +527,41 @@ module Constants
421
527
  '' => '_'
422
528
  }
423
529
  ALL_TAGS = VALID_TAGS.merge(INVALID_TAGS)
530
+
531
+ # Stub value for Monitored resources from Metadata Agent.
532
+ MONITORED_RESOURCE_STUBS = {
533
+ # Implicit GCE instance.
534
+ IMPLICIT_MONITORED_RESOURCE_UNIQUE_KEY => {
535
+ 'unique_id' => IMPLICIT_MONITORED_RESOURCE_UNIQUE_KEY,
536
+ 'monitored_resource' => '{' \
537
+ "\"type\": \"#{COMPUTE_CONSTANTS[:resource_type]}\"," \
538
+ '"labels": {' \
539
+ "\"zone\": \"#{ZONE}\"," \
540
+ "\"instance_id\": \"#{VM_ID}\"" \
541
+ '}' \
542
+ '}'
543
+ },
544
+ # Docker container stderr / stdout logs.
545
+ DOCKER_CONSTANTS[:resource_type] => {
546
+ 'unique_id' => "container.#{DOCKER_CONTAINER_ID}",
547
+ 'monitored_resource' => '{' \
548
+ "\"type\": \"#{DOCKER_CONSTANTS[:resource_type]}\"," \
549
+ '"labels": {' \
550
+ "\"location\": \"#{ZONE2}\"," \
551
+ "\"container_id\": \"#{DOCKER_CONTAINER_ID}\"" \
552
+ '}' \
553
+ '}'
554
+ },
555
+ # Docker container application logs.
556
+ "#{DOCKER_CONSTANTS[:resource_type]}_application" => {
557
+ 'unique_id' => "containerName.#{DOCKER_CONTAINER_NAME}",
558
+ 'monitored_resource' => '{' \
559
+ "\"type\": \"#{DOCKER_CONSTANTS[:resource_type]}\"," \
560
+ '"labels": {' \
561
+ "\"location\": \"#{ZONE}\"," \
562
+ "\"container_id\": \"#{DOCKER_CONTAINER_ID}\"" \
563
+ '}' \
564
+ '}'
565
+ }
566
+ }
424
567
  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.3
4
+ version: 0.6.4.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-05-30 00:00:00.000000000 Z
12
+ date: 2017-06-22 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.56.0
21
+ type: :runtime
22
+ prerelease: false
23
+ version_requirements: !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - "~>"
26
+ - !ruby/object:Gem::Version
27
+ version: 0.56.0
14
28
  - !ruby/object:Gem::Dependency
15
29
  name: fluentd
16
30
  requirement: !ruby/object:Gem::Requirement
@@ -202,7 +216,6 @@ files:
202
216
  - LICENSE
203
217
  - README.rdoc
204
218
  - Rakefile
205
- - fluent-plugin-google-cloud-0.6.2.gem
206
219
  - fluent-plugin-google-cloud.gemspec
207
220
  - lib/fluent/plugin/out_google_cloud.rb
208
221
  - test/helper.rb
@@ -229,12 +242,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
229
242
  version: '2.0'
230
243
  required_rubygems_version: !ruby/object:Gem::Requirement
231
244
  requirements:
232
- - - ">="
245
+ - - ">"
233
246
  - !ruby/object:Gem::Version
234
- version: '0'
247
+ version: 1.3.1
235
248
  requirements: []
236
249
  rubyforge_project:
237
- rubygems_version: 2.6.12
250
+ rubygems_version: 2.4.8
238
251
  signing_key:
239
252
  specification_version: 4
240
253
  summary: fluentd output plugin for the Stackdriver Logging API