fluent-plugin-google-cloud 0.12.11 → 0.13.0

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
  SHA256:
3
- metadata.gz: fa2b2de4444cf81be485251db598ee31599684827a2c4ecef5227e1254622aa6
4
- data.tar.gz: 0d11b11e1f6fcdbb6d712133f911c15eb968f74e020dbfa98a30cfb6e5717602
3
+ metadata.gz: c68b17bd8639e6e1c951fe8a6c910433fde73fbdec4d300c68d6bf3418e956a3
4
+ data.tar.gz: 55ecbf8dc1fa3c947cb122b7a5f61764e75fc0cfa8186fb76f80134122c2065f
5
5
  SHA512:
6
- metadata.gz: ca9bf71962b1f2f19270a278f12d4c4e4626bc8f7e0bfc235802ae24f95ae7e65f44243c6600d8f23fedbdcdd840b4fce53b3ccddb4a454806cf32286b3d7ed8
7
- data.tar.gz: 64cf9cd901800e5ea6711356101c8a39a1310ef99c17e34fd2a3676629abc2a32ad4a60af709d57749953c14e7f6dcad5d01c14880a3e0781e09579924fe8cc7
6
+ metadata.gz: f33ba5df092033dd0b038445eac3212ba8d9fc9ffd6f93ec57e54a952850e754a09c4fdf00bb831d0f1ce6a1d73ed5a2395a53b0f52bdfa4aac8b58b3ddd72f4
7
+ data.tar.gz: 9e39400962a03ab8babd674984601a3080e524188b4fd015189dfe2f17808397a00160a37923a6cb3e5a51019879ecaf5a226f518291168b867cfa1ccfb9427a
data/Gemfile.lock CHANGED
@@ -1,14 +1,15 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- fluent-plugin-google-cloud (0.12.11)
4
+ fluent-plugin-google-cloud (0.13.0)
5
5
  fluentd (= 1.13.3)
6
- google-api-client (= 0.44.2)
7
- google-cloud-logging (= 1.6.6)
8
- google-protobuf (= 3.20.0)
9
- googleapis-common-protos (= 1.3.10)
10
- googleauth (= 0.9.0)
11
- grpc (= 1.45.0)
6
+ google-api-client (= 0.53.0)
7
+ google-cloud-logging (= 2.3.2)
8
+ google-cloud-monitoring-v3 (= 0.10.0)
9
+ google-protobuf (= 3.22.1)
10
+ googleapis-common-protos (= 1.4.0)
11
+ googleauth (= 1.3.0)
12
+ grpc (= 1.52.0)
12
13
  json (= 2.6.3)
13
14
  opencensus (= 0.5.0)
14
15
  opencensus-stackdriver (= 0.4.1)
@@ -16,7 +17,12 @@ PATH
16
17
  GEM
17
18
  remote: https://rubygems.org/
18
19
  specs:
19
- addressable (2.8.1)
20
+ activesupport (7.0.5)
21
+ concurrent-ruby (~> 1.0, >= 1.0.2)
22
+ i18n (>= 1.6, < 2)
23
+ minitest (>= 5.1)
24
+ tzinfo (~> 2.0)
25
+ addressable (2.8.4)
20
26
  public_suffix (>= 2.0.2, < 6.0)
21
27
  ast (2.4.2)
22
28
  concurrent-ruby (1.2.2)
@@ -31,8 +37,12 @@ GEM
31
37
  rexml
32
38
  declarative (0.0.20)
33
39
  docile (1.4.0)
34
- faraday (0.17.6)
35
- multipart-post (>= 1.2, < 3)
40
+ faraday (2.7.5)
41
+ faraday-net_http (>= 2.0, < 3.1)
42
+ ruby2_keywords (>= 0.0.4)
43
+ faraday-net_http (3.0.2)
44
+ faraday-retry (2.2.0)
45
+ faraday (~> 2.0)
36
46
  fluentd (1.13.3)
37
47
  bundler
38
48
  cool.io (>= 1.4.5, < 2.0.0)
@@ -45,76 +55,87 @@ GEM
45
55
  tzinfo-data (~> 1.0)
46
56
  webrick (>= 1.4.2, < 1.8.0)
47
57
  yajl-ruby (~> 1.0)
48
- gapic-common (0.3.4)
49
- google-protobuf (~> 3.12, >= 3.12.2)
50
- googleapis-common-protos (>= 1.3.9, < 2.0)
51
- googleapis-common-protos-types (>= 1.0.4, < 2.0)
52
- googleauth (~> 0.9)
53
- grpc (~> 1.25)
54
- google-api-client (0.44.2)
58
+ gapic-common (0.19.1)
59
+ faraday (>= 1.9, < 3.a)
60
+ faraday-retry (>= 1.0, < 3.a)
61
+ google-protobuf (~> 3.14)
62
+ googleapis-common-protos (>= 1.3.12, < 2.a)
63
+ googleapis-common-protos-types (>= 1.3.1, < 2.a)
64
+ googleauth (~> 1.0)
65
+ grpc (~> 1.36)
66
+ gems (1.2.0)
67
+ google-api-client (0.53.0)
68
+ google-apis-core (~> 0.1)
69
+ google-apis-generator (~> 0.1)
70
+ google-apis-core (0.11.0)
55
71
  addressable (~> 2.5, >= 2.5.1)
56
- googleauth (~> 0.9)
57
- httpclient (>= 2.8.1, < 3.0)
72
+ googleauth (>= 0.16.2, < 2.a)
73
+ httpclient (>= 2.8.1, < 3.a)
58
74
  mini_mime (~> 1.0)
