fluent-plugin-google-cloud 0.6.0 → 0.6.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: 927dc2cbf24d19427cf2f48b1c663c3c0a79a517
4
- data.tar.gz: 91abb6d0a081b66401636bff11d63695c6d330b8
3
+ metadata.gz: 4d8ff06da0025190972720ffd13b941d21f79329
4
+ data.tar.gz: 5c6253b111461fca1d2435f835d6bff911c4241f
5
5
  SHA512:
6
- metadata.gz: 17044484ee4f77fae94fa5724b2334844fc0f3293bb907e383d2061fa89fa8fb3ad97e5c8e1d059fb4f663c2ab9754f9a8a2bee37dddcb3c243165c519528e3b
7
- data.tar.gz: f891eb04f7073b1f8b889a2be004b85d2a3d7c7f72f818788ec69212999aa6cb6ef3d207c9721d7ee6a883f275e3cae673f7c86beb93e0e49537addc2574fd0f
6
+ metadata.gz: 38a1fe0c31f761690a9328ca4fc1d94c50a19f0701893fb74873db17456c65e15ca0dd159a6dde731705f151976565ed709719ff755c4ff516cea2fc821314cb
7
+ data.tar.gz: ea3d462b54d1c1a3bf8a76526d77b2c4b0590a510a89f6b969c6ae36923a3d4ae2847f89e52e6b3287383e8b911ec691aac1c53c53fedcde51708ce51ecf868d
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- fluent-plugin-google-cloud (0.6.0)
4
+ fluent-plugin-google-cloud (0.6.1)
5
5
  fluentd (~> 0.10)
6
6
  google-api-client (~> 0.9.0)
7
7
  google-cloud-logging (~> 0.23.2)
@@ -13,7 +13,7 @@ PATH
13
13
  GEM
14
14
  remote: https://rubygems.org/
15
15
  specs:
16
- addressable (2.5.0)
16
+ addressable (2.5.1)
17
17
  public_suffix (~> 2.0, >= 2.0.2)
18
18
  ast (2.3.0)
19
19
  astrolabe (1.3.1)
@@ -21,9 +21,9 @@ GEM
21
21
  cool.io (1.4.6)
22
22
  crack (0.4.3)
23
23
  safe_yaml (~> 1.0.0)
24
- faraday (0.11.0)
24
+ faraday (0.12.0.1)
25
25
  multipart-post (>= 1.2, < 3)
26
- fluentd (0.14.13)
26
+ fluentd (0.14.14)
27
27
  cool.io (~> 1.4.5)
28
28
  http_parser.rb (>= 0.5.1, < 0.7.0)
29
29
  msgpack (>= 0.7.0, < 2.0.0)
@@ -57,7 +57,7 @@ GEM
57
57
  googleauth (~> 0.5.1)
58
58
  grpc (~> 1.0)
59
59
  rly (~> 0.2.3)
60
- google-protobuf (3.2.0)
60
+ google-protobuf (3.2.0.2)
61
61
  googleapis-common-protos (1.3.5)
62
62
  google-protobuf (~> 3.2)
63
63
  grpc (~> 1.0)
@@ -69,7 +69,7 @@ GEM
69
69
  multi_json (~> 1.11)
70
70
  os (~> 0.9)
71
71
  signet (~> 0.7)
72
- grpc (1.1.2)
72
+ grpc (1.2.2)
73
73
  google-protobuf (~> 3.1)
74
74
  googleauth (~> 0.5.1)
75
75
  hashdiff (0.3.2)
@@ -79,7 +79,7 @@ GEM
79
79
  json (1.8.6)
80
80
  jwt (1.5.6)
81
81
  little-plugger (1.1.4)
82
- logging (2.1.0)
82
+ logging (2.2.2)
83
83
  little-plugger (~> 1.1)
84
84
  multi_json (~> 1.10)
85
85
  memoist (0.15.0)
@@ -89,7 +89,7 @@ GEM
89
89
  mime-types-data (3.2016.0521)
90
90
  mocha (1.2.1)
91
91
  metaclass (~> 0.0.1)
92
- msgpack (1.0.3)
92
+ msgpack (1.1.0)
93
93
  multi_json (1.12.1)
94
94
  multipart-post (2.0.0)
95
95
  orderedhash (0.0.6)
@@ -114,7 +114,7 @@ GEM
114
114
  tins (<= 1.6.0)
115
115
  ruby-progressbar (1.8.1)
116
116
  safe_yaml (1.0.4)
