google-cloud-profiler-v2 0.3.0 → 0.10.1

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.
Files changed (27) hide show
  1. checksums.yaml +4 -4
  2. data/AUTHENTICATION.md +72 -101
  3. data/README.md +5 -5
  4. data/lib/google/cloud/profiler/v2/export_service/client.rb +446 -0
  5. data/lib/google/cloud/profiler/v2/export_service/credentials.rb +53 -0
  6. data/lib/google/cloud/profiler/v2/export_service/paths.rb +47 -0
  7. data/lib/google/cloud/profiler/v2/export_service/rest/client.rb +413 -0
  8. data/lib/google/cloud/profiler/v2/export_service/rest/service_stub.rb +128 -0
  9. data/lib/google/cloud/profiler/v2/export_service/rest.rb +53 -0
  10. data/lib/google/cloud/profiler/v2/export_service.rb +56 -0
  11. data/lib/google/cloud/profiler/v2/profiler_service/client.rb +79 -23
  12. data/lib/google/cloud/profiler/v2/profiler_service/paths.rb +64 -0
  13. data/lib/google/cloud/profiler/v2/profiler_service/rest/client.rb +622 -0
  14. data/lib/google/cloud/profiler/v2/profiler_service/rest/service_stub.rb +249 -0
  15. data/lib/google/cloud/profiler/v2/profiler_service/rest.rb +56 -0
  16. data/lib/google/cloud/profiler/v2/profiler_service.rb +10 -4
  17. data/lib/google/cloud/profiler/v2/rest.rb +38 -0
  18. data/lib/google/cloud/profiler/v2/version.rb +1 -1
  19. data/lib/google/cloud/profiler/v2.rb +8 -2
  20. data/lib/google/devtools/cloudprofiler/v2/profiler_pb.rb +33 -38
  21. data/lib/google/devtools/cloudprofiler/v2/profiler_services_pb.rb +39 -6
  22. data/proto_docs/google/api/client.rb +399 -0
  23. data/proto_docs/google/api/field_behavior.rb +85 -0
  24. data/proto_docs/google/api/launch_stage.rb +71 -0
  25. data/proto_docs/google/devtools/cloudprofiler/v2/profiler.rb +52 -7
  26. data/proto_docs/google/protobuf/timestamp.rb +127 -0
  27. metadata +23 -119
@@ -30,11 +30,18 @@ module Google
30
30
  # Manage the collection of continuous profiling data provided by profiling
31
31
  # agents running in the cloud or by an offline provider of profiling data.
32
32
  #
33
- # General guidelines:
34
- # * Profiles for a single deployment must be created in ascending time order.
35
- # * Profiles can be created in either online or offline mode, see below.
33
+ # __The APIs listed in this service are intended for use within our profiler
34
+ # agents only.__
36
35
  #
37
36
  class Client
37
+ # @private
38
+ API_VERSION = ""
39
+
40
+ # @private
41
+ DEFAULT_ENDPOINT_TEMPLATE = "cloudprofiler.$UNIVERSE_DOMAIN$"
42
+
43
+ include Paths
44
+
38
45
  # @private
39
46
  attr_reader :profiler_service_stub
40
47
 
@@ -67,12 +74,12 @@ module Google
67
74
  end
68
75
  default_config = Client::Configuration.new parent_config
69
76
 
70
- default_config.timeout = 30.0
77
+ default_config.timeout = 60.0
71
78
  default_config.retry_policy = {
72
79
  initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
73
80
  }
74
81
 
75
- default_config.rpcs.create_profile.timeout = 3600.0
82
+ default_config.rpcs.create_profile.timeout = 3610.0
76
83
 
77
84
  default_config.rpcs.create_offline_profile.timeout = 30.0
78
85
 
@@ -104,6 +111,15 @@ module Google
104
111
  @config
105
112
  end
106
113
 
114
+ ##
115
+ # The effective universe domain
116
+ #
117
+ # @return [String]
118
+ #
119
+ def universe_domain
120
+ @profiler_service_stub.universe_domain
121
+ end
122
+
107
123
  ##
108
124
  # Create a new ProfilerService client object.
109
125
  #
@@ -137,8 +153,9 @@ module Google
137
153
  credentials = @config.credentials
138
154
  # Use self-signed JWT if the endpoint is unchanged from default,
139
155
  # but only if the default endpoint does not have a region prefix.
140
- enable_self_signed_jwt = @config.endpoint == Client.configure.endpoint &&
141
- !@config.endpoint.split(".").first.include?("-")
156
+ enable_self_signed_jwt = @config.endpoint.nil? ||
157
+ (@config.endpoint == Configuration::DEFAULT_ENDPOINT &&
158
+ !@config.endpoint.split(".").first.include?("-"))
142
159
  credentials ||= Credentials.default scope: @config.scope,
