Cloud Profiler V2 API - Class Google::Cloud::Profiler::V2::ProfilerService::Rest::Client (v0.7.0)

Reference documentation and code samples for the Cloud Profiler V2 API class Google::Cloud::Profiler::V2::ProfilerService::Rest::Client.

REST client for the ProfilerService service.

Manage the collection of continuous profiling data provided by profiling agents running in the cloud or by an offline provider of profiling data.

General guidelines:

  • Profiles for a single deployment must be created in ascending time order.
  • Profiles can be created in either online or offline mode, see below.

Inherits

  • Object

Methods

.configure

def self.configure() { |config| ... } -> Client::Configuration

Configure the ProfilerService Client class.

See Configuration for a description of the configuration fields.

Yields
  • (config) — Configure the Client client.
Yield Parameter
Example
# Modify the configuration for all ProfilerService clients
::Google::Cloud::Profiler::V2::ProfilerService::Rest::Client.configure do |config|
  config.timeout = 10.0
end

#configure

def configure() { |config| ... } -> Client::Configuration

Configure the ProfilerService Client instance.

The configuration is set to the derived mode, meaning that values can be changed, but structural changes (adding new fields, etc.) are not allowed. Structural changes should be made on Client.configure.

See Configuration for a description of the configuration fields.

Yields
  • (config) — Configure the Client client.
Yield Parameter

#create_offline_profile

def create_offline_profile(request, options = nil) -> ::Google::Cloud::Profiler::V2::Profile
def create_offline_profile(parent: nil, profile: nil) -> ::Google::Cloud::Profiler::V2::Profile

CreateOfflineProfile creates a new profile resource in the offline mode. The client provides the profile to create along with the profile bytes, the server records it.

Overloads
def create_offline_profile(request, options = nil) -> ::Google::Cloud::Profiler::V2::Profile
Pass arguments to create_offline_profile via a request object, either of type CreateOfflineProfileRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Profiler::V2::CreateOfflineProfileRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def create_offline_profile(parent: nil, profile: nil) -> ::Google::Cloud::Profiler::V2::Profile
Pass arguments to create_offline_profile via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameters
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.
Example

Basic example

require "google/cloud/profiler/v2"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Profiler::V2::ProfilerService::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Profiler::V2::CreateOfflineProfileRequest.new

# Call the create_offline_profile method.
result = client.create_offline_profile request

# The returned object is of type Google::Cloud::Profiler::V2::Profile.
p result

#create_profile

def create_profile(request, options = nil) -> ::Google::Cloud::Profiler::V2::Profile
def create_profile(parent: nil, deployment: nil, profile_type: nil) -> ::Google::Cloud::Profiler::V2::Profile

CreateProfile creates a new profile resource in the online mode.

The server ensures that the new profiles are created at a constant rate per deployment, so the creation request may hang for some time until the next profile session is available.

The request may fail with ABORTED error if the creation is not available within ~1m, the response will indicate the duration of the backoff the client should take before attempting creating a profile again. The backoff duration is returned in google.rpc.RetryInfo extension on the response status. To a gRPC client, the extension will be return as a binary-serialized proto in the trailing metadata item named "google.rpc.retryinfo-bin".

Overloads
def create_profile(request, options = nil) -> ::Google::Cloud::Profiler::V2::Profile
Pass arguments to create_profile via a request object, either of type CreateProfileRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Profiler::V2::CreateProfileRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def create_profile(parent: nil, deployment: nil, profile_type: nil) -> ::Google::Cloud::Profiler::V2::Profile
Pass arguments to create_profile via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameters
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.
Example

Basic example

require "google/cloud/profiler/v2"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Profiler::V2::ProfilerService::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Profiler::V2::CreateProfileRequest.new

# Call the create_profile method.
result = client.create_profile request

# The returned object is of type Google::Cloud::Profiler::V2::Profile.
p result

#initialize

def initialize() { |config| ... } -> Client

Create a new ProfilerService REST client object.

Yields
  • (config) — Configure the ProfilerService client.
Yield Parameter
Returns
  • (Client) — a new instance of Client
Example
# Create a client using the default configuration
client = ::Google::Cloud::Profiler::V2::ProfilerService::Rest::Client.new

# Create a client using a custom configuration
client = ::Google::Cloud::Profiler::V2::ProfilerService::Rest::Client.new do |config|
  config.timeout = 10.0
end

#update_profile

def update_profile(request, options = nil) -> ::Google::Cloud::Profiler::V2::Profile
def update_profile(profile: nil, update_mask: nil) -> ::Google::Cloud::Profiler::V2::Profile

UpdateProfile updates the profile bytes and labels on the profile resource created in the online mode. Updating the bytes for profiles created in the offline mode is currently not supported: the profile content must be provided at the time of the profile creation.

Overloads
def update_profile(request, options = nil) -> ::Google::Cloud::Profiler::V2::Profile
Pass arguments to update_profile via a request object, either of type UpdateProfileRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Profiler::V2::UpdateProfileRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def update_profile(profile: nil, update_mask: nil) -> ::Google::Cloud::Profiler::V2::Profile
Pass arguments to update_profile via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameters
  • profile (::Google::Cloud::Profiler::V2::Profile, ::Hash) — Profile to update.
  • update_mask (::Google::Protobuf::FieldMask, ::Hash) — Field mask used to specify the fields to be overwritten. Currently only profile_bytes and labels fields are supported by UpdateProfile, so only those fields can be specified in the mask. When no mask is provided, all fields are overwritten.
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.
Example

Basic example

require "google/cloud/profiler/v2"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Profiler::V2::ProfilerService::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Profiler::V2::UpdateProfileRequest.new

# Call the update_profile method.
result = client.update_profile request

# The returned object is of type Google::Cloud::Profiler::V2::Profile.
p result