fluent-plugin-google-cloud 0.4.4 → 0.4.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 66d74a0b5f7bb8a69f0b229fab8db399efe33a5e
4
+ data.tar.gz: fa1f657fbbe617ab9ef5159c1577caba6f09b44f
5
+ SHA512:
6
+ metadata.gz: 0091443b2d9a27ad9cde62f200d0c11d2ded76633ac126649680a5eb1b54bc914b19bc8148ec6fb3af083e4889c652e0f7f56289dff09cec4eb77ba56d22eaa2
7
+ data.tar.gz: c35ee5aa129a3420e83e17d753573c1c6a64fce215d6a783a692efe26f33c91516f8ad2cff2a6104827bf89e642df306bff7980671b513f6b80ebc9952fb8b60
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- fluent-plugin-google-cloud (0.4.4)
4
+ fluent-plugin-google-cloud (0.4.5)
5
5
  fluentd (>= 0.10)
6
6
  google-api-client (~> 0.8.6)
7
7
  googleauth (~> 0.4)
@@ -17,7 +17,7 @@ GEM
17
17
  thread_safe (~> 0.3, >= 0.3.4)
18
18
  tzinfo (~> 1.1)
19
19
  addressable (2.3.8)
20
- ast (2.0.0)
20
+ ast (2.1.0)
21
21
  astrolabe (1.3.1)
22
22
  parser (~> 2.2)
23
23
  autoparse (0.3.3)
@@ -30,7 +30,7 @@ GEM
30
30
  extlib (0.9.16)
31
31
  faraday (0.9.1)
32
32
  multipart-post (>= 1.2, < 3)
33
- fluentd (0.12.14)
33
+ fluentd (0.12.15)
34
34
  cool.io (>= 1.2.2, < 2.0.0)
35
35
  http_parser.rb (>= 0.5.1, < 0.7.0)
36
36
  json (>= 1.4.3)
@@ -51,12 +51,12 @@ GEM
51
51
  multi_json (~> 1.10)
52
52
  retriable (~> 1.4)
53
53
  signet (~> 0.6)
54
- googleauth (0.4.1)
54
+ googleauth (0.4.2)
55
55
  faraday (~> 0.9)
56
56
  jwt (~> 1.4)
57
57
  logging (~> 2.0)
58
58
  memoist (~> 0.12)
59
- multi_json (= 1.11)
59
+ multi_json (~> 1.11)
60
60
  signet (~> 0.6)
61
61
  http_parser.rb (0.6.0)
62
62
  i18n (0.7.0)
@@ -70,11 +70,11 @@ GEM
70
70
  multi_json (~> 1.10)
71
71
  memoist (0.12.0)
72
72
  metaclass (0.0.4)
73
- minitest (5.7.0)
73
+ minitest (5.8.0)
74
74
  mocha (1.1.0)
75
75
  metaclass (~> 0.0.1)
76
76
  msgpack (0.5.12)
77
- multi_json (1.11.0)
77
+ multi_json (1.11.2)
78
78
  multipart-post (2.0.0)
79
79
  parser (2.2.2.6)
80
80
  ast (>= 1.1, < 3.0)
@@ -83,7 +83,7 @@ GEM
83
83
  rainbow (2.0.0)
84
84
  rake (10.4.2)
85
85
  retriable (1.4.1)
86
- rubocop (0.32.1)
86
+ rubocop (0.33.0)
87
87
  astrolabe (~> 1.3)
88
88
  parser (>= 2.2.2.5, < 3.0)
89
89
  powerpack (~> 0.1)
@@ -104,7 +104,7 @@ GEM
104
104
  thread_safe (0.3.5)
105
105
  tzinfo (1.2.2)
106
106
  thread_safe (~> 0.1)
107
- tzinfo-data (1.2015.5)
107
+ tzinfo-data (1.2015.6)
108
108
  tzinfo (>= 1.0.0)
109
109
  webmock (1.21.0)
110
110
  addressable (>= 2.3.6)
@@ -118,9 +118,9 @@ DEPENDENCIES
118
118
  fluent-plugin-google-cloud!