59
75
  representable (~> 3.0)
60
- retriable (>= 2.0, < 4.0)
76
+ retriable (>= 2.0, < 4.a)
61
77
  rexml
62
- signet (~> 0.12)
78
+ webrick
79
+ google-apis-discovery_v1 (0.14.0)
80
+ google-apis-core (>= 0.11.0, < 2.a)
81
+ google-apis-generator (0.12.0)
82
+ activesupport (>= 5.0)
83
+ gems (~> 1.2)
84
+ google-apis-core (>= 0.11.0, < 2.a)
85
+ google-apis-discovery_v1 (~> 0.5)
86
+ thor (>= 0.20, < 2.a)
63
87
  google-cloud-core (1.6.0)
64
88
  google-cloud-env (~> 1.0)
65
89
  google-cloud-errors (~> 1.0)
66
90
  google-cloud-env (1.6.0)
67
91
  faraday (>= 0.17.3, < 3.0)
68
92
  google-cloud-errors (1.3.1)
69
- google-cloud-logging (1.6.6)
93
+ google-cloud-logging (2.3.2)
70
94
  concurrent-ruby (~> 1.1)
71
- google-cloud-core (~> 1.2)
72
- google-gax (~> 1.7)
73
- googleapis-common-protos-types (>= 1.0.2)
95
+ google-cloud-core (~> 1.5)
96
+ google-cloud-logging-v2 (~> 0.0)
74
97
  stackdriver-core (~> 1.3)
75
- google-cloud-monitoring-v3 (0.3.0)
76
- gapic-common (~> 0.3)
98
+ google-cloud-logging-v2 (0.10.0)
99
+ gapic-common (>= 0.19.0, < 2.a)
100
+ google-cloud-errors (~> 1.0)
101
+ google-cloud-monitoring-v3 (0.10.0)
102
+ gapic-common (>= 0.16.0, < 2.a)
77
103
  google-cloud-errors (~> 1.0)
78
- google-cloud-trace-v2 (0.3.0)
79
- gapic-common (~> 0.3)
104
+ google-cloud-trace-v2 (0.6.0)
105
+ gapic-common (>= 0.19.0, < 2.a)
80
106
  google-cloud-errors (~> 1.0)
81
- google-gax (1.8.2)
82
- google-protobuf (~> 3.9)
83
- googleapis-common-protos (>= 1.3.9, < 2.0)
84
- googleapis-common-protos-types (>= 1.0.4, < 2.0)
85
- googleauth (~> 0.9)
86
- grpc (~> 1.24)
87
- rly (~> 0.2.3)
88
- google-protobuf (3.20.0-x86_64-linux)
89
- googleapis-common-protos (1.3.10)
90
- google-protobuf (~> 3.11)
91
- googleapis-common-protos-types (>= 1.0.5, < 2.0)
107
+ google-protobuf (3.22.1)
108
+ googleapis-common-protos (1.4.0)
109
+ google-protobuf (~> 3.14)
110
+ googleapis-common-protos-types (~> 1.2)
92
111
  grpc (~> 1.27)
93
- googleapis-common-protos-types (1.5.0)
112
+ googleapis-common-protos-types (1.6.0)
94
113
  google-protobuf (~> 3.14)
95
- googleauth (0.9.0)
96
- faraday (~> 0.12)
114
+ googleauth (1.3.0)
115
+ faraday (>= 0.17.3, < 3.a)
97
116
  jwt (>= 1.4, < 3.0)
98
117
  memoist (~> 0.16)
99
118
  multi_json (~> 1.11)
100
119
  os (>= 0.9, < 2.0)
101
- signet (~> 0.7)
102
- grpc (1.45.0-x86_64-linux)
103
- google-protobuf (~> 3.19)
120
+ signet (>= 0.16, < 2.a)
121
+ grpc (1.52.0)
122
+ google-protobuf (~> 3.21)
104
123
  googleapis-common-protos-types (~> 1.0)
105
124
  hashdiff (1.0.1)
106
125
  http_parser.rb (0.7.0)
107
126
  httpclient (2.8.3)
127
+ i18n (1.14.1)
128
+ concurrent-ruby (~> 1.0)
108
129
  json (2.6.3)
109
130
  jwt (2.7.0)
110
131
  memoist (0.16.2)
111
132
  metaclass (0.0.4)
112
133
  mini_mime (1.1.2)
134
+ minitest (5.18.0)
113
135
  mocha (1.9.0)
114
136
  metaclass (~> 0.0.1)
115
- msgpack (1.6.1)
137
+ msgpack (1.7.1)
116
138
  multi_json (1.15.0)
117
- multipart-post (2.3.0)
118
139
  opencensus (0.5.0)
119
140
  opencensus-stackdriver (0.4.1)
120
141
  concurrent-ruby (~> 1.0)
@@ -123,8 +144,8 @@ GEM
123
144
  google-cloud-trace-v2 (~> 0.1)
124
145
  opencensus (~> 0.5)
125
146
  os (1.1.4)
126
- parallel (1.22.1)
127
- parser (3.2.1.1)
147
+ parallel (1.23.0)
148
+ parser (3.2.2.1)
128
149
  ast (~> 2.4.1)
129
150
  power_assert (2.0.3)
130
151
  prometheus-client (0.9.0)
@@ -132,15 +153,14 @@ GEM
132
153
  public_suffix (5.0.1)
133
154
  quantile (0.2.1)
134
155
  rainbow (3.1.1)
135
- rake (10.5.0)
136
- regexp_parser (2.7.0)
156
+ rake (13.0.6)
157
+ regexp_parser (2.8.0)
137
158
  representable (3.2.0)
