google-cloud-error_reporting 0.31.7 → 0.32.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: 1569c000e3233e3a1ecee4f2591ff47992f664b6fb3a703bdb318dd4b15402bd
4
- data.tar.gz: d2e2e3b55d55eb7f4702d3cff8041e90b59c26d1fdf2870d62c1609419a5c312
3
+ metadata.gz: 96a8b2ba7e135e4e92d2214792fa1e984be8e651f9b807369e8b4b6ba85288cf
4
+ data.tar.gz: c5a07ee5288fe0914460c57b21b25c7c21505d6569a03da05752ac14389c8556
5
5
  SHA512:
6
- metadata.gz: 6abbed2d8a391daf2a8eddc41df0e2499266e2c4adb74e980c0f21f8c63f9a3e01bb6fde7831a3caa13c3567f378906873d4c4453f6047f44a9eec3a41e785cc
7
- data.tar.gz: 38db4c543e57d97489126e7c5f313e3fb9ba0a04a0e65ea9465dbb1121d9ed6619276f6f56f1b37b4d515ec75a9672e5f610e5ce0f88b6fa5442d69ee4ac56c0
6
+ metadata.gz: ea52d976179d1cf59e0f7b5a601cf0c5a760ec2596ddf966a18ac678913dfca9a5ec16e83fe0a5998c6bb14ef5d1d4a8e6d9b8cec5f5db2a70a7d3ded4b2ab49
7
+ data.tar.gz: 91ab3a7c056f6bf1157e4d495bd8e985601571bf131e274627ad94d2fd2a2818a44633bc43b5a5ca1e66ed0eeaa42383353019d0200bed443d8310d6036f3916
@@ -1,5 +1,15 @@
1
1
  # Release History
2
2
 
3
+ ### 0.32.0 / 2019-08-23
4
+
5
+ #### Features
6
+
7
+ * Support overriding of service endpoint
8
+
9
+ #### Documentation
10
+
11
+ * Update documentation
12
+
3
13
  ### 0.31.7 / 2019-07-31
4
14
 
5
15
  * Fix max threads setting in thread pools
@@ -26,7 +26,7 @@ you want to run on a non Google Cloud environment or you want to customize the
26
26
  default behavior.
27
27
 
