google-cloud-trace-v1 1.0.1 → 1.1.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: e37a189c3942341a0a1909ec58de0ef41401a1ea9c64a8821df52078d7d03f00
4
- data.tar.gz: 633a14f679e3576c53ac8cabbaa85ee25d23ce504367ea28f9a9f30ac87b59b8
3
+ metadata.gz: 7c2f38653688a56f9cf7b2f0bfa326e2519b04a4b3f3c2aa943df617f29c4804
4
+ data.tar.gz: 4926a21aa721fac58ac7701c0801b95dd2abe183c72096ff2f2b233a8dd3c8db
5
5
  SHA512:
6
- metadata.gz: abbc05b17cd2db4d11bb4ccdf87fd6629e33b28b783e456d2c1a651c8c75c519629ea4723b6ad3ff1732d380a811885c8985d23bacb211c6883c48a53c682e08
7
- data.tar.gz: 031a0fbc456b034de1a9b00cda4dbbc4f6aeea9c01c83f06c23d0ac85c21190b21f69ef049ee534947ab68ad937630fdadb5c831adedd6cd293a3d14a22ddd1f
6
+ metadata.gz: 15e95f15368cc60faa24ef3b4dad64eeea63edb3304f6157f8b261a8d504536f7e06a9573f7f110a54dab02b69e2c91e91e260b3e0ef9706a2cb5869d57d8121
7
+ data.tar.gz: 548b64966fb83dcc0aa1b1f79fa12a46daeee5d6100dc62f7b501b5b7f41672c8e5b20dfa21ab7bc0d41e1cc1c5681f5eee38f6c4361031d6dce909aaf001bdd
data/README.md CHANGED
@@ -43,33 +43,43 @@ for class and method documentation.
43
43
  See also the [Product Documentation](https://cloud.google.com/trace)
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/trace/v1"
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::Trace::V1::TraceService::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).
@@ -174,8 +174,28 @@ module Google
174
174
  universe_domain: @config.universe_domain,
175
175
  channel_args: @config.channel_args,
176
176
  interceptors: @config.interceptors,
177
- channel_pool_config: @config.channel_pool
177
+ channel_pool_config: @config.channel_pool,
178
+ logger: @config.logger
178
179
  )
180
+
181
+ @trace_service_stub.stub_logger&.info do |entry|
182
+ entry.set_system_name
183
+ entry.set_service
184
+ entry.message = "Created client for #{entry.service}"
185
+ entry.set_credentials_fields credentials
186
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
187
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
188
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
189
+ end
190
+ end
191
+
192
+ ##
193
+ # The logger used for request/response debug logging.
194
+ #
195
+ # @return [Logger]
196
+ #
197
+ def logger
198
+ @trace_service_stub.logger
179
199
  end
180
200
 
181
201
  # Service calls
@@ -326,7 +346,7 @@ module Google
326
346
  @trace_service_stub.call_rpc :list_traces, request, options: options do |response, operation|
327
347
  response = ::Gapic::PagedEnumerable.new @trace_service_stub, :list_traces, request, response, operation, options
328
348
  yield response, operation if block_given?
329
- return response
349
+ throw :response, response
330
350
  end
331
351
  rescue ::GRPC::BadStatus => e
332
352
  raise ::Google::Cloud::Error.from_error(e)
@@ -417,7 +437,6 @@ module Google
417
437
 
418
438
  @trace_service_stub.call_rpc :get_trace, request, options: options do |response, operation|
419
439
  yield response, operation if block_given?
420
- return response
421
440
  end
422
441
  rescue ::GRPC::BadStatus => e
423
442
  raise ::Google::Cloud::Error.from_error(e)
@@ -509,7 +528,6 @@ module Google
509
528
 
510
529
  @trace_service_stub.call_rpc :patch_traces, request, options: options do |response, operation|
511
530
  yield response, operation if block_given?
512
- return response
513
531
  end
514
532
  rescue ::GRPC::BadStatus => e
515
533
  raise ::Google::Cloud::Error.from_error(e)