143
160
  enable_self_signed_jwt: enable_self_signed_jwt
144
161
  if credentials.is_a?(::String) || credentials.is_a?(::Hash)
@@ -149,10 +166,13 @@ module Google
149
166
 
150
167
  @profiler_service_stub = ::Gapic::ServiceStub.new(
151
168
  ::Google::Cloud::Profiler::V2::ProfilerService::Stub,
152
- credentials: credentials,
153
- endpoint: @config.endpoint,
169
+ credentials: credentials,
170
+ endpoint: @config.endpoint,
171
+ endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
172
+ universe_domain: @config.universe_domain,
154
173
  channel_args: @config.channel_args,
155
- interceptors: @config.interceptors
174
+ interceptors: @config.interceptors,
175
+ channel_pool_config: @config.channel_pool
156
176
  )
157
177
  end
158
178
 
@@ -161,6 +181,11 @@ module Google
161
181
  ##
162
182
  # CreateProfile creates a new profile resource in the online mode.
163
183
  #
184
+ # _Direct use of this API is discouraged, please use a [supported
185
+ # profiler
186
+ # agent](https://cloud.google.com/profiler/docs/about-profiler#profiling_agent)
187
+ # instead for profile collection._
188
+ #
164
189
  # The server ensures that the new profiles are created at a constant rate per
165
190
  # deployment, so the creation request may hang for some time until the next
166
191
  # profile session is available.
@@ -229,10 +254,11 @@ module Google
229
254
  # Customize the options with defaults
230
255
  metadata = @config.rpcs.create_profile.metadata.to_h
231
256
 
232
- # Set x-goog-api-client and x-goog-user-project headers
257
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
233
258
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
234
259
  lib_name: @config.lib_name, lib_version: @config.lib_version,
235
260
  gapic_version: ::Google::Cloud::Profiler::V2::VERSION
261
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
236
262
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
237
263
 
238
264
  header_params = {}
@@ -260,9 +286,14 @@ module Google
260
286
  end
261
287
 
262
288
  ##
263
- # CreateOfflineProfile creates a new profile resource in the offline mode.
264
- # The client provides the profile to create along with the profile bytes, the
265
- # server records it.
289
+ # CreateOfflineProfile creates a new profile resource in the offline
290
+ # mode. The client provides the profile to create along with the profile
291
+ # bytes, the server records it.
292
+ #
293
+ # _Direct use of this API is discouraged, please use a [supported
294
+ # profiler
295
+ # agent](https://cloud.google.com/profiler/docs/about-profiler#profiling_agent)
296
+ # instead for profile collection._
266
297
  #
267
298
  # @overload create_offline_profile(request, options = nil)
268
299
  # Pass arguments to `create_offline_profile` via a request object, either of type
@@ -318,10 +349,11 @@ module Google
318
349
  # Customize the options with defaults
319
350
  metadata = @config.rpcs.create_offline_profile.metadata.to_h
320
351
 
321
- # Set x-goog-api-client and x-goog-user-project headers
352
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
322
353
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
323
354
  lib_name: @config.lib_name, lib_version: @config.lib_version,
324
355
  gapic_version: ::Google::Cloud::Profiler::V2::VERSION
356
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
325
357
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
326
358
 
327
359
  header_params = {}
@@ -354,6 +386,11 @@ module Google
354
386
  # offline mode is currently not supported: the profile content must be
355
387
  # provided at the time of the profile creation.
356
388
  #
389
+ # _Direct use of this API is discouraged, please use a [supported
390
+ # profiler
391
+ # agent](https://cloud.google.com/profiler/docs/about-profiler#profiling_agent)
392
+ # instead for profile collection._
393
+ #
357
394
  # @overload update_profile(request, options = nil)
358
395
  # Pass arguments to `update_profile` via a request object, either of type
359
396
  # {::Google::Cloud::Profiler::V2::UpdateProfileRequest} or an equivalent Hash.
@@ -370,7 +407,7 @@ module Google
370
407
  # the default parameter values, pass an empty Hash as a request object (see above).
371
408
  #
372
409
  # @param profile [::Google::Cloud::Profiler::V2::Profile, ::Hash]
373
- # Profile to update
410
+ # Profile to update.
374
411
  # @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
375
412
  # Field mask used to specify the fields to be overwritten. Currently only
376
413
  # profile_bytes and labels fields are supported by UpdateProfile, so only
@@ -411,10 +448,11 @@ module Google
411
448
  # Customize the options with defaults
412
449
  metadata = @config.rpcs.update_profile.metadata.to_h
413
450
 
