fluent-plugin-google-cloud 0.5.4 → 0.5.5.pre.1

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: f11ddeb5380debeeb3ea6482ba8fce07cce1ac0c
4
- data.tar.gz: fa3f075528735a79e0b01f6a9fac777d735146af
3
+ metadata.gz: 04347e11378a890ae709eb943fae378e4c653948
4
+ data.tar.gz: 48f4f8d264c03eb6d4fe6d16cc19f29bbf64b4fb
5
5
  SHA512:
6
- metadata.gz: 79f01033d4a357c9ba361fd19e102e40e74b1f166c05ad62d90159497e1d4c3cc7546e72d7887cb13088992afcc69152be5947a70c1fcdf32cfd041d30ad8e5e
7
- data.tar.gz: e700a183f766bd8137e852fb3e17888f40a4fa68be0142a113530424aa962e343af0b18149a4e5eb54132abad0e3d9bb40f818db2fa1b60ae3c383c17781d316
6
+ metadata.gz: 9a1baec70a6600ef0b3f086ec1b21ccce2159252da2ff820eaad55a83a8a12eafed606b9336fa43fbaa6ffdc9e5061738f3d74327c4d59e3a79e8267457e3d81
7
+ data.tar.gz: d50f6e7f48c8117b6183d8adb91c5b329f9ec58b48c023f4665412f7c293dcd6be50ce7c8bcd3763c17cfb108d5027b131f82270830e1920a34f0c16f660d0af
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- fluent-plugin-google-cloud (0.5.4)
4
+ fluent-plugin-google-cloud (0.5.5.pre.1)
5
5
  fluentd (~> 0.10)
6
6
  google-api-client (> 0.9)
7
7
  googleapis-common-protos (~> 1.3)
@@ -17,12 +17,12 @@ GEM
17
17
  ast (2.3.0)
18
18
  astrolabe (1.3.1)
19
19
  parser (~> 2.2)
20
- cool.io (1.4.5)
20
+ cool.io (1.4.6)
21
21
  crack (0.4.3)
22
22
  safe_yaml (~> 1.0.0)
23
23
  faraday (0.11.0)
24
24
  multipart-post (>= 1.2, < 3)
25
- fluentd (0.14.11)
25
+ fluentd (0.14.12)
26
26
  cool.io (~> 1.4.5)
27
27
  http_parser.rb (>= 0.5.1, < 0.7.0)
28
28
  msgpack (>= 0.7.0, < 2.0.0)
@@ -32,7 +32,7 @@ GEM
32
32
  tzinfo (~> 1.0)
33
33
  tzinfo-data (~> 1.0)
34
34
  yajl-ruby (~> 1.0)
35
- google-api-client (0.9.23)
35
+ google-api-client (0.9.26)
36
36
  addressable (~> 2.3)
37
37
  googleauth (~> 0.5)
38
38
  httpclient (~> 2.7)
@@ -73,13 +73,13 @@ GEM
73
73
  mime-types-data (3.2016.0521)
74
74
  mocha (1.2.1)
75
75
  metaclass (~> 0.0.1)
76
- msgpack (1.0.2)
76
+ msgpack (1.0.3)
77
77
  multi_json (1.12.1)
78
78
  multipart-post (2.0.0)
79
79
  os (0.9.6)
80
80
  parser (2.3.3.1)
81
81
  ast (~> 2.2)
82
- power_assert (0.4.1)
82
+ power_assert (1.0.1)
83
83
  powerpack (0.1.1)
84
84
  public_suffix (2.0.5)
85
85
  rainbow (2.2.1)
@@ -132,4 +132,4 @@ DEPENDENCIES
132
132
  webmock (~> 1.17)
133
133
 
134
134
  BUNDLED WITH
135
- 1.14.2
135
+ 1.14.3
@@ -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.5.4'
13
+ gem.version = '0.5.5.pre.1'
14
14
  gem.authors = ['Todd Derr', 'Alex Robinson']
15
15
  gem.email = ['salty@google.com']
16
16
  gem.required_ruby_version = Gem::Requirement.new('>= 2.0')
@@ -39,7 +39,7 @@ module Fluent
39
39
  Fluent::Plugin.register_output('google_cloud', self)
40
40
 
41
41
  PLUGIN_NAME = 'Fluentd Google Cloud Logging plugin'
42
- PLUGIN_VERSION = '0.5.4'
42
+ PLUGIN_VERSION = '0.5.5.pre.1'
43
43
 
44
44
  # Constants for service names.
45
45
  APPENGINE_SERVICE = 'appengine.googleapis.com'