138
159
  declarative (< 0.1.0)
139
160
  trailblazer-option (>= 0.1.1, < 0.2.0)
140
161
  uber (< 0.2.0)
141
162
  retriable (3.1.2)
142
163
  rexml (3.2.5)
143
- rly (0.2.3)
144
164
  rubocop (1.48.1)
145
165
  json (~> 2.3)
146
166
  parallel (~> 1.10)
@@ -151,9 +171,10 @@ GEM
151
171
  rubocop-ast (>= 1.26.0, < 2.0)
152
172
  ruby-progressbar (~> 1.7)
153
173
  unicode-display_width (>= 2.4.0, < 3.0)
154
- rubocop-ast (1.28.0)
174
+ rubocop-ast (1.29.0)
155
175
  parser (>= 3.2.1.0)
156
176
  ruby-progressbar (1.13.0)
177
+ ruby2_keywords (0.0.5)
157
178
  serverengine (2.3.2)
158
179
  sigdump (~> 0.2.2)
159
180
  sigdump (0.2.4)
@@ -175,35 +196,35 @@ GEM
175
196
  tins (~> 1.0)
176
197
  test-unit (3.3.3)
177
198
  power_assert
178
- thor (1.2.1)
199
+ thor (1.2.2)
179
200
  tins (1.32.1)
180
201
  sync
181
202
  trailblazer-option (0.1.2)
182
203
  tzinfo (2.0.6)
183
204
  concurrent-ruby (~> 1.0)
184
- tzinfo-data (1.2023.2)
205
+ tzinfo-data (1.2023.3)
185
206
  tzinfo (>= 1.0.0)
186
207
  uber (0.1.0)
187
208
  unicode-display_width (2.4.2)
188
- webmock (3.6.2)
189
- addressable (>= 2.3.6)
209
+ webmock (3.17.1)
210
+ addressable (>= 2.8.0)
190
211
  crack (>= 0.3.2)
191
212
  hashdiff (>= 0.4.0, < 2.0.0)
192
213
  webrick (1.7.0)
193
214
  yajl-ruby (1.4.3)
194
215
 
195
216
  PLATFORMS
196
- x86_64-linux
217
+ ruby
197
218
 
198
219
  DEPENDENCIES
199
220
  coveralls (= 0.8.23)
200
221
  fluent-plugin-google-cloud!
201
222
  mocha (= 1.9.0)
202
223
  prometheus-client (< 0.10)
203
- rake (= 10.5.0)
224
+ rake (= 13.0.6)
204
225
  rubocop (= 1.48.1)
205
226
  test-unit (= 3.3.3)
206
- webmock (= 3.6.2)
227
+ webmock (= 3.17.1)
207
228
 
208
229
  BUNDLED WITH
209
- 2.4.1
230
+ 2.1.4
@@ -10,7 +10,7 @@ Gem::Specification.new do |gem|
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.12.11'
13
+ gem.version = '0.13.0'
14
14
  gem.authors = ['Stackdriver Agents Team']
15
15
  gem.email = ['stackdriver-agents@google.com']
16
16
  gem.required_ruby_version = Gem::Requirement.new('>= 2.6')
@@ -23,12 +23,13 @@ Gem::Specification.new do |gem|
23
23
  # also the fluentd version in
24
24
  # https://github.com/GoogleCloudPlatform/google-fluentd/blob/master/config/software/fluentd.rb.
25
25
  gem.add_runtime_dependency 'fluentd', '1.13.3'
26
- gem.add_runtime_dependency 'google-api-client', '0.44.2'
27
- gem.add_runtime_dependency 'googleapis-common-protos', '1.3.10'
28
- gem.add_runtime_dependency 'googleauth', '0.9.0'
29
- gem.add_runtime_dependency 'google-cloud-logging', '1.6.6'
30
- gem.add_runtime_dependency 'google-protobuf', '3.20.0'
31
- gem.add_runtime_dependency 'grpc', '1.45.0'
26
+ gem.add_runtime_dependency 'google-api-client', '0.53.0'
27
+ gem.add_runtime_dependency 'googleapis-common-protos', '1.4.0'
28
+ gem.add_runtime_dependency 'googleauth', '1.3.0'
29
+ gem.add_runtime_dependency 'google-cloud-logging', '2.3.2'
30
+ gem.add_runtime_dependency 'google-cloud-monitoring-v3', '0.10.0'
31
+ gem.add_runtime_dependency 'google-protobuf', '3.22.1'
32
+ gem.add_runtime_dependency 'grpc', '1.52.0'
32
33
  gem.add_runtime_dependency 'json', '2.6.3'
33
34
  gem.add_runtime_dependency 'opencensus', '0.5.0'
34
35
  gem.add_runtime_dependency 'opencensus-stackdriver', '0.4.1'
@@ -36,15 +37,10 @@ Gem::Specification.new do |gem|
36
37
  gem.add_development_dependency 'mocha', '1.9.0'
37
38
  # Keep this the same as in
38
39
  # https://github.com/fluent/fluent-plugin-prometheus/blob/master/fluent-plugin-prometheus.gemspec
39
- gem.add_development_dependency 'prometheus-client', '< 0.10'
40
- # TODO(qingling128): Upgrade rake to 11.0+ after the following issues are
41
- # fixed because rake (11.0+) requires ALL variables to be explicitly
42
- # initialized.
43
- # https://github.com/googleapis/google-auth-library-ruby/issues/227
44
- # https://github.com/farcaller/rly/issues/2
45
40
  gem.add_development_dependency 'coveralls', '0.8.23'