28
28
  See the [Configuration
29
- Guide](https://googleapis.dev/ruby/stackdriver/INSTRUMENTATION_CONFIGURATION/latest)
29
+ Guide](https://googleapis.dev/ruby/stackdriver/latest/file.INSTRUMENTATION_CONFIGURATION.html)
30
30
  for full configuration parameters.
31
31
 
32
32
  ## Rack Middleware and Railtie
@@ -48,7 +48,7 @@ require "google/cloud/error_reporting/rails"
48
48
  ```
49
49
 
50
50
  Alternatively, check out the
51
- [stackdriver](https://googleapis.dev/ruby/stackdriver/latest/file.README.html
51
+ [stackdriver](https://googleapis.dev/ruby/stackdriver/latest
52
52
  gem, which enables this Railtie by default.
53
53
 
54
54
  ### Rack Integration
@@ -158,6 +158,7 @@ Google::Cloud.configure.add_config! :error_reporting do |config|
158
158
  config.add_field! :scope, nil, match: [String, Array]
159
159
  config.add_field! :timeout, nil, match: Integer
160
160
  config.add_field! :client_config, nil, match: Hash
161
+ config.add_field! :endpoint, nil, match: String
161
162
  config.add_field! :service_name, default_service,
162
163
  match: String, allow_nil: true
163
164
  config.add_field! :service_version, default_version,
@@ -62,6 +62,8 @@ module Google
62
62
  # @param [Integer] timeout Default timeout to use in requests. Optional.
63
63
  # @param [Hash] client_config A hash of values to override the default
64
64
  # behavior of the API client. Optional.
65
+ # @param [String] endpoint Override of the endpoint host name. Optional.
66
+ # If the param is nil, uses the default endpoint.
65
67
  # @param [String] project Alias for the `project_id` argument. Deprecated.
66
68
  # @param [String] keyfile Alias for the `credentials` argument.
67
69
  # Deprecated.
@@ -75,29 +77,22 @@ module Google
75
77
  # # ...
76
78
  #
77
79
  def self.new project_id: nil, credentials: nil, scope: nil, timeout: nil,
78
- client_config: nil, project: nil, keyfile: nil
80
+ client_config: nil, endpoint: nil, project: nil, keyfile: nil
79
81
  project_id ||= project
80
82
  project_id ||= ErrorReporting::Project.default_project_id
81
83
  scope ||= configure.scope
82
84
  timeout ||= configure.timeout
83
85
  client_config ||= configure.client_config
86
+ endpoint ||= configure.endpoint
84
87
  credentials ||= (keyfile || default_credentials(scope: scope))
85
88
 
86
- unless credentials.is_a? Google::Auth::Credentials
87
- credentials = ErrorReporting::Credentials.new credentials,
88
- scope: scope
89
- end
90
-
91
- if credentials.respond_to? :project_id
92
- project_id ||= credentials.project_id
93
- end
94
- project_id = project_id.to_s
95
- raise ArgumentError, "project_id is missing" if project_id.empty?
89
+ credentials = resolve_credentials credentials, scope
90
+ project_id = resolve_project_id project_id, credentials
96
91
 
97
92
  ErrorReporting::Project.new(
98
93
  ErrorReporting::Service.new(
99
- project_id, credentials, timeout: timeout,
100
- client_config: client_config
94
+ project_id, credentials,
95
+ host: endpoint, timeout: timeout, client_config: client_config
101
96
  )
102
97
  )
103
98
  end
@@ -123,6 +118,8 @@ module Google
123
118
  # * `timeout` - (Integer) Default timeout to use in requests.
124
119
  # * `client_config` - (Hash) A hash of values to override the default
125
120
  # behavior of the API client.
121
+ # * `endpoint` - (String) Override of the endpoint host name, or `nil`
122
+ # to use the default endpoint.
126
123
  # * `service_name` - (String) Name for the application.
127
124
  # * `service_version` - (String) Version identifier for the application.
128
125
  # * `ignore_classes` - (Array<Exception>) Array of exception types that
@@ -230,6 +227,31 @@ module Google
230
227
  default_client.report error_event
231
228
  end
232
229
 
230
+ ##
231
+ # @private Resolve credentials
232
+ def self.resolve_credentials credentials, scope
233
+ unless credentials.is_a? Google::Auth::Credentials
234
+ credentials = ErrorReporting::Credentials.new credentials,
235
+ scope: scope
236
+ end
237
+ credentials
238
+ end
239
+
240
+ private_class_method :resolve_credentials
241
+
242
+ ##
243
+ # @private Resolve project.
244
+ def self.resolve_project_id project_id, credentials
245
+ if credentials.respond_to? :project_id
246
+ project_id ||= credentials.project_id
247
+ end
248
+ project_id = project_id.to_s
249
+ raise ArgumentError, "project_id is missing" if project_id.empty?
250
+ project_id
251
+ end
252
+
253
+ private_class_method :resolve_project_id
254
+
233
255
  ##
234
256
  # @private Create a private client to
235
257
  def self.default_client
@@ -17,6 +17,7 @@ require "google/cloud/errors"
17
17
  require "google/cloud/error_reporting/version"
18
18
  require "google/cloud/error_reporting/v1beta1"
19
19
  require "google/gax/errors"
20
+ require "uri"
20
21
 
21
22
  module Google
22
23
  module Cloud
@@ -25,15 +26,17 @@ module Google
25
26
  # @private Represents the gRPC Error Reporting service, including all the
26
27
  # API methods.
27
28
  class Service
28
- attr_accessor :project, :credentials, :timeout, :client_config
29
+ attr_accessor :project, :credentials, :timeout, :client_config, :host
29
30
 
30
31
  ##
31
32
  # Creates a new Service instance.
32
- def initialize project, credentials, timeout: nil, client_config: nil
33
+ def initialize project, credentials, timeout: nil, client_config: nil,
34
+ host: nil
33
35
  @project = project
34
36
  @credentials = credentials
35
37
  @timeout = timeout
36
38
  @client_config = client_config || {}
39
+ @host = host || V1beta1::ReportErrorsServiceClient::SERVICE_ADDRESS
37
40
  end
38
41
 
39
42
  def error_reporting
@@ -43,6 +46,8 @@ module Google
43
46
  credentials: credentials,
44
47
  timeout: timeout,
45
48
  client_config: client_config,
49
+ service_address: service_address,
50
+ service_port: service_port,
46
51
  lib_name: "gccl",
47
52
  lib_version: Google::Cloud::ErrorReporting::VERSION
48
53
  )
@@ -83,6 +88,16 @@ module Google
83
88
 
84
89
  protected
85
90
 
91
+ def service_address
92
+ return nil if host.nil?
93
+ URI.parse("//#{host}").host
94
+ end
95
+
96
+ def service_port
97
+ return nil if host.nil?
98
+ URI.parse("//#{host}").port
99
+ end
100
+
86
101
  def project_path
87
102
  V1beta1::ReportErrorsServiceClient.project_path project
88
103
  end
@@ -16,7 +16,7 @@
16
16
  module Google
17
17
  module Cloud
18
18
  module ErrorReporting
19
- VERSION = "0.31.7".freeze
19
+ VERSION = "0.32.0".freeze
20
20
  end
21
21
  end
22
22
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: google-cloud-error_reporting
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.31.7
4
+ version: 0.32.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Google Inc
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-08-01 00:00:00.000000000 Z
11
+ date: 2019-08-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: google-cloud-core