@@ -598,6 +616,11 @@ module Google
598
616
  # default endpoint URL. The default value of nil uses the environment
599
617
  # universe (usually the default "googleapis.com" universe).
600
618
  # @return [::String,nil]
619
+ # @!attribute [rw] logger
620
+ # A custom logger to use for request/response debug logging, or the value
621
+ # `:default` (the default) to construct a default logger, or `nil` to
622
+ # explicitly disable logging.
623
+ # @return [::Logger,:default,nil]
601
624
  #
602
625
  class Configuration
603
626
  extend ::Gapic::Config
@@ -622,6 +645,7 @@ module Google
622
645
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
623
646
  config_attr :quota_project, nil, ::String, nil
624
647
  config_attr :universe_domain, nil, ::String, nil
648
+ config_attr :logger, :default, ::Logger, nil, :default
625
649
 
626
650
  # @private
627
651
  def initialize parent_config = nil
@@ -167,8 +167,28 @@ module Google
167
167
  endpoint: @config.endpoint,
168
168
  endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
169
169
  universe_domain: @config.universe_domain,
170
- credentials: credentials
170
+ credentials: credentials,
171
+ logger: @config.logger
171
172
  )
173
+
174
+ @trace_service_stub.logger(stub: true)&.info do |entry|
175
+ entry.set_system_name
176
+ entry.set_service
177
+ entry.message = "Created client for #{entry.service}"
178
+ entry.set_credentials_fields credentials
179
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
180
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
181
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
182
+ end
183
+ end
184
+
185
+ ##
186
+ # The logger used for request/response debug logging.
187
+ #
188
+ # @return [Logger]
189
+ #
190
+ def logger
191
+ @trace_service_stub.logger
172
192
  end
173
193
 
174
194
  # Service calls
@@ -312,7 +332,7 @@ module Google
312
332
  @trace_service_stub.list_traces request, options do |result, operation|
313
333
  result = ::Gapic::Rest::PagedEnumerable.new @trace_service_stub, :list_traces, "traces", request, result, options
314
334
  yield result, operation if block_given?
315
- return result
335
+ throw :response, result
316
336
  end
317
337
  rescue ::Gapic::Rest::Error => e
318
338
  raise ::Google::Cloud::Error.from_error(e)
@@ -393,7 +413,6 @@ module Google
393
413
 
394
414
  @trace_service_stub.get_trace request, options do |result, operation|
395
415
  yield result, operation if block_given?
396
- return result
397
416
  end
398
417
  rescue ::Gapic::Rest::Error => e
399
418
  raise ::Google::Cloud::Error.from_error(e)
@@ -478,7 +497,6 @@ module Google
478
497
 
479
498
  @trace_service_stub.patch_traces request, options do |result, operation|
480
499
  yield result, operation if block_given?
481
- return result
482
500
  end
483
501
  rescue ::Gapic::Rest::Error => e
484
502
  raise ::Google::Cloud::Error.from_error(e)
@@ -558,6 +576,11 @@ module Google
558
576
  # default endpoint URL. The default value of nil uses the environment
559
577
  # universe (usually the default "googleapis.com" universe).
560
578
  # @return [::String,nil]
579
+ # @!attribute [rw] logger
580
+ # A custom logger to use for request/response debug logging, or the value
581
+ # `:default` (the default) to construct a default logger, or `nil` to
582
+ # explicitly disable logging.
583
+ # @return [::Logger,:default,nil]
561
584
  #
562
585
  class Configuration
563
586
  extend ::Gapic::Config
@@ -579,6 +602,7 @@ module Google
579
602
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
580
603
  config_attr :quota_project, nil, ::String, nil
581
604
  config_attr :universe_domain, nil, ::String, nil
605
+ config_attr :logger, :default, ::Logger, nil, :default
582
606
 
583
607
  # @private
584
608
  def initialize parent_config = nil
@@ -30,7 +30,8 @@ module Google
30
30
  # including transcoding, making the REST call, and deserialing the response.
31
31
  #
32
32
  class ServiceStub