119
119
  mocha (~> 1.1)
120
120
  rake (>= 10.3.2)
121
- rubocop (~> 0.30)
121
+ rubocop (~> 0.33.0)
122
122
  test-unit (~> 3.0.2)
123
123
  webmock (>= 1.17.0)
124
124
 
125
125
  BUNDLED WITH
126
- 1.10.5
126
+ 1.10.6
@@ -8,7 +8,7 @@ which sends logs to the
8
8
  This is an official Google Ruby gem.
9
9
 
10
10
  {<img src="https://badge.fury.io/rb/fluent-plugin-google-cloud.svg" alt="Gem Version" />}[http://badge.fury.io/rb/fluent-plugin-google-cloud]
11
- {<img src="https://secure.travis-ci.org/google/google-auth-library-ruby.png" alt="Build Status" />}[https://travis-ci.org/GoogleCloudPlatform/fluent-plugin-google-cloud]
11
+ {<img src="https://secure.travis-ci.org/GoogleCloudPlatform/fluent-plugin-google-cloud.png" alt="Build Status" />}[https://travis-ci.org/GoogleCloudPlatform/fluent-plugin-google-cloud]
12
12
 
13
13
  == Installation
14
14
 
data/Rakefile CHANGED
@@ -16,7 +16,7 @@ Rake::TestTask.new(:test) do |test|
16
16
  test.verbose = true
17
17
  end
18
18
 
19
- desc 'Does rubocop lint and runs tests'
20
- task all: [:rubocop, :test]
19
+ desc 'Run unit tests and RuboCop to check for style violations'
20
+ task all: [:test, :rubocop]
21
21
 
22
22
  task default: :all
@@ -2,15 +2,15 @@ Gem::Specification.new do |gem|
2
2
  gem.name = 'fluent-plugin-google-cloud'
3
3
  gem.description = <<-eos
4
4
  Fluentd output plugin for the Google Cloud Logging API, which will make
5
- loge viewable in the Developer Console's log viewer and can optionally
5
+ logs viewable in the Developer Console's log viewer and can optionally
6
6
  store them in Google Cloud Storage and/or BigQuery.
7
- This is an official Google Ruby gem.'
7
+ This is an official Google Ruby gem.
8
8
  eos
9
- gem.summary = 'fluentd output plugin for the Google Cloud Logging API'
9
+ gem.summary = 'fluentd output plugin for the Google Cloud Logging API'
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.4'
13
+ gem.version = '0.4.5'
14
14
  gem.authors = ['Todd Derr', 'Alex Robinson']
15
15
  gem.email = ['salty@google.com']
16
16
 
@@ -25,7 +25,7 @@ eos
25
25
 
26
26
  gem.add_development_dependency 'mocha', '~> 1.1'
27
27
  gem.add_development_dependency 'rake', '>= 10.3.2'
28
- gem.add_development_dependency 'rubocop', '~> 0.30'
28
+ gem.add_development_dependency 'rubocop', '~> 0.33.0'
29
29
  gem.add_development_dependency 'webmock', '>= 1.17.0'
30
30
  gem.add_development_dependency 'test-unit', '~> 3.0.2'
31
31
  end
@@ -57,6 +57,7 @@ module Fluent
57
57
  config_param :project_id, :string, :default => nil
58
58
  config_param :zone, :string, :default => nil
59
59
  config_param :vm_id, :string, :default => nil
60
+ config_param :vm_name, :string, :default => nil
60
61
 
61
62
  # label_map (specified as a JSON object) is an unordered set of fluent
62
63
  # field names whose values are sent as labels rather than as part of the
@@ -101,6 +102,7 @@ module Fluent
101
102
  require 'googleauth'
102
103
  require 'json'
103
104
  require 'open-uri'
105
+ require 'socket'
104
106
 
105
107
  # use the global logger
106
108
  @log = $log # rubocop:disable Style/GlobalVars
@@ -130,6 +132,7 @@ module Fluent
130
132
  @common_labels = {}
131
133
 
132
134
  # set attributes from metadata (unless overriden by static config)
135
+ @vm_name = Socket.gethostname if @vm_name.nil?
133
136
  @platform = detect_platform
134
137
  case @platform
135
138
  when Platform::GCE
@@ -203,16 +206,19 @@ module Fluent
203
206
  if (@service_name != DATAFLOW_SERVICE)
204
207
  common_labels["#{COMPUTE_SERVICE}/resource_type"] = 'instance'
205
208
  common_labels["#{COMPUTE_SERVICE}/resource_id"] = @vm_id
209
+ common_labels["#{COMPUTE_SERVICE}/resource_name"] = @vm_name
206
210
  end
207
211
  when Platform::EC2
208
212
  @service_name = EC2_SERVICE
209
213
  common_labels["#{EC2_SERVICE}/resource_type"] = 'instance'
210
214
  common_labels["#{EC2_SERVICE}/resource_id"] = @vm_id
215
+ common_labels["#{EC2_SERVICE}/resource_name"] = @vm_name
211
216
  when Platform::OTHER
212
217
  # Use COMPUTE_SERVICE as the default environment.
213
218
  @service_name = COMPUTE_SERVICE
214
219
  common_labels["#{COMPUTE_SERVICE}/resource_type"] = 'instance'
215
220
  common_labels["#{COMPUTE_SERVICE}/resource_id"] = @vm_id
221
+ common_labels["#{COMPUTE_SERVICE}/resource_name"] = @vm_name
216
222
  end
217
223
  end
218
224
 
@@ -497,7 +503,7 @@ module Fluent
497
503
  def init_api_client
498
504
  @client = Google::APIClient.new(
499
505
  application_name: 'Fluentd Google Cloud Logging plugin',
500
- application_version: '0.4.4',
506
+ application_version: '0.4.5',
501
507
  retries: 1)
502
508
 
503
509
  if @auth_method == 'private_key'
@@ -506,7 +512,7 @@ module Fluent
506
512
  jwt_asserter = Google::APIClient::JWTAsserter.new(
507
513
  @private_key_email, LOGGING_SCOPE, key)
508
514
  @client.authorization = jwt_asserter.to_authorization
509
- @client.authorization.expiry = 3600 # 3600s is the max allowed value
515
+ @client.authorization.expiry = 3600 # 3600s is the max allowed value
510
516
  else
511
517
  @client.authorization = Google::Auth.get_application_default(
512
518
  LOGGING_SCOPE)
@@ -17,9 +17,6 @@ require 'json'
17
17
  require 'mocha/test_unit'
18
18
  require 'webmock/test_unit'
19
19
 
20
- # This trips for many tests due to the use of conditionals.
21
- # rubocop:disable Metrics/AbcSize
22
-
23
20
  # Unit tests for Google Cloud Logging plugin
24
21
  class GoogleCloudOutputTest < Test::Unit::TestCase
25
22
  def setup
@@ -29,6 +26,9 @@ class GoogleCloudOutputTest < Test::Unit::TestCase
29
26
  @logs_sent = []
30
27
  end
31
28
 
29
+ # generic attributes
30
+ HOSTNAME = Socket.gethostname
31
+
32
32
  # attributes used for the GCE metadata service
33
33
  PROJECT_ID = 'test-project-id'
34
34
  ZONE = 'us-central1-b'
@@ -40,6 +40,7 @@ class GoogleCloudOutputTest < Test::Unit::TestCase
40
40
  CUSTOM_ZONE = 'us-custom-central1-b'
41
41
  CUSTOM_FULLY_QUALIFIED_ZONE = 'projects/' + PROJECT_ID + '/zones/' + ZONE
42
42
  CUSTOM_VM_ID = 'C9876543210'
43
+ CUSTOM_HOSTNAME = 'custom.hostname.org'
43
44
 
44
45
  # attributes used for the EC2 metadata service
45
46
  EC2_PROJECT_ID = 'test-ec2-project-id'
@@ -83,6 +84,7 @@ class GoogleCloudOutputTest < Test::Unit::TestCase
83
84
  project_id #{CUSTOM_PROJECT_ID}
84
85
  zone #{CUSTOM_ZONE}
85
86
  vm_id #{CUSTOM_VM_ID}
87
+ vm_name #{CUSTOM_HOSTNAME}
86
88
  )
87
89
 
88
90
  CONFIG_MISSING_PRIVATE_KEY_PATH = %(
@@ -129,7 +131,8 @@ class GoogleCloudOutputTest < Test::Unit::TestCase
129
131
  'zone' => ZONE,
130
132
  'labels' => {
131
133
  "#{COMPUTE_SERVICE_NAME}/resource_type" => 'instance',
132
- "#{COMPUTE_SERVICE_NAME}/resource_id" => VM_ID
134
+ "#{COMPUTE_SERVICE_NAME}/resource_id" => VM_ID,
135
+ "#{COMPUTE_SERVICE_NAME}/resource_name" => HOSTNAME
133
136
  }
134
137
  }
135
138
 
@@ -142,7 +145,8 @@ class GoogleCloudOutputTest < Test::Unit::TestCase
142
145
  "#{APPENGINE_SERVICE_NAME}/module_id" => MANAGED_VM_BACKEND_NAME,
143
146
  "#{APPENGINE_SERVICE_NAME}/version_id" => MANAGED_VM_BACKEND_VERSION,
144
147
  "#{COMPUTE_SERVICE_NAME}/resource_type" => 'instance',
145
- "#{COMPUTE_SERVICE_NAME}/resource_id" => VM_ID
148
+ "#{COMPUTE_SERVICE_NAME}/resource_id" => VM_ID,
149
+ "#{COMPUTE_SERVICE_NAME}/resource_name" => HOSTNAME
146
150
  }
147
151
  }
