fluent-plugin-google-cloud 0.4.6 → 0.4.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ef4989cf52201417aaa16cd77abc9680b55ddab7
4
- data.tar.gz: 4c313c6fbe55b6c17c2eaec8b5c756c947135cab
3
+ metadata.gz: 494526c8a4880080e9176ccd912a4692d773fb67
4
+ data.tar.gz: 008470c8bc3aeab7f902bfd159e030b2dbfafee1
5
5
  SHA512:
6
- metadata.gz: f50bd833b6b65548f439a5493f802fe99b266479d077a68abc4fec52e1f04b6223967344eabed170eb1a846525a5ab16e0dbc3b60df6638eaafa1f172c1c76e1
7
- data.tar.gz: 4744b04e0a82268535afc934cf2c3a8af71b409fe9ca45f2b4f88f6777e1e80d72e65860ac7a48288c58809120dab1715cbd46287609a4832eea4f68d0287cd8
6
+ metadata.gz: aaabfa2e76c33959ab2d68c21380d73ce1e315bef2556fdd99b9772fc9cdb33c0d7ea8632a3742f17a9641e44c5e45914eab1ba49ebf035cd02f324ab0984a81
7
+ data.tar.gz: c86c292744824fd8163e08daaefbd034baaaf91ca1c422b68caed7ab3835578070a694c59dbc1cc5adb85c55cf87eadfefbca28cae1b801f8543bdf70426c70a
@@ -10,7 +10,7 @@ PATH
10
10
  GEM
11
11
  remote: https://rubygems.org/
12
12
  specs:
13
- activesupport (4.2.3)
13
+ activesupport (4.2.4)
14
14
  i18n (~> 0.7)
15
15
  json (~> 1.7, >= 1.7.7)
16
16
  minitest (~> 5.1)
@@ -24,7 +24,7 @@ GEM
24
24
  addressable (>= 2.3.1)
25
25
  extlib (>= 0.9.15)
26
26
  multi_json (>= 1.0.0)
27
- cool.io (1.3.1)
27
+ cool.io (1.4.0)
28
28
  crack (0.4.2)
29
29
  safe_yaml (~> 1.0.0)
30
30
  extlib (0.9.16)
@@ -64,7 +64,7 @@ GEM
64
64
  jwt (1.5.1)
65
65
  launchy (2.4.3)
66
66
  addressable (~> 2.3)
67
- little-plugger (1.1.3)
67
+ little-plugger (1.1.4)
68
68
  logging (2.0.0)
69
69
  little-plugger (~> 1.1)
70
70
  multi_json (~> 1.10)
@@ -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.4.6'
13
+ gem.version = '0.4.7'
14
14
  gem.authors = ['Todd Derr', 'Alex Robinson']
15
15
  gem.email = ['salty@google.com']
16
16
 
@@ -62,6 +62,14 @@ module Fluent
62
62
  config_param :vm_id, :string, :default => nil
63
63
  config_param :vm_name, :string, :default => nil
64
64
 
65
+ # Whether to try to detect of the VM is owned by a "subservice" such as App
66
+ # Engine of Kubernetes, rather than just associating the logs with the
67
+ # compute service of the platform. This currently only has any effect when
68
+ # running on GCE.
69
+ # The initial motivation for this is to separate out Kubernetes node
70
+ # component (Docker, Kubelet, etc.) logs from container logs.
71
+ config_param :detect_subservice, :bool, :default => true
72
+
65
73
  # label_map (specified as a JSON object) is an unordered set of fluent
66
74
  # field names whose values are sent as labels rather than as part of the
67
75
  # struct payload.
@@ -186,34 +194,37 @@ module Fluent
186
194
  case @platform
187
195
  when Platform::GCE
188
196
  @service_name = COMPUTE_SERVICE