33
- def initialize endpoint:, endpoint_template:, universe_domain:, credentials:
33
+ # @private
34
+ def initialize endpoint:, endpoint_template:, universe_domain:, credentials:, logger:
34
35
  # These require statements are intentionally placed here to initialize
35
36
  # the REST modules only when it's required.
36
37
  require "gapic/rest"
@@ -40,7 +41,9 @@ module Google
40
41
  universe_domain: universe_domain,
41
42
  credentials: credentials,
42
43
  numeric_enums: true,
43
- raise_faraday_errors: false
44
+ service_name: self.class,
45
+ raise_faraday_errors: false,
46
+ logger: logger
44
47
  end
45
48
 
46
49
  ##
@@ -61,6 +64,15 @@ module Google
61
64
  @client_stub.endpoint
62
65
  end
63
66
 
67
+ ##
68
+ # The logger used for request/response debug logging.
69
+ #
70
+ # @return [Logger]
71
+ #
72
+ def logger stub: false
73
+ stub ? @client_stub.stub_logger : @client_stub.logger
74
+ end
75
+
64
76
  ##
65
77
  # Baseline implementation for the list_traces REST call
66
78
  #
@@ -87,16 +99,18 @@ module Google
87
99
 
88
100
  response = @client_stub.make_http_request(
89
101
  verb,
90
- uri: uri,
91
- body: body || "",
92
- params: query_string_params,
102
+ uri: uri,
103
+ body: body || "",
104
+ params: query_string_params,
105
+ method_name: "list_traces",
93
106
  options: options
94
107
  )
95
108
  operation = ::Gapic::Rest::TransportOperation.new response
96
109
  result = ::Google::Cloud::Trace::V1::ListTracesResponse.decode_json response.body, ignore_unknown_fields: true
97
-
98
- yield result, operation if block_given?
99
- result
110
+ catch :response do
111
+ yield result, operation if block_given?
112
+ result
113
+ end
100
114
  end
101
115
 
102
116
  ##
@@ -125,16 +139,18 @@ module Google
125
139
 
126
140
  response = @client_stub.make_http_request(
127
141
  verb,
128
- uri: uri,
129
- body: body || "",
130
- params: query_string_params,
142
+ uri: uri,
143
+ body: body || "",
144
+ params: query_string_params,
145
+ method_name: "get_trace",
131
146
  options: options
132
147
  )
133
148
  operation = ::Gapic::Rest::TransportOperation.new response
134
149
  result = ::Google::Cloud::Trace::V1::Trace.decode_json response.body, ignore_unknown_fields: true
135
-
136
- yield result, operation if block_given?
137
- result
150
+ catch :response do
151
+ yield result, operation if block_given?
152
+ result
153
+ end
138
154
  end
139
155
 
140
156
  ##
@@ -163,16 +179,18 @@ module Google
163
179
 
164
180
  response = @client_stub.make_http_request(
165
181
  verb,
166
- uri: uri,
167
- body: body || "",
168
- params: query_string_params,
182
+ uri: uri,
183
+ body: body || "",
184
+ params: query_string_params,
185
+ method_name: "patch_traces",
169
186
  options: options
170
187
  )
171
188
  operation = ::Gapic::Rest::TransportOperation.new response
172
189
  result = ::Google::Protobuf::Empty.decode_json response.body, ignore_unknown_fields: true
173
-
174
- yield result, operation if block_given?
175
- result
190
+ catch :response do
191
+ yield result, operation if block_given?
192
+ result
193
+ end
176
194
  end
177
195
 
178
196
  ##
@@ -21,7 +21,7 @@ module Google
21
21
  module Cloud
22
22
  module Trace
23
23
  module V1
24
- VERSION = "1.0.1"
24
+ VERSION = "1.1.0"
25
25
  end
26
26
  end
27
27
  end
@@ -28,6 +28,9 @@ module Google
28
28
  # @!attribute [rw] destinations
29
29
  # @return [::Array<::Google::Api::ClientLibraryDestination>]
30
30
  # The destination where API teams want this client library to be published.