148
152
 
@@ -153,7 +157,8 @@ class GoogleCloudOutputTest < Test::Unit::TestCase
153
157
  'zone' => CUSTOM_ZONE,
154
158
  'labels' => {
155
159
  "#{COMPUTE_SERVICE_NAME}/resource_type" => 'instance',
156
- "#{COMPUTE_SERVICE_NAME}/resource_id" => CUSTOM_VM_ID
160
+ "#{COMPUTE_SERVICE_NAME}/resource_id" => CUSTOM_VM_ID,
161
+ "#{COMPUTE_SERVICE_NAME}/resource_name" => CUSTOM_HOSTNAME
157
162
  }
158
163
  }
159
164
 
@@ -165,7 +170,8 @@ class GoogleCloudOutputTest < Test::Unit::TestCase
165
170
  'labels' => {
166
171
  "#{EC2_SERVICE_NAME}/resource_type" => 'instance',
167
172
  "#{EC2_SERVICE_NAME}/resource_id" => EC2_VM_ID,
168
- "#{EC2_SERVICE_NAME}/account_id" => EC2_ACCOUNT_ID
173
+ "#{EC2_SERVICE_NAME}/account_id" => EC2_ACCOUNT_ID,
174
+ "#{EC2_SERVICE_NAME}/resource_name" => HOSTNAME
169
175
  }