46
- gem.add_development_dependency 'rake', '10.5.0'
41
+ gem.add_development_dependency 'prometheus-client', '< 0.10'
42
+ gem.add_development_dependency 'rake', '13.0.6'
47
43
  gem.add_development_dependency 'rubocop', '1.48.1'
48
44
  gem.add_development_dependency 'test-unit', '3.3.3'
49
- gem.add_development_dependency 'webmock', '3.6.2'
45
+ gem.add_development_dependency 'webmock', '3.17.1'
50
46
  end
@@ -51,9 +51,6 @@ module Fluent
51
51
  desc 'The field name for insertIds in the log record.'
52
52
  config_param :insert_id_key, :string, default: DEFAULT_INSERT_ID_KEY
53
53
 
54
- # Expose attr_readers for testing.
55
- attr_reader :insert_id_key
56
-
57
54
  def start
58
55
  super
59
56
  @log = $log # rubocop:disable Style/GlobalVars
@@ -20,9 +20,9 @@ require 'socket'
20
20
  require 'time'
21
21
  require 'yaml'
22
22
  require 'google/apis'
23
+ require 'google/cloud/errors'
23
24
  require 'google/apis/logging_v2'
24
25
  require 'google/cloud/logging/v2'
25
- require 'google/gax'
26
26
  require 'google/logging/v2/logging_pb'
27
27
  require 'google/logging/v2/logging_services_pb'
28
28
  require 'google/logging/v2/log_entry_pb'
@@ -149,7 +149,7 @@ module Fluent
149
149
  %w[userAgent user_agent parse_string]
150
150
  ],
151
151
  # The grpc version class name.
152
- 'Google::Logging::Type::HttpRequest',
152
+ 'Google::Cloud::Logging::Type::HttpRequest',
153
153
  # The non-grpc version class name.
154
154
  'Google::Apis::LoggingV2::HttpRequest'
155
155
  ],
@@ -161,7 +161,7 @@ module Fluent
161
161
  %w[first first parse_bool],
162
162
  %w[last last parse_bool]
163
163
  ],
164
- 'Google::Logging::V2::LogEntryOperation',
164
+ 'Google::Cloud::Logging::V2::LogEntryOperation',
165
165
  'Google::Apis::LoggingV2::LogEntryOperation'
166
166
  ],
167
167
  'source_location' => [
@@ -171,7 +171,7 @@ module Fluent
171
171
  %w[function function parse_string],
172
172
  %w[line line parse_int]
173
173
  ],
174
- 'Google::Logging::V2::LogEntrySourceLocation',
174
+ 'Google::Cloud::Logging::V2::LogEntrySourceLocation',
175
175
  'Google::Apis::LoggingV2::LogEntrySourceLocation'
176
176
  ]
177
177
  }.freeze
@@ -431,7 +431,7 @@ module Fluent
431
431
 
432
432
  # Expose attr_readers to make testing of metadata more direct than only
433
433
  # testing it indirectly through metadata sent with logs.
434
- attr_reader :project_id, :zone, :vm_id, :resource, :common_labels, :monitoring_resource
434
+ attr_reader :resource, :common_labels, :monitoring_resource
435
435
 
436
436
  def initialize
437
437
  super
@@ -784,7 +784,7 @@ module Fluent
784
784
 
785
785
  if @split_logs_by_tag
786
786
  requests_to_send.each do |request|
787
- @write_request.call(request)
787
+ @write_request.call(**request)
788
788
  end
789
789
  else
790
790
  # Combine all requests into one. The request level "log_name" will be
@@ -846,7 +846,7 @@ module Fluent
846
846
  severity,
847
847
  ts_secs,
848
848
  ts_nanos)
