google-cloud-debugger 0.40.0 → 0.42.2

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: 1b4ce08aa3118de8cc2a1afe7874ca26f6d97a7922f84471caef85fe0aed3640
4
- data.tar.gz: a6bc54a758686120fe5898e69179994e3325e72adf5c9e3b8ef4b0b010a5c9d6
3
+ metadata.gz: 2d4b08e7a1f34cc84bf9d7c614d749e7bc1dee4ab2fa334120703c95b1ff2576
4
+ data.tar.gz: d48b399e55c3fcad4120fc546074d192d17f4bc75545fd63e06874c0f9a35533
5
5
  SHA512:
6
- metadata.gz: 150edcd3b7d9c16480900ac16d22925eaf08c1629ac40c601d308da5e3db74237dbacd6510c9357861650d8fe519239c53c361448e3f6d005058313c1e442909
7
- data.tar.gz: ce89d0b2545e87b7587b8887a6eafe1dead96614616437ce2709f60a83780a38607990687caf74398a219093d019f68bcd615aac469e1b35efec732c71141508
6
+ metadata.gz: ee34e243d7631e421065982d6d444b31400031708cd77be57daffdfe9693f682e5d8c4a1432dde1f2a6c2ce324adfefc444b8f2401d7fe9da0f75b70180440c0
7
+ data.tar.gz: e551a48d39f8a689667a7c8f6e6ac25f937759cc6a1ee2963a7cab91ac690d030449da7c1195f18bf8abb6372cc4bad1ad44bcda1149ff8fce42789253b174f5
data/AUTHENTICATION.md CHANGED
@@ -96,7 +96,8 @@ client = Google::Cloud::Debugger.new
96
96
 
97
97
  ### Configuration
98
98
 
99
- The **Project ID** and **Credentials JSON** can be configured instead of placing them in environment variables or providing them as arguments.
99
+ The **Project ID** and the path to the **Credentials JSON** file can be configured
100
+ instead of placing them in environment variables or providing them as arguments.
100
101
 
101
102
  ```ruby
102
103
  require "google/cloud/debugger"
data/CHANGELOG.md CHANGED
@@ -1,5 +1,29 @@
1
1
  # Release History
2
2
 
3
+ ### 0.42.2 / 2021-10-21
4
+
5
+ #### Documentation
6
+
7
+ * Add documentation for quota_project Configuration attribute
8
+
9
+ ### 0.42.1 / 2021-07-08
10
+
11
+ #### Documentation
12
+
13
+ * Update AUTHENTICATION.md in handwritten packages
14
+
15
+ ### 0.42.0 / 2021-03-31
16
+
17
+ #### Features
18
+
19
+ * Drop support for Ruby 2.4 and note that Ruby 3.0 is also unsupported
20
+
21
+ ### 0.41.0 / 2020-09-16
22
+
23
+ #### Features
24
+
25
+ * quota_project can be set via library configuration
26
+
3
27
  ### 0.40.0 / 2020-07-21
4
28
 
5
29
  This is a major update that removes the "low-level" client interface code, and
data/CONTRIBUTING.md CHANGED
@@ -24,9 +24,9 @@ be able to accept your pull requests.
24
24
  In order to use the google-cloud-debugger console and run the project's tests,
25
25
  there is a small amount of setup:
26
26
 
27
- 1. Install Ruby. google-cloud-debugger requires Ruby 2.4+. You may choose to
28
- manage your Ruby and gem installations with [RVM](https://rvm.io/),
29
- [rbenv](https://github.com/rbenv/rbenv), or
27
+ 1. Install Ruby. google-cloud-debugger requires Ruby 2.5+. It is not currently
28
+ supported on Ruby 3. You may choose to manage your Ruby and gem installations
29
+ with [RVM](https://rvm.io/), [rbenv](https://github.com/rbenv/rbenv), or
30
30
  [chruby](https://github.com/postmodern/chruby).
31
31
 
32
32
  2. Install [Bundler](http://bundler.io/).
@@ -45,7 +45,7 @@ there is a small amount of setup:
45
45
 
46
46
  ```sh
47
47
  $ cd google-cloud-debugger/