117
- serverengine (2.0.4)
117
+ serverengine (2.0.5)
118
118
  sigdump (~> 0.2.2)
119
119
  sigdump (0.2.4)
120
120
  signet (0.7.3)
@@ -128,9 +128,9 @@ GEM
128
128
  power_assert
129
129
  thread_safe (0.3.6)
130
130
  tins (1.6.0)
131
- tzinfo (1.2.2)
131
+ tzinfo (1.2.3)
132
132
  thread_safe (~> 0.1)
133
- tzinfo-data (1.2016.10)
133
+ tzinfo-data (1.2017.2)
134
134
  tzinfo (>= 1.0.0)
135
135
  uber (0.0.15)
136
136
  webmock (1.24.6)
@@ -151,4 +151,4 @@ DEPENDENCIES
151
151
  webmock (~> 1.17)
152
152
 
153
153
  BUNDLED WITH
154
- 1.14.5
154
+ 1.14.6
@@ -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.6.0'
13
+ gem.version = '0.6.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')
@@ -73,7 +73,7 @@ module Fluent
73
73
  Fluent::Plugin.register_output('google_cloud', self)
74
74
 
75
75
  PLUGIN_NAME = 'Fluentd Google Cloud Logging plugin'
76
- PLUGIN_VERSION = '0.6.0'
76
+ PLUGIN_VERSION = '0.6.1'
77
77
 
78
78
  # Name of the the Google cloud logging write scope.
79
79
  LOGGING_SCOPE = 'https://www.googleapis.com/auth/logging.write'
@@ -590,7 +590,7 @@ module Fluent
590
590
  nanos: ts_nanos
591
591
  )
592
592
  end
593
- set_http_request_grpc(record, entry)
593
+ set_http_request(record, entry)
594
594
  set_payload_grpc(entry_resource.type, record, entry, is_json)
595
595
  else
596
596
  # Remove the labels if we didn't populate them with anything.
@@ -930,29 +930,14 @@ module Fluent
930
930
  def set_http_request(record, entry)
931
931
  return nil unless record['httpRequest'].is_a?(Hash)
932
932
  input = record['httpRequest']
933
- output = Google::Apis::LoggingV2beta1::HttpRequest.new
934
- output.request_method = input.delete('requestMethod')
935
- output.request_url = input.delete('requestUrl')
936
- output.request_size = input.delete('requestSize')
937
- output.status = input.delete('status')
938
- output.response_size = input.delete('responseSize')
939
- output.user_agent = input.delete('userAgent')
940
- output.remote_ip = input.delete('remoteIp')
941
- output.referer = input.delete('referer')
942
- output.cache_hit = input.delete('cacheHit')
943
- output.cache_validated_with_origin_server = \
944
- input.delete('cacheValidatedWithOriginServer')
945
- record.delete('httpRequest') if input.empty?
946
- entry.http_request = output
947
- end
948
-
949
- def set_http_request_grpc(record, entry)
950
- return nil unless record['httpRequest'].is_a?(Hash)
951
- input = record['httpRequest']
952
- output = Google::Logging::Type::HttpRequest.new
933
+ if @use_grpc
934
+ output = Google::Logging::Type::HttpRequest.new
935
+ else
936
+ output = Google::Apis::LoggingV2beta1::HttpRequest.new
937
+ end
953
938
  # We need to delete each field from 'httpRequest' even if its value is
954
- # nil. However we do not want to assign this nil value to proto fields
955
- # defined as strings / integers.
939
+ # nil. However we do not want to assign this nil value to the constructed
940
+ # json or proto.
956
941
  request_method = input.delete('requestMethod')
957
942
  output.request_method = request_method unless request_method.nil?
958
943
  request_url = input.delete('requestUrl')
@@ -1348,6 +1348,26 @@ module BaseTest
1348
1348
  end
1349
1349
  end
1350
1350
 
1351
+ def test_http_request_from_record_with_referer_nil_or_absent
1352
+ setup_gce_metadata_stubs
1353
+ [
1354
+ http_request_message_with_nil_referer,
1355
+ http_request_message_with_absent_referer
1356
+ ].each do |input|
1357
+ setup_logging_stubs do
1358
+ @logs_sent = []
1359
+ d = create_driver
1360
+ d.emit('httpRequest' => input)
1361
+ d.run
1362
+ end
1363
+ verify_log_entries(1, COMPUTE_PARAMS, 'httpRequest') do |entry|
1364
+ assert_equal http_request_message_with_absent_referer,
1365
+ entry['httpRequest'], entry
1366
+ assert_nil get_fields(entry['jsonPayload'])['httpRequest'], entry
1367
+ end
1368
+ end
1369
+ end
1370
+
1351
1371
  private