849
- entry = Google::Logging::V2::LogEntry.new(
849
+ entry = Google::Cloud::Logging::V2::LogEntry.new(
850
850
  labels: labels,
851
851
  resource: Google::Api::MonitoredResource.new(
852
852
  type: resource.type,
@@ -893,7 +893,7 @@ module Fluent
893
893
  client = api_client
894
894
  entries_count = entries.length
895
895
  client.write_log_entries(
896
- entries,
896
+ entries: entries,
897
897
  log_name: log_name,
898
898
  # Leave resource nil if it's nil.
899
899
  resource: if resource
@@ -916,7 +916,7 @@ module Fluent
916
916
  @successful_call = true
917
917
  @log.info 'Successfully sent gRPC to Stackdriver Logging API.'
918
918
  end
919
- rescue Google::Gax::GaxError => e
919
+ rescue Google::Cloud::Error => e
920
920
  # GRPC::BadStatus is wrapped in error.cause.
921
921
  error = e.cause
922
922
 
@@ -1007,7 +1007,7 @@ module Fluent
1007
1007
  error: error.to_s, error_code: error_code.to_s
1008
1008
  end
1009
1009
 
1010
- # Got an unexpected error (not Google::Gax::GaxError) from the
1010
+ # Got an unexpected error (not Google::Cloud::Error) from the
1011
1011
  # google-cloud-logging lib.
1012
1012
  rescue StandardError => e
1013
1013
  increment_failed_requests_count(GRPC::Core::StatusCodes::UNKNOWN)
@@ -1470,20 +1470,20 @@ module Fluent
1470
1470
 
1471
1471
  extracted_subfields = subfields.each_with_object({}) \
1472
1472
  do |(original_key, destination_key, cast_fn), extracted_fields|
1473
- value = fields.delete(original_key)
1474
- next if value.nil?
1475
-
1476
- begin
1477
- casted_value = send(cast_fn, value)
1478
- rescue TypeError
1479
- @log.error "Failed to #{cast_fn} for #{field_name}." \
1480
- "#{original_key} with value #{value.inspect}.", err
1481
- next
1482
- end
1483
- next if casted_value.nil?
1473
+ value = fields.delete(original_key)
1474
+ next if value.nil?
1475
+
1476
+ begin
1477
+ casted_value = send(cast_fn, value)
1478
+ rescue TypeError
1479
+ @log.error "Failed to #{cast_fn} for #{field_name}." \
1480
+ "#{original_key} with value #{value.inspect}.", err
1481
+ next
1482
+ end
1483
+ next if casted_value.nil?
1484
1484
 
1485
- extracted_fields[destination_key] = casted_value
1486
- end
1485
+ extracted_fields[destination_key] = casted_value
1486
+ end
1487
1487
 
1488
1488
  next unless extracted_subfields
1489
1489
 
@@ -1599,30 +1599,30 @@ module Fluent
1599
1599
  end
1600
1600
 
1601
1601
  GRPC_SEVERITY_MAPPING = {
1602
- 'DEFAULT' => Google::Logging::Type::LogSeverity::DEFAULT,
1603
- 'DEBUG' => Google::Logging::Type::LogSeverity::DEBUG,
1604
- 'INFO' => Google::Logging::Type::LogSeverity::INFO,
1605
- 'NOTICE' => Google::Logging::Type::LogSeverity::NOTICE,
1606
- 'WARNING' => Google::Logging::Type::LogSeverity::WARNING,
1607
- 'ERROR' => Google::Logging::Type::LogSeverity::ERROR,
1608
- 'CRITICAL' => Google::Logging::Type::LogSeverity::CRITICAL,
1609
- 'ALERT' => Google::Logging::Type::LogSeverity::ALERT,
1610
- 'EMERGENCY' => Google::Logging::Type::LogSeverity::EMERGENCY,
1611
- 0 => Google::Logging::Type::LogSeverity::DEFAULT,
1612
- 100 => Google::Logging::Type::LogSeverity::DEBUG,
1613
- 200 => Google::Logging::Type::LogSeverity::INFO,
1614
- 300 => Google::Logging::Type::LogSeverity::NOTICE,
1615
- 400 => Google::Logging::Type::LogSeverity::WARNING,
1616
- 500 => Google::Logging::Type::LogSeverity::ERROR,
1617
- 600 => Google::Logging::Type::LogSeverity::CRITICAL,
1618
- 700 => Google::Logging::Type::LogSeverity::ALERT,
1619
- 800 => Google::Logging::Type::LogSeverity::EMERGENCY
1602
+ 'DEFAULT' => Google::Cloud::Logging::Type::LogSeverity::DEFAULT,
1603
+ 'DEBUG' => Google::Cloud::Logging::Type::LogSeverity::DEBUG,
1604
+ 'INFO' => Google::Cloud::Logging::Type::LogSeverity::INFO,
1605
+ 'NOTICE' => Google::Cloud::Logging::Type::LogSeverity::NOTICE,
1606
+ 'WARNING' => Google::Cloud::Logging::Type::LogSeverity::WARNING,
1607
+ 'ERROR' => Google::Cloud::Logging::Type::LogSeverity::ERROR,
1608
+ 'CRITICAL' => Google::Cloud::Logging::Type::LogSeverity::CRITICAL,
1609
+ 'ALERT' => Google::Cloud::Logging::Type::LogSeverity::ALERT,
1610
+ 'EMERGENCY' => Google::Cloud::Logging::Type::LogSeverity::EMERGENCY,
1611
+ 0 => Google::Cloud::Logging::Type::LogSeverity::DEFAULT,
1612
+ 100 => Google::Cloud::Logging::Type::LogSeverity::DEBUG,
1613
+ 200 => Google::Cloud::Logging::Type::LogSeverity::INFO,
1614
+ 300 => Google::Cloud::Logging::Type::LogSeverity::NOTICE,
1615
+ 400 => Google::Cloud::Logging::Type::LogSeverity::WARNING,
1616
+ 500 => Google::Cloud::Logging::Type::LogSeverity::ERROR,
1617
+ 600 => Google::Cloud::Logging::Type::LogSeverity::CRITICAL,
1618
+ 700 => Google::Cloud::Logging::Type::LogSeverity::ALERT,
1619
+ 800 => Google::Cloud::Logging::Type::LogSeverity::EMERGENCY
1620
1620
  }.freeze
1621
1621
 
1622
1622
  def grpc_severity(severity)
1623
1623
  # TODO: find out why this doesn't work.
1624
1624
  # if severity.is_a? String
1625
- # return Google::Logging::Type::LogSeverity.resolve(severity)
1625
+ # return Google::Cloud::Logging::Type::LogSeverity.resolve(severity)
1626
1626
  # end
1627
1627
  return GRPC_SEVERITY_MAPPING[severity] if GRPC_SEVERITY_MAPPING.key?(severity)
1628
1628
 
@@ -1700,9 +1700,9 @@ module Fluent
1700
1700
 
1701
1701
  label_map.each_with_object({}) \
1702
1702
  do |(original_label, new_label), extracted_labels|
1703
- value = hash.delete(original_label)
1704
- extracted_labels[new_label] = convert_to_utf8(value.to_s) if value
1705
- end
1703
+ value = hash.delete(original_label)
1704
+ extracted_labels[new_label] = convert_to_utf8(value.to_s) if value
1705
+ end
1706
1706
  end
1707
1707
 
1708
1708
  def value_from_ruby(value)
@@ -1834,11 +1834,11 @@ module Fluent
1834
1834
  "#{Google::Apis::OS_VERSION}"
1835
1835
  channel_args = { 'grpc.primary_user_agent' => user_agent }
1836
1836
  .merge!(compression_channel_args)
1837
- @client = Google::Cloud::Logging::V2::LoggingServiceV2Client.new(
1838
- credentials: GRPC::Core::Channel.new(
1837
+ @client = Google::Cloud::Logging::V2::LoggingService::Client.new do |config|
1838
+ config.credentials = GRPC::Core::Channel.new(
1839
1839
  "#{host}#{port}", channel_args, creds
1840
1840
  )
1841
- )
1841
+ end
1842
1842
  else
1843
1843
  # TODO: Use a non-default ClientOptions object.
1844
1844
  Google::Apis::ClientOptions.default.application_name = PLUGIN_NAME
@@ -2004,11 +2004,10 @@ module Fluent
2004
2004
  # are a list of indexes of log entries that failed due to this error.
2005
2005
  #
2006
2006
  # A sample error looks like:
2007
- # <Google::Gax::RetryError:
2008
- # message: 'GaxError Exception occurred in retry method that was not class
2009
- # ified as transient, caused by 7:User not authorized.',
2007
+ # <Google::Cloud::PermissionDeniedError:
2008
+ # message: 'User not authorized.',
2010
2009
  # details: [
2011
- # <Google::Logging::V2::WriteLogEntriesPartialErrors:
2010
+ # <Google::Cloud::Logging::V2::WriteLogEntriesPartialErrors:
2012
2011
  # log_entry_errors: {
2013
2012
  # 0 => <Google::Rpc::Status:
2014
2013
  # code: 7,
@@ -2038,13 +2037,14 @@ module Fluent
2038
2037
  # [3, 'Log name contains illegal character :']: [1, 3]
2039
2038
  # }
2040
2039
  def construct_error_details_map_grpc(gax_error)
2040
+ @log.error "construct_error_details_map_grpc: #{gax_error}"
2041
2041
  error_details_map = Hash.new { |h, k| h[k] = [] }
2042
2042
  error_details = ensure_array(gax_error.status_details)
2043
2043
  raise JSON::ParserError, 'The error details are empty.' if
2044
2044
  error_details.empty?
2045
2045
  raise JSON::ParserError, 'No partial error info in error details.' unless
2046
2046
  error_details[0].is_a?(
2047
- Google::Logging::V2::WriteLogEntriesPartialErrors
2047
+ Google::Cloud::Logging::V2::WriteLogEntriesPartialErrors
2048
2048
  )
2049
2049
 
2050
2050
  log_entry_errors = ensure_hash(error_details[0].log_entry_errors)
@@ -19,14 +19,16 @@ require 'erb'
19
19
  module Statusz
20
20
  module_function
21
21
 
22
- # NOTE: The plugin parameter is referenced in STATUSZ_TMPL.
23
22
  def response(plugin)
24
23
  uptime = Time.now - SERVER_START
25
24
  uptime_str = format('%<hours>d hr %<minutes>02d min %<seconds>02d sec',
26
25
  hours: uptime / 3600,
27
26
  minutes: (uptime / 60) % 60,
28
27
  seconds: uptime % 60)
29
- ERB.new(STATUSZ_TMPL).result(binding)
28
+ ERB.new(STATUSZ_TMPL).result_with_hash(
29
+ plugin: plugin,
30
+ uptime_str: uptime_str
31
+ )
30
32
  end
31
33
  end
32
34
 
@@ -29,8 +29,10 @@ require_relative 'utils'
29
29
 
30
30
  module Monitoring
31
31
  # Prevent OpenCensus from writing to the network.
32
- class OpenCensusMonitoringRegistry
33
- def export
32
+ OpenCensusMonitoringRegistry.class_eval do
33
+ # Suppress redefine warning (https://bugs.ruby-lang.org/issues/17055).
34
+ alias_method :export, :export
35
+ define_method(:export) do
34
36
  nil
35
37
  end
36
38
  end
@@ -55,6 +57,7 @@ module BaseTest
55
57
  registry.unregister(:stackdriver_retried_entries_count)
56
58
 
57
59
  setup_auth_stubs('https://www.googleapis.com/oauth2/v4/token')
60
+ setup_auth_stubs('https://oauth2.googleapis.com/token')
58
61
  @logs_sent = []
59
62
  end
60
63
 
@@ -12,20 +12,9 @@
12
12
  # See the License for the specific language governing permissions and
13
13
  # limitations under the License.
14
14
 
15
+ require 'google/rpc/error_details_pb'
16
+
15
17
  # Add some helper methods to standard classes.
16
- module Google
17
- module Protobuf
18
- Any.class_eval do
19
- # TODO(igorpeshansky): Remove this once
20
- # https://github.com/google/protobuf/pull/4719 gets released.
21
- def self.pack(msg, type_url_prefix = 'type.googleapis.com/')
22
- any = Google::Protobuf::Any.new
23
- any.pack(msg, type_url_prefix)
24
- any
25
- end
26
- end
27
- end
28
- end
29
18
  String.class_eval do
30
19
  def inspect_octal
31
20
  specials = {
@@ -1018,7 +1007,7 @@ module Constants
1018
1007
  }.freeze
1019
1008
 
1020
1009
  PARTIAL_SUCCESS_GRPC_METADATA = begin
1021
- partial_errors = Google::Logging::V2::WriteLogEntriesPartialErrors.new(
1010
+ partial_errors = Google::Cloud::Logging::V2::WriteLogEntriesPartialErrors.new(
1022
1011
  log_entry_errors: {
1023
1012
  0 => Google::Rpc::Status.new(
1024
1013
  code: GRPC::Core::StatusCodes::PERMISSION_DENIED,
@@ -198,10 +198,10 @@ class GoogleCloudOutputTest < Test::Unit::TestCase
198
198
  # known severities should translate to themselves, regardless of case
199
199
  %w[DEFAULT DEBUG INFO NOTICE WARNING ERROR CRITICAL ALERT EMERGENCY].each \
200
200
  do |severity|
201
- assert_equal(severity, test_obj.parse_severity(severity))
202
- assert_equal(severity, test_obj.parse_severity(severity.downcase))
203
- assert_equal(severity, test_obj.parse_severity(severity.capitalize))
204
- end
201
+ assert_equal(severity, test_obj.parse_severity(severity))
202
+ assert_equal(severity, test_obj.parse_severity(severity.downcase))
203
+ assert_equal(severity, test_obj.parse_severity(severity.capitalize))
204
+ end
205
205
 
206
206
  # numeric levels
207
207
  assert_equal(0, test_obj.parse_severity('0'))
@@ -34,6 +34,8 @@ class GoogleCloudOutputGRPCTest < Test::Unit::TestCase
34
34
  # Record user agent when creating a GRPC::Core::Channel.
35
35
  GRPC::Core::Channel.class_eval do
36
36
  old_initialize = instance_method(:initialize)
37
+ # Suppress redefine warning (https://bugs.ruby-lang.org/issues/17055).
38
+ alias_method :initialize, :initialize
37
39
  define_method(:initialize) do |url, args, creds|
38
40
  user_agent = args['grpc.primary_user_agent']
39
41
  old_initialize.bind(self).call(url, args, creds)
@@ -270,8 +272,8 @@ class GoogleCloudOutputGRPCTest < Test::Unit::TestCase
270
272
 
271
273
  private
272
274
 
273
- WriteLogEntriesRequest = Google::Logging::V2::WriteLogEntriesRequest
274
- WriteLogEntriesResponse = Google::Logging::V2::WriteLogEntriesResponse
275
+ WriteLogEntriesRequest = Google::Cloud::Logging::V2::WriteLogEntriesRequest
276
+ WriteLogEntriesResponse = Google::Cloud::Logging::V2::WriteLogEntriesResponse
275
277
 
276
278
  USE_GRPC_CONFIG = %(
277
279
  use_grpc true
@@ -332,13 +334,13 @@ class GoogleCloudOutputGRPCTest < Test::Unit::TestCase
332
334
 
333
335
  # GRPC logging mock that successfully logs the records.
334
336
  class GRPCLoggingMockService <
335
- Google::Cloud::Logging::V2::LoggingServiceV2Client
337
+ Google::Cloud::Logging::V2::LoggingService::Client
336
338
  def initialize(requests_received)
337
339
  super()
338
340
  @requests_received = requests_received
339
341
  end
340
342
 
341
- def write_log_entries(entries,
343
+ def write_log_entries(entries:,
342
344
  log_name: nil,
343
345
  resource: nil,
344
346
  labels: nil,
@@ -357,7 +359,7 @@ class GoogleCloudOutputGRPCTest < Test::Unit::TestCase
357
359
 
358
360
  # GRPC logging mock that fails and returns server side or client side errors.
359
361
  class GRPCLoggingMockFailingService <
360
- Google::Cloud::Logging::V2::LoggingServiceV2Client
362
+ Google::Cloud::Logging::V2::LoggingService::Client
361
363
  def initialize(error, failed_attempts)
362
364
  super()
363
365
  @error = error
@@ -365,7 +367,7 @@ class GoogleCloudOutputGRPCTest < Test::Unit::TestCase
365
367
  end
366
368
 
367
369
  # rubocop:disable Lint/UnusedMethodArgument
368
- def write_log_entries(entries,
370
+ def write_log_entries(entries:,
369
371
  log_name: nil,
370
372
  resource: nil,
371
373
  labels: nil,
@@ -374,8 +376,8 @@ class GoogleCloudOutputGRPCTest < Test::Unit::TestCase
374
376
  begin
375
377
  raise @error
376
378
  rescue StandardError
377
- # Google::Gax::GaxError will wrap the latest thrown exception as @cause.
378
- raise Google::Gax::GaxError, 'This test message does not matter.'
379
+ # Google::Cloud::Error will wrap the latest thrown exception as @cause.
380
+ raise Google::Cloud::Error, 'This test message does not matter.'
379
381
  end
380
382
  end
381
383
  # rubocop:enable Lint/UnusedMethodArgument
data/test/plugin/utils.rb CHANGED
@@ -60,8 +60,7 @@ module Utils
60
60
  "attribute1\nattribute2\nattribute3")
61
61
 
62
62
  # Used by 'googleauth' to fetch the default service account credentials.
63
- stub_request(:get, 'http://169.254.169.254/computeMetadata/v1/' \
64
- 'instance/service-accounts/default/token')
63
+ stub_request(:get, %r{http://169.254.169.254/computeMetadata/v1/instance/service-accounts/default/token(?:\?.*)})
65
64
  .to_return(body: %({"access_token": "#{FAKE_AUTH_TOKEN}"}),
66
65
  status: 200,
67
66
  headers: { 'Content-Length' => FAKE_AUTH_TOKEN.length,
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent-plugin-google-cloud
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.12.11
4
+ version: 0.13.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stackdriver Agents Team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-03-27 00:00:00.000000000 Z
11
+ date: 2023-06-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fluentd
@@ -30,84 +30,98 @@ dependencies:
30
30
  requirements:
31
31
  - - '='
32
32
  - !ruby/object:Gem::Version
33
- version: 0.44.2
33
+ version: 0.53.0
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - '='
39
39
  - !ruby/object:Gem::Version
40
- version: 0.44.2
40
+ version: 0.53.0
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: googleapis-common-protos
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - '='
46
46
  - !ruby/object:Gem::Version
47
- version: 1.3.10
47
+ version: 1.4.0
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - '='
53
53
  - !ruby/object:Gem::Version
54
- version: 1.3.10
54
+ version: 1.4.0
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: googleauth
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - '='
60
60
  - !ruby/object:Gem::Version
61
- version: 0.9.0
61
+ version: 1.3.0
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - '='
67
67
  - !ruby/object:Gem::Version
68
- version: 0.9.0
68
+ version: 1.3.0
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: google-cloud-logging
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
73
  - - '='
74
74
  - !ruby/object:Gem::Version
75
- version: 1.6.6
75
+ version: 2.3.2
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - '='
81
81
  - !ruby/object:Gem::Version
82
- version: 1.6.6
82
+ version: 2.3.2
83
+ - !ruby/object:Gem::Dependency
84
+ name: google-cloud-monitoring-v3
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - '='
88
+ - !ruby/object:Gem::Version
89
+ version: 0.10.0
90
+ type: :runtime
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - '='
95
+ - !ruby/object:Gem::Version
96
+ version: 0.10.0
83
97
  - !ruby/object:Gem::Dependency
84
98
  name: google-protobuf
85
99
  requirement: !ruby/object:Gem::Requirement
86
100
  requirements:
87
101
  - - '='
88
102
  - !ruby/object:Gem::Version
89
- version: 3.20.0
103
+ version: 3.22.1
90
104
  type: :runtime
91
105
  prerelease: false
92
106
  version_requirements: !ruby/object:Gem::Requirement
93
107
  requirements:
94
108
  - - '='
95
109
  - !ruby/object:Gem::Version
96
- version: 3.20.0
110
+ version: 3.22.1
97
111
  - !ruby/object:Gem::Dependency
98
112
  name: grpc
99
113
  requirement: !ruby/object:Gem::Requirement
100
114
  requirements:
101
115
  - - '='
102
116
  - !ruby/object:Gem::Version
103
- version: 1.45.0
117
+ version: 1.52.0
104
118
  type: :runtime
105
119
  prerelease: false
106
120
  version_requirements: !ruby/object:Gem::Requirement
107
121
  requirements:
108
122
  - - '='
109
123
  - !ruby/object:Gem::Version
110
- version: 1.45.0
124
+ version: 1.52.0
111
125
  - !ruby/object:Gem::Dependency
112
126
  name: json
113
127
  requirement: !ruby/object:Gem::Requirement
@@ -165,47 +179,47 @@ dependencies:
165
179
  - !ruby/object:Gem::Version
166
180
  version: 1.9.0
167
181
  - !ruby/object:Gem::Dependency
168
- name: prometheus-client
182
+ name: coveralls
169
183
  requirement: !ruby/object:Gem::Requirement
170
184
  requirements:
171
- - - "<"
185
+ - - '='
172
186
  - !ruby/object:Gem::Version
173
- version: '0.10'
187
+ version: 0.8.23
174
188
  type: :development
175
189
  prerelease: false
176
190
  version_requirements: !ruby/object:Gem::Requirement
177
191
  requirements:
178
- - - "<"
192
+ - - '='
179
193
  - !ruby/object:Gem::Version
180
- version: '0.10'
194
+ version: 0.8.23
181
195
  - !ruby/object:Gem::Dependency
182
- name: coveralls
196
+ name: prometheus-client
183
197
  requirement: !ruby/object:Gem::Requirement
184
198
  requirements:
185
- - - '='
199
+ - - "<"
186
200
  - !ruby/object:Gem::Version
187
- version: 0.8.23
201
+ version: '0.10'
188
202
  type: :development
189
203
  prerelease: false
190
204
  version_requirements: !ruby/object:Gem::Requirement
191
205
  requirements:
192
- - - '='
206
+ - - "<"
193
207
  - !ruby/object:Gem::Version
194
- version: 0.8.23
208
+ version: '0.10'
195
209
  - !ruby/object:Gem::Dependency
196
210
  name: rake
197
211
  requirement: !ruby/object:Gem::Requirement
198
212
  requirements:
199
213
  - - '='
200
214
  - !ruby/object:Gem::Version
201
- version: 10.5.0
215
+ version: 13.0.6
202
216
  type: :development
203
217
  prerelease: false
204
218
  version_requirements: !ruby/object:Gem::Requirement
205
219
  requirements:
206
220
  - - '='
207
221
  - !ruby/object:Gem::Version
208
- version: 10.5.0
222
+ version: 13.0.6
209
223
  - !ruby/object:Gem::Dependency
210
224
  name: rubocop
211
225
  requirement: !ruby/object:Gem::Requirement
@@ -240,14 +254,14 @@ dependencies:
240
254
  requirements:
241
255
  - - '='
242
256
  - !ruby/object:Gem::Version
243
- version: 3.6.2
257
+ version: 3.17.1
244
258
  type: :development
245
259
  prerelease: false
246
260
  version_requirements: !ruby/object:Gem::Requirement
247
261
  requirements:
248
262
  - - '='
249
263
  - !ruby/object:Gem::Version
250
- version: 3.6.2
264
+ version: 3.17.1
251
265
  description: |2
252
266
  Fluentd plugins for the Stackdriver Logging API, which will make logs
253
267
  viewable in the Stackdriver Logs Viewer and can optionally store them