170
176
  }
171
177
 
metadata CHANGED
@@ -1,8 +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.4
5
- prerelease:
4
+ version: 0.4.5
6
5
  platform: ruby
7
6
  authors:
8
7
  - Todd Derr
@@ -10,199 +9,181 @@ authors:
10
9
  autorequire:
11
10
  bindir: bin
12
11
  cert_chain: []
13
- date: 2015-08-05 00:00:00.000000000 Z
12
+ date: 2015-08-17 00:00:00.000000000 Z
14
13
  dependencies:
15
14
  - !ruby/object:Gem::Dependency
16
15
  name: fluentd
17
16
  requirement: !ruby/object:Gem::Requirement
18
- none: false
19
17
  requirements:
20
- - - ! '>='
18
+ - - ">="
21
19
  - !ruby/object:Gem::Version
22
20
  version: '0.10'
23
21
  type: :runtime
24
22
  prerelease: false
25
23
  version_requirements: !ruby/object:Gem::Requirement
26
- none: false
27
24
  requirements:
28
- - - ! '>='
25
+ - - ">="
29
26
  - !ruby/object:Gem::Version
30
27
  version: '0.10'
31
28
  - !ruby/object:Gem::Dependency
32
29
  name: google-api-client
33
30
  requirement: !ruby/object:Gem::Requirement