414
- # Set x-goog-api-client and x-goog-user-project headers
451
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
415
452
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
416
453
  lib_name: @config.lib_name, lib_version: @config.lib_version,
417
454
  gapic_version: ::Google::Cloud::Profiler::V2::VERSION
455
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
418
456
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
419
457
 
420
458
  header_params = {}
@@ -471,17 +509,17 @@ module Google
471
509
  # end
472
510
  #
473
511
  # @!attribute [rw] endpoint
474
- # The hostname or hostname:port of the service endpoint.
475
- # Defaults to `"cloudprofiler.googleapis.com"`.
476
- # @return [::String]
512
+ # A custom service endpoint, as a hostname or hostname:port. The default is
513
+ # nil, indicating to use the default endpoint in the current universe domain.
514
+ # @return [::String,nil]
477
515
  # @!attribute [rw] credentials
478
516
  # Credentials to send with calls. You may provide any of the following types:
479
517
  # * (`String`) The path to a service account key file in JSON format
480
518
  # * (`Hash`) A service account key as a Hash
481
519
  # * (`Google::Auth::Credentials`) A googleauth credentials object
482
- # (see the [googleauth docs](https://googleapis.dev/ruby/googleauth/latest/index.html))
520
+ # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
483
521
  # * (`Signet::OAuth2::Client`) A signet oauth2 client object
484
- # (see the [signet docs](https://googleapis.dev/ruby/signet/latest/Signet/OAuth2/Client.html))
522
+ # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
485
523
  # * (`GRPC::Core::Channel`) a gRPC channel with included credentials
486
524
  # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
487
525
  # * (`nil`) indicating no credentials
@@ -519,11 +557,20 @@ module Google
519
557
  # @!attribute [rw] quota_project
520
558
  # A separate project against which to charge quota.
521
559
  # @return [::String]
560
+ # @!attribute [rw] universe_domain
561
+ # The universe domain within which to make requests. This determines the
562
+ # default endpoint URL. The default value of nil uses the environment
563
+ # universe (usually the default "googleapis.com" universe).
564
+ # @return [::String,nil]
522
565
  #
523
566
  class Configuration
524
567
  extend ::Gapic::Config
525
568
 
526
- config_attr :endpoint, "cloudprofiler.googleapis.com", ::String
569
+ # @private
570
+ # The endpoint specific to the default "googleapis.com" universe. Deprecated.
571
+ DEFAULT_ENDPOINT = "cloudprofiler.googleapis.com"
572
+
573
+ config_attr :endpoint, nil, ::String, nil
527
574
  config_attr :credentials, nil do |value|
528
575
  allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
529
576
  allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
@@ -538,6 +585,7 @@ module Google
538
585
  config_attr :metadata, nil, ::Hash, nil
539
586
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
540
587
  config_attr :quota_project, nil, ::String, nil
588
+ config_attr :universe_domain, nil, ::String, nil
541
589
 
542
590
  # @private
543
591
  def initialize parent_config = nil
@@ -558,6 +606,14 @@ module Google
558
606
  end
559
607
  end
560
608
 
609
+ ##
610
+ # Configuration for the channel pool
611
+ # @return [::Gapic::ServiceStub::ChannelPool::Configuration]
612
+ #
613
+ def channel_pool
614
+ @channel_pool ||= ::Gapic::ServiceStub::ChannelPool::Configuration.new
615
+ end
616
+
561
617
  ##
562
618
  # Configuration RPC class for the ProfilerService API.
563
619
  #
@@ -0,0 +1,64 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2023 Google LLC
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # https://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ # Auto-generated by gapic-generator-ruby. DO NOT EDIT!
18
+
19
+
20
+ module Google
21
+ module Cloud
22
+ module Profiler
23
+ module V2
24
+ module ProfilerService
25
+ # Path helper methods for the ProfilerService API.
26
+ module Paths
27
+ ##
28
+ # Create a fully-qualified Profile resource string.
29
+ #
30
+ # The resource will be in the following format:
31
+ #
32
+ # `projects/{project}/profiles/{profile}`
33
+ #
34
+ # @param project [String]
35
+ # @param profile [String]
36
+ #
37
+ # @return [::String]
38
+ def profile_path project:, profile:
39
+ raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
40
+
41
+ "projects/#{project}/profiles/#{profile}"
42
+ end
43
+
44
+ ##
45
+ # Create a fully-qualified Project resource string.
46
+ #
47
+ # The resource will be in the following format:
48
+ #
49
+ # `projects/{project}`
50
+ #
51
+ # @param project [String]
52
+ #
53
+ # @return [::String]
54
+ def project_path project:
55
+ "projects/#{project}"
56
+ end
57
+
58
+ extend self
59
+ end
60
+ end
61
+ end
62
+ end
63
+ end
64
+ end