google-cloud-monitoring-v3 1.1.0 → 1.3.0

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1e067d83342d54d01578abf4a8c8a84d9507429395d45789e652cbf8e0ff9e6d
4
- data.tar.gz: ff907c0d3676bf54dfb12e8b613aff4071f406e524b420f8ece210eb6a0ed55e
3
+ metadata.gz: cb8db4740a01447d21e456245a2d5fa19f7379b506302cc3ec929b29f536a2fc
4
+ data.tar.gz: d405c769e42470dc395e5b91f74166342b449c98803df469dd0167149df661c3
5
5
  SHA512:
6
- metadata.gz: e698b65d95b50a16ad089e69b348eb7c49486970dadf3c13a30d31158eb734fd527133e3d6ab99dc4eab018cdc41e6c57bc2107f7d6edad93893bfc10babff3f
7
- data.tar.gz: 567f853b183d4d7b0d0f2f5fe29d355be158a814a98b791af8807d25014fd7f268645997d181711e4caecdb3918a3bc107bc598082974823b8c49489030e153a
6
+ metadata.gz: 3e355a0f5d23f95991ef730f0463dac289a4b5516157a088970818a1b1b1281a2a1eb4cdec98944a657c5229147dbbee5297620f63b58f9ed9595daefce30805
7
+ data.tar.gz: c706b1b9d9066e83415d23eb559d44ecc1d254d35882bddc8926640451153f76fc769961aa2ced2925d1a72fabc98e83ca74dbb64f9228e2263cb340be1676ee
data/README.md CHANGED
@@ -43,33 +43,43 @@ for class and method documentation.
43
43
  See also the [Product Documentation](https://cloud.google.com/monitoring)
44
44
  for general usage information.
45
45
 
46
- ## Enabling Logging
47
-
48
- To enable logging for this library, set the logger for the underlying [gRPC](https://github.com/grpc/grpc/tree/master/src/ruby) library.
49
- The logger that you set may be a Ruby stdlib [`Logger`](https://ruby-doc.org/current/stdlibs/logger/Logger.html) as shown below,
50
- or a [`Google::Cloud::Logging::Logger`](https://cloud.google.com/ruby/docs/reference/google-cloud-logging/latest)
51
- that will write logs to [Cloud Logging](https://cloud.google.com/logging/). See [grpc/logconfig.rb](https://github.com/grpc/grpc/blob/master/src/ruby/lib/grpc/logconfig.rb)
52
- and the gRPC [spec_helper.rb](https://github.com/grpc/grpc/blob/master/src/ruby/spec/spec_helper.rb) for additional information.
53
-
54
- Configuring a Ruby stdlib logger:
46
+ ## Debug Logging
47
+
48
+ This library comes with opt-in Debug Logging that can help you troubleshoot
49
+ your application's integration with the API. When logging is activated, key
50
+ events such as requests and responses, along with data payloads and metadata
51
+ such as headers and client configuration, are logged to the standard error
52
+ stream.
53
+
54
+ **WARNING:** Client Library Debug Logging includes your data payloads in
55
+ plaintext, which could include sensitive data such as PII for yourself or your
56
+ customers, private keys, or other security data that could be compromising if
57
+ leaked. Always practice good data hygiene with your application logs, and follow
58
+ the principle of least access. Google also recommends that Client Library Debug
59
+ Logging be enabled only temporarily during active debugging, and not used
60
+ permanently in production.
61
+
62
+ To enable logging, set the environment variable `GOOGLE_SDK_RUBY_LOGGING_GEMS`
63
+ to the value `all`. Alternatively, you can set the value to a comma-delimited
64
+ list of client library gem names. This will select the default logging behavior,
65
+ which writes logs to the standard error stream. On a local workstation, this may
66
+ result in logs appearing on the console. When running on a Google Cloud hosting
67
+ service such as [Google Cloud Run](https://cloud.google.com/run), this generally
68
+ results in logs appearing alongside your application logs in the
69
+ [Google Cloud Logging](https://cloud.google.com/logging/) service.
70
+
71
+ You can customize logging by modifying the `logger` configuration when
72
+ constructing a client object. For example:
55
73
 
56
74
  ```ruby
75
+ require "google/cloud/monitoring/v3"
57
76
  require "logger"
58
77
 
59
- module MyLogger
60
- LOGGER = Logger.new $stderr, level: Logger::WARN
61
- def logger
62
- LOGGER
63
- end
64
- end
65
-
66
- # Define a gRPC module-level logger method before grpc/logconfig.rb loads.
67
- module GRPC
68
- extend MyLogger
78
+ client = ::Google::Cloud::Monitoring::V3::AlertPolicyService::Client.new do |config|
79
+ config.logger = Logger.new "my-app.log"
69
80
  end
70
81
  ```
71
82
 
72
-
73
83
  ## Google Cloud Samples
74
84
 
75
85
  To browse ready to use code samples check [Google Cloud Samples](https://cloud.google.com/docs/samples).
@@ -184,8 +184,28 @@ module Google
184
184
  universe_domain: @config.universe_domain,
185
185
  channel_args: @config.channel_args,
186
186
  interceptors: @config.interceptors,
187
- channel_pool_config: @config.channel_pool
187
+ channel_pool_config: @config.channel_pool,
188
+ logger: @config.logger
188
189
  )
190
+
191
+ @alert_policy_service_stub.stub_logger&.info do |entry|
192
+ entry.set_system_name
193
+ entry.set_service
194
+ entry.message = "Created client for #{entry.service}"
195
+ entry.set_credentials_fields credentials
196
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
197
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
198
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
199
+ end
200
+ end
201
+
202
+ ##
203
+ # The logger used for request/response debug logging.
204
+ #
205
+ # @return [Logger]
206
+ #
207
+ def logger
208
+ @alert_policy_service_stub.logger
189
209
  end
190
210
 
191
211
  # Service calls
@@ -305,7 +325,7 @@ module Google
305
325
  @alert_policy_service_stub.call_rpc :list_alert_policies, request, options: options do |response, operation|
306
326
  response = ::Gapic::PagedEnumerable.new @alert_policy_service_stub, :list_alert_policies, request, response, operation, options
307
327
  yield response, operation if block_given?
308
- return response
328
+ throw :response, response
309
329
  end
310
330
  rescue ::GRPC::BadStatus => e
311
331
  raise ::Google::Cloud::Error.from_error(e)
@@ -393,7 +413,6 @@ module Google
393
413
 
394
414
  @alert_policy_service_stub.call_rpc :get_alert_policy, request, options: options do |response, operation|
395
415
  yield response, operation if block_given?
396
- return response
397
416
  end
398
417
  rescue ::GRPC::BadStatus => e
399
418
  raise ::Google::Cloud::Error.from_error(e)
@@ -499,7 +518,6 @@ module Google
499
518
 
500
519
  @alert_policy_service_stub.call_rpc :create_alert_policy, request, options: options do |response, operation|
501
520
  yield response, operation if block_given?
502
- return response
503
521
  end
504
522
  rescue ::GRPC::BadStatus => e
505
523
  raise ::Google::Cloud::Error.from_error(e)
@@ -593,7 +611,6 @@ module Google
593
611
 
594
612
  @alert_policy_service_stub.call_rpc :delete_alert_policy, request, options: options do |response, operation|
595
613
  yield response, operation if block_given?
596
- return response
597
614
  end
598
615
  rescue ::GRPC::BadStatus => e
599
616
  raise ::Google::Cloud::Error.from_error(e)
@@ -711,7 +728,6 @@ module Google
711
728
 
712
729
  @alert_policy_service_stub.call_rpc :update_alert_policy, request, options: options do |response, operation|
713
730
  yield response, operation if block_given?
714
- return response
715
731
  end
716
732
  rescue ::GRPC::BadStatus => e
717
733
  raise ::Google::Cloud::Error.from_error(e)
@@ -800,6 +816,11 @@ module Google
800
816
  # default endpoint URL. The default value of nil uses the environment
801
817
  # universe (usually the default "googleapis.com" universe).
802
818
  # @return [::String,nil]
819
+ # @!attribute [rw] logger
820
+ # A custom logger to use for request/response debug logging, or the value
821
+ # `:default` (the default) to construct a default logger, or `nil` to
822
+ # explicitly disable logging.
823
+ # @return [::Logger,:default,nil]
803
824
  #
804
825
  class Configuration
805
826
  extend ::Gapic::Config
@@ -824,6 +845,7 @@ module Google
824
845
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
825
846
  config_attr :quota_project, nil, ::String, nil
826
847
  config_attr :universe_domain, nil, ::String, nil
848
+ config_attr :logger, :default, ::Logger, nil, :default
827
849
 
828
850
  # @private
829
851
  def initialize parent_config = nil
@@ -195,8 +195,28 @@ module Google
195
195
  universe_domain: @config.universe_domain,
196
196
  channel_args: @config.channel_args,
197
197
  interceptors: @config.interceptors,
198
- channel_pool_config: @config.channel_pool
198
+ channel_pool_config: @config.channel_pool,
199
+ logger: @config.logger
199
200
  )
201
+
202
+ @group_service_stub.stub_logger&.info do |entry|
203
+ entry.set_system_name
204
+ entry.set_service
205
+ entry.message = "Created client for #{entry.service}"
206
+ entry.set_credentials_fields credentials
207
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
208
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
209
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
210
+ end
211
+ end
212
+
213
+ ##
214
+ # The logger used for request/response debug logging.
215
+ #
216
+ # @return [Logger]
217
+ #
218
+ def logger
219
+ @group_service_stub.logger
200
220
  end
201
221
 
202
222
  # Service calls
@@ -320,7 +340,7 @@ module Google
320
340
  @group_service_stub.call_rpc :list_groups, request, options: options do |response, operation|
321
341
  response = ::Gapic::PagedEnumerable.new @group_service_stub, :list_groups, request, response, operation, options
322
342
  yield response, operation if block_given?
323
- return response
343
+ throw :response, response
324
344
  end
325
345
  rescue ::GRPC::BadStatus => e
326
346
  raise ::Google::Cloud::Error.from_error(e)
@@ -408,7 +428,6 @@ module Google
408
428
 
409
429
  @group_service_stub.call_rpc :get_group, request, options: options do |response, operation|
410
430
  yield response, operation if block_given?
411
- return response
412
431
  end
413
432
  rescue ::GRPC::BadStatus => e
414
433
  raise ::Google::Cloud::Error.from_error(e)
@@ -503,7 +522,6 @@ module Google
503
522
 
504
523
  @group_service_stub.call_rpc :create_group, request, options: options do |response, operation|
505
524
  yield response, operation if block_given?
506
- return response
507
525
  end
508
526
  rescue ::GRPC::BadStatus => e
509
527
  raise ::Google::Cloud::Error.from_error(e)
@@ -594,7 +612,6 @@ module Google
594
612
 
595
613
  @group_service_stub.call_rpc :update_group, request, options: options do |response, operation|
596
614
  yield response, operation if block_given?
597
- return response
598
615
  end
599
616
  rescue ::GRPC::BadStatus => e
600
617
  raise ::Google::Cloud::Error.from_error(e)
@@ -686,7 +703,6 @@ module Google
686
703
 
687
704
  @group_service_stub.call_rpc :delete_group, request, options: options do |response, operation|
688
705
  yield response, operation if block_given?
689
- return response
690
706
  end
691
707
  rescue ::GRPC::BadStatus => e
692
708
  raise ::Google::Cloud::Error.from_error(e)
@@ -799,7 +815,7 @@ module Google
799
815
  @group_service_stub.call_rpc :list_group_members, request, options: options do |response, operation|
800
816
  response = ::Gapic::PagedEnumerable.new @group_service_stub, :list_group_members, request, response, operation, options
801
817
  yield response, operation if block_given?
802
- return response
818
+ throw :response, response
803
819
  end
804
820
  rescue ::GRPC::BadStatus => e
805
821
  raise ::Google::Cloud::Error.from_error(e)
@@ -888,6 +904,11 @@ module Google
888
904
  # default endpoint URL. The default value of nil uses the environment
889
905
  # universe (usually the default "googleapis.com" universe).
890
906
  # @return [::String,nil]
907
+ # @!attribute [rw] logger
908
+ # A custom logger to use for request/response debug logging, or the value
909
+ # `:default` (the default) to construct a default logger, or `nil` to
910
+ # explicitly disable logging.
911
+ # @return [::Logger,:default,nil]
891
912
  #
892
913
  class Configuration
893
914
  extend ::Gapic::Config
@@ -912,6 +933,7 @@ module Google
912
933
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
913
934
  config_attr :quota_project, nil, ::String, nil
914
935
  config_attr :universe_domain, nil, ::String, nil
936
+ config_attr :logger, :default, ::Logger, nil, :default
915
937
 
916
938
  # @private
917
939
  def initialize parent_config = nil
@@ -192,8 +192,28 @@ module Google
192
192
  universe_domain: @config.universe_domain,
193
193
  channel_args: @config.channel_args,
194
194
  interceptors: @config.interceptors,
195
- channel_pool_config: @config.channel_pool
195
+ channel_pool_config: @config.channel_pool,
196
+ logger: @config.logger
196
197
  )
198
+
199
+ @metric_service_stub.stub_logger&.info do |entry|
200
+ entry.set_system_name
201
+ entry.set_service
202
+ entry.message = "Created client for #{entry.service}"
203
+ entry.set_credentials_fields credentials
204
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
205
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
206
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
207
+ end
208
+ end
209
+
210
+ ##
211
+ # The logger used for request/response debug logging.
212
+ #
213
+ # @return [Logger]
214
+ #
215
+ def logger
216
+ @metric_service_stub.logger
197
217
  end
198
218
 
199
219
  # Service calls
@@ -300,7 +320,7 @@ module Google
300
320
  @metric_service_stub.call_rpc :list_monitored_resource_descriptors, request, options: options do |response, operation|
301
321
  response = ::Gapic::PagedEnumerable.new @metric_service_stub, :list_monitored_resource_descriptors, request, response, operation, options
302
322
  yield response, operation if block_given?
303
- return response
323
+ throw :response, response
304
324
  end
305
325
  rescue ::GRPC::BadStatus => e
306
326
  raise ::Google::Cloud::Error.from_error(e)
@@ -391,7 +411,6 @@ module Google
391
411
 
392
412
  @metric_service_stub.call_rpc :get_monitored_resource_descriptor, request, options: options do |response, operation|
393
413
  yield response, operation if block_given?
394
- return response
395
414
  end
396
415
  rescue ::GRPC::BadStatus => e
397
416
  raise ::Google::Cloud::Error.from_error(e)
@@ -422,7 +441,7 @@ module Google
422
441
  #
423
442
  # projects/[PROJECT_ID_OR_NUMBER]
424
443
  # @param filter [::String]
425
- # If this field is empty, all custom and
444
+ # Optional. If this field is empty, all custom and
426
445
  # system-defined metric descriptors are returned.
427
446
  # Otherwise, the [filter](https://cloud.google.com/monitoring/api/v3/filters)
428
447
  # specifies which metric descriptors are to be
@@ -431,13 +450,14 @@ module Google
431
450
  #
432
451
  # metric.type = starts_with("custom.googleapis.com/")
433
452
  # @param page_size [::Integer]
434
- # A positive number that is the maximum number of results to return. The
435
- # default and maximum value is 10,000. If a page_size <= 0 or > 10,000 is
436
- # submitted, will instead return a maximum of 10,000 results.
453
+ # Optional. A positive number that is the maximum number of results to
454
+ # return. The default and maximum value is 10,000. If a page_size <= 0 or >
455
+ # 10,000 is submitted, will instead return a maximum of 10,000 results.
437
456
  # @param page_token [::String]
438
- # If this field is not empty then it must contain the `nextPageToken` value
439
- # returned by a previous call to this method. Using this field causes the
440
- # method to return additional results from the previous method call.
457
+ # Optional. If this field is not empty then it must contain the
458
+ # `nextPageToken` value returned by a previous call to this method. Using
459
+ # this field causes the method to return additional results from the previous
460
+ # method call.
441
461
  #
442
462
  # @yield [response, operation] Access the result along with the RPC operation
443
463
  # @yieldparam response [::Gapic::PagedEnumerable<::Google::Api::MetricDescriptor>]
@@ -503,7 +523,7 @@ module Google
503
523
  @metric_service_stub.call_rpc :list_metric_descriptors, request, options: options do |response, operation|
504
524
  response = ::Gapic::PagedEnumerable.new @metric_service_stub, :list_metric_descriptors, request, response, operation, options
505
525
  yield response, operation if block_given?
506
- return response
526
+ throw :response, response
507
527
  end
508
528
  rescue ::GRPC::BadStatus => e
509
529
  raise ::Google::Cloud::Error.from_error(e)
@@ -595,7 +615,6 @@ module Google
595
615
 
596
616
  @metric_service_stub.call_rpc :get_metric_descriptor, request, options: options do |response, operation|
597
617
  yield response, operation if block_given?
598
- return response
599
618
  end
600
619
  rescue ::GRPC::BadStatus => e
601
620
  raise ::Google::Cloud::Error.from_error(e)
@@ -693,7 +712,6 @@ module Google
693
712
 
694
713
  @metric_service_stub.call_rpc :create_metric_descriptor, request, options: options do |response, operation|
695
714
  yield response, operation if block_given?
696
- return response
697
715
  end
698
716
  rescue ::GRPC::BadStatus => e
699
717
  raise ::Google::Cloud::Error.from_error(e)
@@ -787,7 +805,6 @@ module Google
787
805
 
788
806
  @metric_service_stub.call_rpc :delete_metric_descriptor, request, options: options do |response, operation|
789
807
  yield response, operation if block_given?
790
- return response
791
808
  end
792
809
  rescue ::GRPC::BadStatus => e
793
810
  raise ::Google::Cloud::Error.from_error(e)
@@ -921,7 +938,7 @@ module Google
921
938
  @metric_service_stub.call_rpc :list_time_series, request, options: options do |response, operation|
922
939
  response = ::Gapic::PagedEnumerable.new @metric_service_stub, :list_time_series, request, response, operation, options
923
940
  yield response, operation if block_given?
924
- return response
941
+ throw :response, response
925
942
  end
926
943
  rescue ::GRPC::BadStatus => e
927
944
  raise ::Google::Cloud::Error.from_error(e)
@@ -1025,7 +1042,6 @@ module Google
1025
1042
 
1026
1043
  @metric_service_stub.call_rpc :create_time_series, request, options: options do |response, operation|
1027
1044
  yield response, operation if block_given?
1028
- return response
1029
1045
  end
1030
1046
  rescue ::GRPC::BadStatus => e
1031
1047
  raise ::Google::Cloud::Error.from_error(e)
@@ -1131,7 +1147,6 @@ module Google
1131
1147
 
1132
1148
  @metric_service_stub.call_rpc :create_service_time_series, request, options: options do |response, operation|
1133
1149
  yield response, operation if block_given?
1134
- return response
1135
1150
  end
1136
1151
  rescue ::GRPC::BadStatus => e
1137
1152
  raise ::Google::Cloud::Error.from_error(e)
@@ -1220,6 +1235,11 @@ module Google
1220
1235
  # default endpoint URL. The default value of nil uses the environment
1221
1236
  # universe (usually the default "googleapis.com" universe).
1222
1237
  # @return [::String,nil]
1238
+ # @!attribute [rw] logger
1239
+ # A custom logger to use for request/response debug logging, or the value
1240
+ # `:default` (the default) to construct a default logger, or `nil` to
1241
+ # explicitly disable logging.
1242
+ # @return [::Logger,:default,nil]
1223
1243
  #
1224
1244
  class Configuration
1225
1245
  extend ::Gapic::Config
@@ -1244,6 +1264,7 @@ module Google
1244
1264
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
1245
1265
  config_attr :quota_project, nil, ::String, nil
1246
1266
  config_attr :universe_domain, nil, ::String, nil
1267
+ config_attr :logger, :default, ::Logger, nil, :default
1247
1268
 
1248
1269
  # @private
1249
1270
  def initialize parent_config = nil
@@ -199,8 +199,28 @@ module Google
199
199
  universe_domain: @config.universe_domain,
200
200
  channel_args: @config.channel_args,
201
201
  interceptors: @config.interceptors,
202
- channel_pool_config: @config.channel_pool
202
+ channel_pool_config: @config.channel_pool,
203
+ logger: @config.logger
203
204
  )
205
+
206
+ @notification_channel_service_stub.stub_logger&.info do |entry|
207
+ entry.set_system_name
208
+ entry.set_service
209
+ entry.message = "Created client for #{entry.service}"
210
+ entry.set_credentials_fields credentials
211
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
212
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
213
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
214
+ end
215
+ end
216
+
217
+ ##
218
+ # The logger used for request/response debug logging.
219
+ #
220
+ # @return [Logger]
221
+ #
222
+ def logger
223
+ @notification_channel_service_stub.logger
204
224
  end
205
225
 
206
226
  # Service calls
@@ -309,7 +329,7 @@ module Google
309
329
  @notification_channel_service_stub.call_rpc :list_notification_channel_descriptors, request, options: options do |response, operation|
310
330
  response = ::Gapic::PagedEnumerable.new @notification_channel_service_stub, :list_notification_channel_descriptors, request, response, operation, options
311
331
  yield response, operation if block_given?
312
- return response
332
+ throw :response, response
313
333
  end
314
334
  rescue ::GRPC::BadStatus => e
315
335
  raise ::Google::Cloud::Error.from_error(e)
@@ -398,7 +418,6 @@ module Google
398
418
 
399
419
  @notification_channel_service_stub.call_rpc :get_notification_channel_descriptor, request, options: options do |response, operation|
400
420
  yield response, operation if block_given?
401
- return response
402
421
  end
403
422
  rescue ::GRPC::BadStatus => e
404
423
  raise ::Google::Cloud::Error.from_error(e)
@@ -523,7 +542,7 @@ module Google
523
542
  @notification_channel_service_stub.call_rpc :list_notification_channels, request, options: options do |response, operation|
524
543
  response = ::Gapic::PagedEnumerable.new @notification_channel_service_stub, :list_notification_channels, request, response, operation, options
525
544
  yield response, operation if block_given?
526
- return response
545
+ throw :response, response
527
546
  end
528
547
  rescue ::GRPC::BadStatus => e
529
548
  raise ::Google::Cloud::Error.from_error(e)
@@ -615,7 +634,6 @@ module Google
615
634
 
616
635
  @notification_channel_service_stub.call_rpc :get_notification_channel, request, options: options do |response, operation|
617
636
  yield response, operation if block_given?
618
- return response
619
637
  end
620
638
  rescue ::GRPC::BadStatus => e
621
639
  raise ::Google::Cloud::Error.from_error(e)
@@ -718,7 +736,6 @@ module Google
718
736
 
719
737
  @notification_channel_service_stub.call_rpc :create_notification_channel, request, options: options do |response, operation|
720
738
  yield response, operation if block_given?
721
- return response
722
739
  end
723
740
  rescue ::GRPC::BadStatus => e
724
741
  raise ::Google::Cloud::Error.from_error(e)
@@ -815,7 +832,6 @@ module Google
815
832
 
816
833
  @notification_channel_service_stub.call_rpc :update_notification_channel, request, options: options do |response, operation|
817
834
  yield response, operation if block_given?
818
- return response
819
835
  end
820
836
  rescue ::GRPC::BadStatus => e
821
837
  raise ::Google::Cloud::Error.from_error(e)
@@ -913,7 +929,6 @@ module Google
913
929
 
914
930
  @notification_channel_service_stub.call_rpc :delete_notification_channel, request, options: options do |response, operation|
915
931
  yield response, operation if block_given?
916
- return response
917
932
  end
918
933
  rescue ::GRPC::BadStatus => e
919
934
  raise ::Google::Cloud::Error.from_error(e)
@@ -1000,7 +1015,6 @@ module Google
1000
1015
 
1001
1016
  @notification_channel_service_stub.call_rpc :send_notification_channel_verification_code, request, options: options do |response, operation|
1002
1017
  yield response, operation if block_given?
1003
- return response
1004
1018
  end
1005
1019
  rescue ::GRPC::BadStatus => e
1006
1020
  raise ::Google::Cloud::Error.from_error(e)
@@ -1118,7 +1132,6 @@ module Google
1118
1132
 
1119
1133
  @notification_channel_service_stub.call_rpc :get_notification_channel_verification_code, request, options: options do |response, operation|
1120
1134
  yield response, operation if block_given?
1121
- return response
1122
1135
  end
1123
1136
  rescue ::GRPC::BadStatus => e
1124
1137
  raise ::Google::Cloud::Error.from_error(e)
@@ -1214,7 +1227,6 @@ module Google
1214
1227
 
1215
1228
  @notification_channel_service_stub.call_rpc :verify_notification_channel, request, options: options do |response, operation|
1216
1229
  yield response, operation if block_given?
1217
- return response
1218
1230
  end
1219
1231
  rescue ::GRPC::BadStatus => e
1220
1232
  raise ::Google::Cloud::Error.from_error(e)
@@ -1303,6 +1315,11 @@ module Google
1303
1315
  # default endpoint URL. The default value of nil uses the environment
1304
1316
  # universe (usually the default "googleapis.com" universe).
1305
1317
  # @return [::String,nil]
1318
+ # @!attribute [rw] logger
1319
+ # A custom logger to use for request/response debug logging, or the value
1320
+ # `:default` (the default) to construct a default logger, or `nil` to
1321
+ # explicitly disable logging.
1322
+ # @return [::Logger,:default,nil]
1306
1323
  #
1307
1324
  class Configuration
1308
1325
  extend ::Gapic::Config
@@ -1327,6 +1344,7 @@ module Google
1327
1344
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
1328
1345
  config_attr :quota_project, nil, ::String, nil
1329
1346
  config_attr :universe_domain, nil, ::String, nil
1347
+ config_attr :logger, :default, ::Logger, nil, :default
1330
1348
 
1331
1349
  # @private
1332
1350
  def initialize parent_config = nil
@@ -157,14 +157,39 @@ module Google
157
157
  universe_domain: @config.universe_domain,
158
158
  channel_args: @config.channel_args,
159
159
  interceptors: @config.interceptors,
160
- channel_pool_config: @config.channel_pool
160
+ channel_pool_config: @config.channel_pool,
161
+ logger: @config.logger
161
162
  )
163
+
164
+ @query_service_stub.stub_logger&.info do |entry|
165
+ entry.set_system_name
166
+ entry.set_service
167
+ entry.message = "Created client for #{entry.service}"
168
+ entry.set_credentials_fields credentials
169
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
170
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
171
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
172
+ end
173
+ end
174
+
175
+ ##
176
+ # The logger used for request/response debug logging.
177
+ #
178
+ # @return [Logger]
179
+ #
180
+ def logger
181
+ @query_service_stub.logger
162
182
  end
163
183
 
164
184
  # Service calls
165
185
 
166
186
  ##
167
- # Queries time series using Monitoring Query Language.
187
+ # Queries time series by using Monitoring Query Language (MQL). We recommend
188
+ # using PromQL instead of MQL. For more information about the status of MQL,
189
+ # see the [MQL deprecation
190
+ # notice](https://cloud.google.com/stackdriver/docs/deprecations/mql).
191
+ #
192
+ # @deprecated This method is deprecated and may be removed in the next major version update.
168
193
  #
169
194
  # @overload query_time_series(request, options = nil)
170
195
  # Pass arguments to `query_time_series` via a request object, either of type
@@ -262,7 +287,7 @@ module Google
262
287
  @query_service_stub.call_rpc :query_time_series, request, options: options do |response, operation|
263
288
  response = ::Gapic::PagedEnumerable.new @query_service_stub, :query_time_series, request, response, operation, options
264
289
  yield response, operation if block_given?
265
- return response
290
+ throw :response, response
266
291
  end
267
292
  rescue ::GRPC::BadStatus => e
268
293
  raise ::Google::Cloud::Error.from_error(e)
@@ -351,6 +376,11 @@ module Google
351
376
  # default endpoint URL. The default value of nil uses the environment
352
377
  # universe (usually the default "googleapis.com" universe).
353
378
  # @return [::String,nil]
379
+ # @!attribute [rw] logger
380
+ # A custom logger to use for request/response debug logging, or the value
381
+ # `:default` (the default) to construct a default logger, or `nil` to
382
+ # explicitly disable logging.
383
+ # @return [::Logger,:default,nil]
354
384
  #
355
385
  class Configuration
356
386
  extend ::Gapic::Config
@@ -375,6 +405,7 @@ module Google
375
405
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
376
406
  config_attr :quota_project, nil, ::String, nil
377
407
  config_attr :universe_domain, nil, ::String, nil
408
+ config_attr :logger, :default, ::Logger, nil, :default
378
409
 
379
410
  # @private
380
411
  def initialize parent_config = nil