34
- none: false
35
31
  requirements:
36
- - - ~>
32
+ - - "~>"
37
33
  - !ruby/object:Gem::Version
38
34
  version: 0.8.6
39
35
  type: :runtime
40
36
  prerelease: false
41
37
  version_requirements: !ruby/object:Gem::Requirement
42
- none: false
43
38
  requirements:
44
- - - ~>
39
+ - - "~>"
45
40
  - !ruby/object:Gem::Version
46
41
  version: 0.8.6
47
42
  - !ruby/object:Gem::Dependency
48
43
  name: googleauth
49
44
  requirement: !ruby/object:Gem::Requirement
50
- none: false
51
45
  requirements:
52
- - - ~>
46
+ - - "~>"
53
47
  - !ruby/object:Gem::Version
54
48
  version: '0.4'
55
49
  type: :runtime
56
50
  prerelease: false
57
51
  version_requirements: !ruby/object:Gem::Requirement
58
- none: false
59
52
  requirements:
60
- - - ~>
53
+ - - "~>"
61
54
  - !ruby/object:Gem::Version
62
55
  version: '0.4'
63
56
  - !ruby/object:Gem::Dependency
64
57
  name: json
65
58
  requirement: !ruby/object:Gem::Requirement
66
- none: false
67
59
  requirements:
68
- - - ~>
60
+ - - "~>"
69
61
  - !ruby/object:Gem::Version
70
62
  version: 1.8.2
71
63
  type: :runtime
72
64
  prerelease: false
73
65
  version_requirements: !ruby/object:Gem::Requirement
74
- none: false
75
66
  requirements:
76
- - - ~>
67
+ - - "~>"
77
68
  - !ruby/object:Gem::Version
78
69
  version: 1.8.2
79
70
  - !ruby/object:Gem::Dependency
80
71
  name: mocha
81
72
  requirement: !ruby/object:Gem::Requirement
82
- none: false
83
73
  requirements:
84
- - - ~>
74
+ - - "~>"
85
75
  - !ruby/object:Gem::Version
86
76
  version: '1.1'
87
77
  type: :development
88
78
  prerelease: false
89
79
  version_requirements: !ruby/object:Gem::Requirement
90
- none: false
91
80
  requirements:
92
- - - ~>
81
+ - - "~>"
93
82
  - !ruby/object:Gem::Version
94
83
  version: '1.1'
95
84
  - !ruby/object:Gem::Dependency
96
85
  name: rake
97
86
  requirement: !ruby/object:Gem::Requirement
98
- none: false
99
87
  requirements:
100
- - - ! '>='
88
+ - - ">="
101
89
  - !ruby/object:Gem::Version
102
90
  version: 10.3.2
103
91
  type: :development
104
92
  prerelease: false
105
93
  version_requirements: !ruby/object:Gem::Requirement
106
- none: false
107
94
  requirements:
108
- - - ! '>='
95
+ - - ">="
109
96
  - !ruby/object:Gem::Version
110
97
  version: 10.3.2
111
98
  - !ruby/object:Gem::Dependency
112
99
  name: rubocop
113
100
  requirement: !ruby/object:Gem::Requirement
114
- none: false
115
101
  requirements:
116
- - - ~>
102
+ - - "~>"
117
103
  - !ruby/object:Gem::Version
118
- version: '0.30'
104
+ version: 0.33.0
119
105
  type: :development
120
106
  prerelease: false
121
107
  version_requirements: !ruby/object:Gem::Requirement
122
- none: false
123
108
  requirements:
124
- - - ~>
109
+ - - "~>"
125
110
  - !ruby/object:Gem::Version
126
- version: '0.30'
111
+ version: 0.33.0
127
112
  - !ruby/object:Gem::Dependency
128
113
  name: webmock
129
114
  requirement: !ruby/object:Gem::Requirement
130
- none: false
131
115
  requirements:
132
- - - ! '>='
116
+ - - ">="
133
117
  - !ruby/object:Gem::Version