31
+ # @!attribute [rw] selective_gapic_generation
32
+ # @return [::Google::Api::SelectiveGapicGeneration]
33
+ # Configuration for which RPCs should be generated in the GAPIC client.
31
34
  class CommonLanguageSettings
32
35
  include ::Google::Protobuf::MessageExts
33
36
  extend ::Google::Protobuf::MessageExts::ClassMethods
@@ -212,6 +215,12 @@ module Google
212
215
  # enabled. By default, asynchronous REST clients will not be generated.
213
216
  # This feature will be enabled by default 1 month after launching the
214
217
  # feature in preview packages.
218
+ # @!attribute [rw] protobuf_pythonic_types_enabled
219
+ # @return [::Boolean]
220
+ # Enables generation of protobuf code using new types that are more
221
+ # Pythonic which are included in `protobuf>=5.29.x`. This feature will be
222
+ # enabled by default 1 month after launching the feature in preview
223
+ # packages.
215
224
  class ExperimentalFeatures
216
225
  include ::Google::Protobuf::MessageExts
217
226
  extend ::Google::Protobuf::MessageExts::ClassMethods
@@ -297,9 +306,28 @@ module Google
297
306
  # @!attribute [rw] common
298
307
  # @return [::Google::Api::CommonLanguageSettings]
299
308
  # Some settings.
309
+ # @!attribute [rw] renamed_services
310
+ # @return [::Google::Protobuf::Map{::String => ::String}]
311
+ # Map of service names to renamed services. Keys are the package relative
312
+ # service names and values are the name to be used for the service client
313
+ # and call options.
314
+ #
315
+ # publishing:
316
+ # go_settings:
317
+ # renamed_services:
318
+ # Publisher: TopicAdmin
300
319
  class GoSettings
301
320
  include ::Google::Protobuf::MessageExts
302
321
  extend ::Google::Protobuf::MessageExts::ClassMethods
322
+
323
+ # @!attribute [rw] key
324
+ # @return [::String]
325
+ # @!attribute [rw] value
326
+ # @return [::String]
327
+ class RenamedServicesEntry
328
+ include ::Google::Protobuf::MessageExts
329
+ extend ::Google::Protobuf::MessageExts::ClassMethods
330
+ end
303
331
  end
304
332
 
305
333
  # Describes the generator configuration for a method.
@@ -375,6 +403,17 @@ module Google
375
403
  end
376
404
  end
377
405
 
406
+ # This message is used to configure the generation of a subset of the RPCs in
407
+ # a service for client libraries.
408
+ # @!attribute [rw] methods
409
+ # @return [::Array<::String>]
410
+ # An allowlist of the fully qualified names of RPCs that should be included
411
+ # on public client surfaces.
412
+ class SelectiveGapicGeneration
413
+ include ::Google::Protobuf::MessageExts
414
+ extend ::Google::Protobuf::MessageExts::ClassMethods
415
+ end
416
+
378
417
  # The organization for which the client libraries are being published.
379
418
  # Affects the url where generated docs are published, etc.
380
419
  module ClientLibraryOrganization
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: google-cloud-trace-v1
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Google LLC
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-08-30 00:00:00.000000000 Z
11
+ date: 2024-12-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: gapic-common
@@ -16,7 +16,7 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 0.21.1
19
+ version: 0.24.0
20
20
  - - "<"
21
21
  - !ruby/object:Gem::Version
22
22
  version: 2.a
@@ -26,7 +26,7 @@ dependencies:
26
26
  requirements:
27
27
  - - ">="
28
28
  - !ruby/object:Gem::Version
29
- version: 0.21.1
29
+ version: 0.24.0
30
30
  - - "<"
31
31
  - !ruby/object:Gem::Version
32
32
  version: 2.a
@@ -100,7 +100,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
100
100
  - !ruby/object:Gem::Version
101
101
  version: '0'
102
102
  requirements: []
103
- rubygems_version: 3.5.6
103
+ rubygems_version: 3.5.23
104
104
  signing_key:
105
105
  specification_version: 4
106
106
  summary: Sends application trace data to Stackdriver Trace for viewing. Trace data