189
- # Check for specialized GCE environments (Managed VM or Dataflow).
190
- # TODO: Add config options for these to allow for running outside GCE?
191
- attributes = fetch_gce_metadata('instance/attributes/').split
192
- if attributes.include?('gae_backend_name') &&
193
- attributes.include?('gae_backend_version')
194
- # Managed VM
195
- @running_on_managed_vm = true
196
- @gae_backend_name =
197
- fetch_gce_metadata('instance/attributes/gae_backend_name')
198
- @gae_backend_version =
199
- fetch_gce_metadata('instance/attributes/gae_backend_version')
200
- @service_name = APPENGINE_SERVICE
201
- common_labels["#{APPENGINE_SERVICE}/module_id"] = @gae_backend_name
202
- common_labels["#{APPENGINE_SERVICE}/version_id"] =
203
- @gae_backend_version
204
- elsif attributes.include?('job_id')
205
- # Dataflow
206
- @service_name = DATAFLOW_SERVICE
207
- @dataflow_job_id = fetch_gce_metadata('instance/attributes/job_id')
208
- common_labels["#{DATAFLOW_SERVICE}/job_id"] = @dataflow_job_id
209
- elsif attributes.include?('kube-env')
210
- # Kubernetes/Container Engine
211
- @service_name = CONTAINER_SERVICE
212
- common_labels["#{CONTAINER_SERVICE}/instance_id"] = @vm_id
213
- @raw_kube_env = fetch_gce_metadata('instance/attributes/kube-env')
214
- @kube_env = YAML.load(@raw_kube_env)
215
- common_labels["#{CONTAINER_SERVICE}/cluster_name"] =
216
- cluster_name_from_kube_env(@kube_env)
197
+ if @detect_subservice
198
+ # Check for specialized GCE environments (Managed VM or Dataflow).
199
+ # TODO: Add config options for these to allow for running outside GCE?
200
+ attributes = fetch_gce_metadata('instance/attributes/').split
201
+ # Do nothing, just don't populate other service's labels.
202
+ if attributes.include?('gae_backend_name') &&
203
+ attributes.include?('gae_backend_version')
204
+ # Managed VM
205
+ @running_on_managed_vm = true
206
+ @gae_backend_name =
207
+ fetch_gce_metadata('instance/attributes/gae_backend_name')
208
+ @gae_backend_version =
209
+ fetch_gce_metadata('instance/attributes/gae_backend_version')
210
+ @service_name = APPENGINE_SERVICE
211
+ common_labels["#{APPENGINE_SERVICE}/module_id"] = @gae_backend_name
212
+ common_labels["#{APPENGINE_SERVICE}/version_id"] =
213
+ @gae_backend_version
214
+ elsif attributes.include?('job_id')
215
+ # Dataflow
216
+ @service_name = DATAFLOW_SERVICE
217
+ @dataflow_job_id = fetch_gce_metadata('instance/attributes/job_id')
218
+ common_labels["#{DATAFLOW_SERVICE}/job_id"] = @dataflow_job_id
219
+ elsif attributes.include?('kube-env')
220
+ # Kubernetes/Container Engine
221
+ @service_name = CONTAINER_SERVICE
222
+ common_labels["#{CONTAINER_SERVICE}/instance_id"] = @vm_id
223
+ @raw_kube_env = fetch_gce_metadata('instance/attributes/kube-env')
224
+ @kube_env = YAML.load(@raw_kube_env)
225
+ common_labels["#{CONTAINER_SERVICE}/cluster_name"] =
226
+ cluster_name_from_kube_env(@kube_env)
227
+ end
217
228
  end
218
229
  common_labels["#{COMPUTE_SERVICE}/resource_type"] = 'instance'
219
230
  common_labels["#{COMPUTE_SERVICE}/resource_id"] = @vm_id
@@ -569,7 +580,7 @@ module Fluent
569
580
  def init_api_client
570
581
  @client = Google::APIClient.new(
571
582
  application_name: 'Fluentd Google Cloud Logging plugin',
572
- application_version: '0.4.6',
583
+ application_version: '0.4.7',
573
584
  retries: 1)
574
585
 
575
586
  if @auth_method == 'private_key'
@@ -88,6 +88,10 @@ class GoogleCloudOutputTest < Test::Unit::TestCase
88
88
  use_metadata_service false
89
89
  )
90
90
 
91
+ NO_DETECT_SUBSERVICE_CONFIG = %(
92
+ detect_subservice false
93
+ )
94
+
91
95
  CUSTOM_METADATA_CONFIG = %(
92
96
  project_id #{CUSTOM_PROJECT_ID}
93
97
  zone #{CUSTOM_ZONE}
@@ -358,6 +362,16 @@ class GoogleCloudOutputTest < Test::Unit::TestCase
358
362
  assert_equal false, d.instance.running_on_managed_vm
359
363
  end
360
364
 
365
+ def test_gce_used_when_detect_subservice_is_false
366
+ setup_gce_metadata_stubs
367
+ # This would cause the service to be container.googleapis.com if not for the
368
+ # detect_subservice=false config.
369
+ setup_container_metadata_stubs
370
+ d = create_driver(NO_DETECT_SUBSERVICE_CONFIG)
371
+ d.run
372
+ assert_equal COMPUTE_SERVICE_NAME, d.instance.service_name
373
+ end
374
+
361
375
  def test_metadata_overrides_on_gce
362
376
  # In this case we are overriding all configured parameters so we should
363
377
  # see all "custom" values rather than the ones from the metadata server.
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.4.6
4
+ version: 0.4.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Todd Derr
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-09-11 00:00:00.000000000 Z
12
+ date: 2015-09-15 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: fluentd