1352
1372
 
1353
1373
  def stub_metadata_request(metadata_path, response_body)
@@ -1565,6 +1585,13 @@ module BaseTest
1565
1585
  HTTP_REQUEST_MESSAGE.merge('referer' => nil)
1566
1586
  end
1567
1587
 
1588
+ # Unset the 'referer' field.
1589
+ def http_request_message_with_absent_referer
1590
+ HTTP_REQUEST_MESSAGE.reject do |k, _|
1591
+ k == 'referer'
1592
+ end
1593
+ end
1594
+
1568
1595
  # This module expects the methods below to be overridden.
1569
1596
 
1570
1597
  # Create a Fluentd output test driver with the Google Cloud Output plugin.
@@ -70,24 +70,6 @@ class GoogleCloudOutputTest < Test::Unit::TestCase
70
70
  assert_equal 1, exception_count
71
71
  end
72
72
 
73
- def test_http_request_from_record_with_referer_nil
74
- setup_gce_metadata_stubs
75
- setup_logging_stubs do
76
- d = create_driver
77
- d.emit('httpRequest' => http_request_message_with_nil_referer)
78
- d.run
79
- end
80
- verify_log_entries(1, COMPUTE_PARAMS, 'httpRequest') do |entry|
81
- # The request we send to Logging API has json like:
82
- # "httpRequest": { "referer": null }, but eventually the stored LogEntry
83
- # would be "httpRequest": {}, since 'referer' is defined as a string in
84
- # the proto.
85
- assert_equal http_request_message_with_nil_referer,
86
- entry['httpRequest'], entry
87
- assert_nil get_fields(entry['jsonPayload'])['httpRequest'], entry
88
- end
89
- end
90
-
91
73
  # This test looks similar between the grpc and non-grpc paths except that when
92
74
  # parsing "105", the grpc path responds with "DEBUG", while the non-grpc path
93
75
  # responds with "100".
@@ -72,34 +72,6 @@ class GoogleCloudOutputGRPCTest < Test::Unit::TestCase
72
72
  end
73
73
  end
74
74
 
75
- def test_http_request_from_record_with_referer_nil
76
- setup_gce_metadata_stubs
77
- setup_logging_stubs do
78
- d = create_driver
79
- d.emit('httpRequest' => http_request_message_with_nil_referer)
80
- d.run
81
- end
82
- verify_log_entries(1, COMPUTE_PARAMS, 'httpRequest') do |entry|
83
- assert_equal http_request_message_with_absent_referer,
84
- entry['httpRequest'], entry
85
- assert_nil get_fields(entry['jsonPayload'])['httpRequest'], entry
86
- end
87
- end
88
-
89
- def test_http_request_from_record_with_referer_absent
90
- setup_gce_metadata_stubs
91
- setup_logging_stubs do
92
- d = create_driver
93
- d.emit('httpRequest' => http_request_message_with_absent_referer)
94
- d.run
95
- end
96
- verify_log_entries(1, COMPUTE_PARAMS, 'httpRequest') do |entry|
97
- assert_equal http_request_message_with_absent_referer,
98
- entry['httpRequest'], entry
99
- assert_nil get_fields(entry['jsonPayload'])['httpRequest'], entry
100
- end
101
- end
102
-
103
75
  # This test looks similar between the grpc and non-grpc paths except that when
104
76
  # parsing "105", the grpc path responds with "DEBUG", while the non-grpc path
105
77
  # responds with "100".
@@ -340,13 +312,6 @@ class GoogleCloudOutputGRPCTest < Test::Unit::TestCase
340
312
  end
341
313
  end
342
314
 
343
- # Unset the 'referer' field.
344
- def http_request_message_with_absent_referer
345
- HTTP_REQUEST_MESSAGE.reject do |k, _|
346
- k == 'referer'
347
- end
348
- end
349
-
350
315
  # Get the fields of the payload.
351
316
  def get_fields(payload)
352
317
  payload['fields']
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.0
4
+ version: 0.6.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-02-27 00:00:00.000000000 Z
12
+ date: 2017-04-18 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: fluentd
@@ -226,7 +226,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
226
226
  version: '0'
227
227
  requirements: []
228
228
  rubyforge_project:
229
- rubygems_version: 2.6.10
229
+ rubygems_version: 2.6.11
230
230
  signing_key:
231
231
  specification_version: 4
232
232
  summary: fluentd output plugin for the Stackdriver Logging API