48
- $ bundle exec rake bundleupdate
48
+ $ bundle install
49
49
  ```
50
50
 
51
51
  ## Console
@@ -119,7 +119,7 @@ If you alter an example's title, you may encounter breaking tests.
119
119
  ### Debugger Acceptance Tests
120
120
 
121
121
  The Debugger acceptance tests interact with the live service API. Follow the
122
- instructions in the {file:AUTHENTICATION.md Authentication guide} for enabling
122
+ instructions in the {file:AUTHENTICATION.md Authentication Guide} for enabling
123
123
  the Debugger API. Occasionally, some API features may not yet be generally
124
124
  available, making it difficult for some contributors to successfully run the
125
125
  entire acceptance test suite. However, please ensure that you do successfully
@@ -184,5 +184,4 @@ $ bundle exec rake rubocop
184
184
  ## Code of Conduct
185
185
 
186
186
  Please note that this project is released with a Contributor Code of Conduct. By
187
- participating in this project you agree to abide by its terms. See
188
- {file:CODE_OF_CONDUCT.md Code of Conduct} for more information.
187
+ participating in this project you agree to abide by its terms. See {file:CODE_OF_CONDUCT.md Code of Conduct} for more information.
data/LOGGING.md CHANGED
@@ -3,7 +3,7 @@
3
3
  To enable logging for this library, set the logger for the underlying
4
4
  [gRPC](https://github.com/grpc/grpc/tree/master/src/ruby) library. The logger
5
5
  that you set may be a Ruby stdlib
6
- [`Logger`](https://ruby-doc.org/stdlib-2.5.0/libdoc/logger/rdoc/Logger.html) as
6
+ [`Logger`](https://ruby-doc.org/stdlib/libdoc/logger/rdoc/Logger.html) as
7
7
  shown below, or a
8
8
  [`Google::Cloud::Logging::Logger`](https://googleapis.dev/ruby/google-cloud-logging/latest)
9
9
  that will write logs to [Stackdriver
@@ -120,7 +120,10 @@ module Google
120
120
  # @param [String] app_root Absolute path to the root directory of
121
121
  # the debuggee application. Default to Rack root.
122
122
  #
123
- def initialize service, logger: nil, service_name:, service_version:,
123
+ def initialize service,
124
+ service_name:,
125
+ service_version:,
126
+ logger: nil,
124
127
  app_root: nil
125
128
  super()
126
129
 
@@ -849,20 +849,18 @@ module Google
849
849
  # do evaluation in a new thread, where function calls can be
850
850
  # traced.
851
851
  thr = Thread.new do
852
- begin
853
- Thread.current.thread_variable_set EVALUATOR_REFERENCE, self
854
- binding.eval wrap_expression(expression)
855
- rescue StandardError, EvaluationError => e
856
- # Treat all StandardError as mutation and set @mutation_cause
857
- unless e.instance_variable_get :@mutation_cause
858
- e.instance_variable_set(
859
- :@mutation_cause,
860
- Google::Cloud::Debugger::EvaluationError::UNKNOWN_CAUSE
861
- )
862
- end
863
-
864
- e
852
+ Thread.current.thread_variable_set EVALUATOR_REFERENCE, self
853
+ binding.eval wrap_expression(expression)
854
+ rescue StandardError, EvaluationError => e
855
+ # Treat all StandardError as mutation and set @mutation_cause
856
+ unless e.instance_variable_get :@mutation_cause
857
+ e.instance_variable_set(
858
+ :@mutation_cause,
859
+ Google::Cloud::Debugger::EvaluationError::UNKNOWN_CAUSE
860
+ )
865
861
  end
862
+
863
+ e
866
864
  end
867
865
 
868
866
  thr.join @time_limit
@@ -942,7 +940,7 @@ module Google
942
940
  ##
943
941
  # @private Wraps expression with tracing code
944
942
  def wrap_expression expression
945
- """
943
+ <<~CODE
946
944
  begin
947
945
  ::Google::Cloud::Debugger::Breakpoint::Evaluator.send(
948
946
  :enable_method_trace_for_thread)
@@ -951,11 +949,9 @@ module Google
951
949
  ::Google::Cloud::Debugger::Breakpoint::Evaluator.send(
952
950
  :disable_method_trace_for_thread)
953
951
  end
954
- """
952
+ CODE
955
953
  end
956
954
 
957
- # rubocop:disable Layout/RescueEnsureAlignment
958
-
959
955
  ##
960
956
  # @private Evaluation tracing callback function. This is called
961
957
  # everytime a Ruby function is called during evaluation of
@@ -994,8 +990,6 @@ module Google
994
990
  )
995
991
  end
996
992
 
997
- # rubocop:enable Layout/RescueEnsureAlignment
998
-
999
993
  ##
1000
994
  # @private Evaluation tracing callback function. This is called
1001
995
  # everytime a C function is called during evaluation of
@@ -1011,12 +1005,12 @@ module Google
1011
1005
  #
1012
1006
  def trace_c_func_callback receiver, defined_class, mid
1013
1007
  return if @allow_mutating_methods
1014
- if receiver.is_a?(Class) || receiver.is_a?(Module)
1015
- invalid_op =
1008
+ invalid_op =
1009
+ if receiver.is_a?(Class) || receiver.is_a?(Module)
1016
1010
  !validate_c_class_method(defined_class, receiver, mid)
1017
- else
1018
- invalid_op = !validate_c_instance_method(defined_class, mid)
1019
- end
1011
+ else
1012
+ !validate_c_instance_method(defined_class, mid)
1013
+ end
1020
1014
 
1021
1015
  return unless invalid_op
1022
1016
 
@@ -37,7 +37,8 @@ module Google
37
37
 
38
38
  ##
39
39
  # @private Create an empty SourceLocation object.
40
- def initialize; end
40
+ def initialize
41
+ end
41
42
 
42
43
  ##
43
44
  # @private New Google::Cloud::Debugger::Breakpoint::SourceLocation
@@ -53,8 +54,7 @@ module Google
53
54
  ##
54
55
  # @private Determines if the SourceLocation has any data.
55
56
  def empty?
56
- path.nil? &&
57
- line.nil?
57
+ path.nil? && line.nil?
58
58
  end
59
59
 
60
60
  ##
@@ -244,7 +244,7 @@ module Google
244
244
 
245
245
  # If source is a non-empty Array or Hash, or source has instance
246
246
  # variables, evaluate source as a compound variable.
247
- if compound_var?(source) && depth > 0
247
+ if compound_var?(source) && depth.positive?
248
248
  from_compound_var source, name: name, depth: depth,
249
249
  var_table: var_table, limit: limit
250
250
  else
@@ -358,9 +358,7 @@ module Google
358
358
 
359
359
  limit = deduct_limit limit, member_var.total_size
360
360
 
361
- buffer_full = (limit && limit < 0) ||
362
- i >= MAX_MEMBERS ||
363
- member_var.buffer_full_variable?
361
+ buffer_full = limit&.negative? || i >= MAX_MEMBERS || member_var.buffer_full_variable?
364
362
 
365
363
  if buffer_full
366
364
  var.members << Variable.new.tap do |last_var|
@@ -384,8 +382,7 @@ module Google
384
382
  new.tap do |var|
385
383
  var.name = name if name
386
384
 
387
- if var_table && var_table.first &&
388
- var_table.first.buffer_full_variable?
385
+ if var_table&.first&.buffer_full_variable?
389
386
  var.var_table = var_table
390
387
  var.var_table_index = 0
391
388
  else
@@ -68,7 +68,7 @@ module Google
68
68
  # object_id, return the array index if found.
69
69
  def rb_var_index rb_var
70
70
  variables.each_with_index do |var, i|
71
- return i if var.source_var.object_id == rb_var.object_id
71
+ return i if var.source_var.equal? rb_var
72
72
  end
73
73
 
74
74
  nil
@@ -265,7 +265,7 @@ module Google
265
265
  def valid?
266
266
  Validator.validate self unless complete?
267
267
 
268
- status && status.is_error ? false : true
268
+ status&.is_error ? false : true
269
269
  end
270
270
 
271
271
  ##
@@ -154,7 +154,7 @@ module Google
154
154
  @debugger.agent.tracer.disable_traces_for_thread
155
155
 
156
156
  # Reset quotas after each request finishes.
157
- @debugger.agent.quota_manager.reset if @debugger.agent.quota_manager
157
+ @debugger.agent.quota_manager&.reset
158
158
  end
159
159
 
160
160
  private
@@ -151,13 +151,13 @@ module Google
151
151
  Debugger::Credentials.new credentials
152
152
  end
153
153
  rescue StandardError => e
154
- STDOUT.puts "Note: Google::Cloud::Debugger is disabled because " \
154
+ $stdout.puts "Note: Google::Cloud::Debugger is disabled because " \
155
155
  "it failed to authorize with the service. (#{e.message})"
156
156
  return false
157
157
  end
158
158
 
159
159
  if project_id.to_s.empty?
160
- STDOUT.puts "Note: Google::Cloud::Debugger is disabled because " \
160
+ $stdout.puts "Note: Google::Cloud::Debugger is disabled because " \
161
161
  "the project ID could not be determined."
162
162
  return false
163
163
  end
@@ -25,7 +25,10 @@ module Google
25
25
  # @private Represents the gRPC Debugger service, including all the API
26
26
  # methods.
27
27
  class Service
28
- attr_accessor :project, :credentials, :timeout, :host
28
+ attr_accessor :project
29
+ attr_accessor :credentials
30
+ attr_accessor :timeout
31
+ attr_accessor :host
29
32
 
30
33
  ##
31
34
  # Creates a new Service instance.
@@ -33,11 +33,11 @@ module Google
33
33
 
34
34
  ##
35
35
  # Max size of payload a Snappoint collects
36
- MAX_PAYLOAD_SIZE = 32768 # 32KB
36
+ MAX_PAYLOAD_SIZE = 32_768 # 32KB
37
37
 
38
38
  ##
39
39
  # @private Max size an evaluated expression variable is allowed to be
40
- MAX_EXPRESSION_LIMIT = 32768 # 32KB
40
+ MAX_EXPRESSION_LIMIT = 32_768 # 32KB
41
41
 
42
42
  ##
43
43
  # @private Max size a normal evaluated variable is allowed to be
@@ -56,8 +56,7 @@ module Google
56
56
  # variable at index 0. This variable will be shared by other variable
57
57
  # evaluations if this Snappoint exceeds size limit.
58
58
  def init_var_table
59
- return if @variable_table[0] &&
60
- @variable_table[0].buffer_full_variable?
59
+ return if @variable_table[0]&.buffer_full_variable?
61
60
 
62
61
  buffer_full_var = Variable.buffer_full_variable
63
62
  @variable_table.variables.unshift buffer_full_var
@@ -179,11 +178,9 @@ module Google
179
178
  end
180
179
  end
181
180
 
182
- result = variable_table.variables.inject result do |sum, var|
181
+ variable_table.variables.inject result do |sum, var|
183
182
  sum + var.payload_size
184
183
  end
185
-
186
- result
187
184
  end
188
185
 
189
186
  ##
@@ -132,7 +132,7 @@ module Google
132
132
  # @return [boolean] `true` when started, `false` otherwise.
133
133
  #
134
134
  def started?
135
- @thread_pool.running? if @thread_pool
135
+ @thread_pool&.running?
136
136
  end
137
137
 
138
138
  ##
@@ -16,7 +16,7 @@
16
16
  module Google
17
17
  module Cloud
18
18
  module Debugger
19
- VERSION = "0.40.0".freeze
19
+ VERSION = "0.42.2".freeze
20
20
  end
21
21
  end
22
22
  end
@@ -143,6 +143,8 @@ module Google
143
143
  # absolute file path.
144
144
  # * `scope` - (String, Array<String>) The OAuth 2.0 scopes controlling
145
145
  # the set of resources and operations that the connection can access.
146
+ # * `quota_project` - (String) The project ID for a project that can be
147
+ # used by client libraries for quota and billing purposes.
146
148
  # * `timeout` - (Integer) Default timeout to use in requests.
147
149
  # * `endpoint` - (String) Override of the endpoint host name, or `nil`
148
150
  # to use the default endpoint.
@@ -173,6 +173,7 @@ Google::Cloud.configure.add_config! :debugger do |config|
173
173
  config.add_field! :app_root, nil, match: String
174
174
  config.add_field! :root, nil, match: String
175
175
  config.add_field! :scope, default_scopes, match: [String, Array]
176
+ config.add_field! :quota_project, nil, match: String
176
177
  config.add_field! :timeout, nil, match: Integer
177
178
  config.add_field! :endpoint, "clouddebugger.googleapis.com", match: String
178
179
  config.add_field! :allow_mutating_methods, false
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: google-cloud-debugger
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.40.0
4
+ version: 0.42.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Heng Xiong
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-07-21 00:00:00.000000000 Z
11
+ date: 2021-10-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: binding_of_caller
@@ -100,14 +100,14 @@ dependencies:
100
100
  requirements:
101
101
  - - "~>"
102
102
  - !ruby/object:Gem::Version
103
- version: 1.24.0
103
+ version: 1.25.1
104
104
  type: :development
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
108
  - - "~>"
109
109
  - !ruby/object:Gem::Version
110
- version: 1.24.0
110
+ version: 1.25.1
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: minitest
113
113
  requirement: !ruby/object:Gem::Requirement
@@ -337,16 +337,16 @@ require_paths:
337
337
  - lib
338
338
  required_ruby_version: !ruby/object:Gem::Requirement
339
339
  requirements:
340
- - - ">="
340
+ - - "~>"
341
341
  - !ruby/object:Gem::Version
342
- version: '2.4'
342
+ version: '2.5'
343
343
  required_rubygems_version: !ruby/object:Gem::Requirement
344
344
  requirements:
345
345
  - - ">="
346
346
  - !ruby/object:Gem::Version
347
347
  version: '0'
348
348
  requirements: []
349
- rubygems_version: 3.1.3
349
+ rubygems_version: 3.2.17
350
350
  signing_key:
351
351
  specification_version: 4
352
352
  summary: API Client and instrumentation library for Stackdriver Debugger