@@ -437,10 +437,17 @@ module Fluent
437
437
 
438
438
  ts_secs, ts_nanos = compute_timestamp(record, time)
439
439
  if @use_grpc
440
- entry.metadata.timestamp = Google::Protobuf::Timestamp.new(
441
- seconds: ts_secs,
442
- nanos: ts_nanos
443
- )
440
+ # If "seconds" is null or not an integer, we will omit the timestamp
441
+ # field and defer the decision on how to handle it to the downstream
442
+ # Logging API. If "nanos" is null or not an integer, it will be set
443
+ # to 0.
444
+ if ts_secs.is_a?(Integer)
445
+ ts_nanos = 0 unless ts_nanos.is_a?(Integer)
446
+ entry.metadata.timestamp = Google::Protobuf::Timestamp.new(
447
+ seconds: ts_secs,
448
+ nanos: ts_nanos
449
+ )
450
+ end
444
451
 
445
452
  entry.metadata.severity =
446
453
  grpc_severity(compute_severity(record, entry))
@@ -191,6 +191,30 @@ class GoogleCloudOutputTest < Test::Unit::TestCase
191
191
  assert_equal('DEFAULT', test_obj.parse_severity('er'))
192
192
  end
193
193
 
194
+ def test_non_integer_timestamp
195
+ setup_gce_metadata_stubs
196
+ time = Time.now
197
+ [
198
+ { 'seconds' => nil, 'nanos' => nil },
199
+ { 'seconds' => nil, 'nanos' => time.tv_nsec },
200
+ { 'seconds' => 'seconds', 'nanos' => time.tv_nsec },
201
+ { 'seconds' => time.tv_sec, 'nanos' => 'nanos' },
202
+ { 'seconds' => time.tv_sec, 'nanos' => nil }
203
+ ].each do |timestamp|
204
+ setup_logging_stubs do
205
+ d = create_driver
206
+ @logs_sent = []
207
+ d.emit('message' => log_entry(0), 'timestamp' => timestamp)
208
+ d.run
209
+ end
210
+ verify_log_entries(1, COMPUTE_PARAMS) do |entry|
211
+ assert_equal timestamp, entry['metadata']['timestamp'],
212
+ "Test with timestamp '#{timestamp}' failed for " \
213
+ "entry: '#{entry}'."
214
+ end
215
+ end
216
+ end
217
+
194
218
  private
195
219
 
196
220
  def rename_key(hash, old_key, new_key)
@@ -155,6 +155,32 @@ class GoogleCloudOutputGRPCTest < Test::Unit::TestCase
155
155
  end
156
156
  end
157
157
 
158
+ def test_non_integer_timestamp
159
+ setup_gce_metadata_stubs
160
+ time = Time.now
161
+ {
162
+ { 'seconds' => nil, 'nanos' => nil } => nil,
163
+ { 'seconds' => nil, 'nanos' => time.tv_nsec } => nil,
164
+ { 'seconds' => 'seconds', 'nanos' => time.tv_nsec } => nil,
165
+ { 'seconds' => time.tv_sec, 'nanos' => 'nanos' } => \
166
+ { 'seconds' => time.tv_sec },
167
+ { 'seconds' => time.tv_sec, 'nanos' => nil } => \
168
+ { 'seconds' => time.tv_sec }
169
+ }.each do |input, expected|
170
+ setup_logging_stubs do
171
+ d = create_driver
172
+ @logs_sent = []
173
+ d.emit('message' => log_entry(0), 'timestamp' => input)
174
+ d.run
175
+ end
176
+ verify_log_entries(1, COMPUTE_PARAMS) do |entry|
177
+ assert_equal expected, entry['metadata']['timestamp'],
178
+ "Test with timestamp '#{input}' failed for " \
179
+ "entry: '#{entry}'."
180
+ end
181
+ end
182
+ end
183
+
158
184
  private
159
185
 
160
186
  GRPC_MOCK_HOST = 'localhost:56789'
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.5.4
4
+ version: 0.5.5.pre.1
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: 2017-01-23 00:00:00.000000000 Z
12
+ date: 2017-01-31 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: fluentd
@@ -212,9 +212,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
212
212
  version: '2.0'
213
213
  required_rubygems_version: !ruby/object:Gem::Requirement
214
214
  requirements:
215
- - - ">="
215
+ - - ">"
216
216
  - !ruby/object:Gem::Version
217
- version: '0'
217
+ version: 1.3.1
218
218
  requirements: []
219
219
  rubyforge_project:
220
220
  rubygems_version: 2.4.8