134
118
  version: 1.17.0
135
119
  type: :development
136
120
  prerelease: false
137
121
  version_requirements: !ruby/object:Gem::Requirement
138
- none: false
139
122
  requirements:
140
- - - ! '>='
123
+ - - ">="
141
124
  - !ruby/object:Gem::Version
142
125
  version: 1.17.0
143
126
  - !ruby/object:Gem::Dependency
144
127
  name: test-unit
145
128
  requirement: !ruby/object:Gem::Requirement
146
- none: false
147
129
  requirements:
148
- - - ~>
130
+ - - "~>"
149
131
  - !ruby/object:Gem::Version
150
132
  version: 3.0.2
151
133
  type: :development
152
134
  prerelease: false
153
135
  version_requirements: !ruby/object:Gem::Requirement
154
- none: false
155
136
  requirements:
156
- - - ~>
137
+ - - "~>"
157
138
  - !ruby/object:Gem::Version
158
139
  version: 3.0.2
159
- description: ! " Fluentd output plugin for the Google Cloud Logging API, which will
160
- make\n loge viewable in the Developer Console's log viewer and can optionally\n
161
- \ store them in Google Cloud Storage and/or BigQuery.\n This is an official Google
162
- Ruby gem.'\n"
140
+ description: |2
141
+ Fluentd output plugin for the Google Cloud Logging API, which will make
142
+ logs viewable in the Developer Console's log viewer and can optionally
143
+ store them in Google Cloud Storage and/or BigQuery.
144
+ This is an official Google Ruby gem.
163
145
  email:
164
146
  - salty@google.com
165
147
  executables: []
166
148
  extensions: []
167
149
  extra_rdoc_files: []
168
150
  files:
151
+ - CONTRIBUTING
152
+ - Gemfile
153
+ - Gemfile.lock
154
+ - LICENSE
155
+ - README.rdoc
156
+ - Rakefile
157
+ - fluent-plugin-google-cloud.gemspec
158
+ - lib/fluent/plugin/out_google_cloud.rb
169
159
  - test/helper.rb
170
160
  - test/plugin/data/c31e573fd7f62ed495c9ca3821a5a85cb036dee1-privatekey.p12
171
161
  - test/plugin/data/credentials.json
172
162
  - test/plugin/data/invalid_credentials.json
173
163
  - test/plugin/test_out_google_cloud.rb
174
- - LICENSE
175
- - Rakefile
176
- - fluent-plugin-google-cloud.gemspec
177
- - lib/fluent/plugin/out_google_cloud.rb
178
- - CONTRIBUTING
179
- - Gemfile.lock
180
- - Gemfile
181
- - README.rdoc
182
164
  homepage: https://github.com/GoogleCloudPlatform/fluent-plugin-google-cloud
183
165
  licenses:
184
166
  - Apache 2.0
167
+ metadata: {}
185
168
  post_install_message:
186
169
  rdoc_options: []
187
170
  require_paths:
188
171
  - lib
189
172
  required_ruby_version: !ruby/object:Gem::Requirement
190
- none: false
191
173
  requirements:
192
- - - ! '>='
174
+ - - ">="
193
175
  - !ruby/object:Gem::Version
194
176
  version: '0'
195
177
  required_rubygems_version: !ruby/object:Gem::Requirement
196
- none: false
197
178
  requirements:
198
- - - ! '>='
179
+ - - ">="
199
180
  - !ruby/object:Gem::Version
200
181
  version: '0'
201
182
  requirements: []
202
183
  rubyforge_project:
203
- rubygems_version: 1.8.23
184
+ rubygems_version: 2.4.6
204
185
  signing_key:
205
- specification_version: 3
186
+ specification_version: 4
206
187
  summary: fluentd output plugin for the Google Cloud Logging API
207
188
  test_files:
208
189
  - test/helper.rb
@@ -210,4 +191,3 @@ test_files:
210
191
  - test/plugin/data/credentials.json
211
192
  - test/plugin/data/invalid_credentials.json
212
193
  - test/plugin/test_out_google_cloud.rb
213
- has_rdoc: