Class ProfilerServiceClient (2.15.1)

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.
Equality

Instances of this class created via copy-construction or copy-assignment always compare equal. Instances created with equal std::shared_ptr<*Connection> objects compare equal. Objects that compare equal share the same underlying resources.

Performance

Creating a new instance of this class is a relatively expensive operation, new objects establish new connections to the service. In contrast, copy-construction, move-construction, and the corresponding assignment operations are relatively efficient as the copies share all underlying resources.

Thread Safety

Concurrent access to different instances of this class, even if they compare equal, is guaranteed to work. Two or more threads operating on the same instance of this class is not guaranteed to work. Since copy-construction and move-construction is a relatively efficient operation, consider using such a copy when using this class from multiple threads.

Constructors

ProfilerServiceClient(ProfilerServiceClient const &)

Copy and move support

Parameter
Name Description
ProfilerServiceClient const &

ProfilerServiceClient(ProfilerServiceClient &&)

Copy and move support

Parameter
Name Description
ProfilerServiceClient &&

ProfilerServiceClient(std::shared_ptr< ProfilerServiceConnection >, Options)

Parameters
Name Description
connection std::shared_ptr< ProfilerServiceConnection >
opts Options

Operators

operator=(ProfilerServiceClient const &)

Copy and move support

Parameter
Name Description
ProfilerServiceClient const &
Returns
Type Description
ProfilerServiceClient &

operator=(ProfilerServiceClient &&)

Copy and move support

Parameter
Name Description
ProfilerServiceClient &&
Returns
Type Description
ProfilerServiceClient &

Functions

CreateProfile(google::devtools::cloudprofiler::v2::CreateProfileRequest const &, Options)

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".

Parameters
Name Description
request google::devtools::cloudprofiler::v2::CreateProfileRequest const &

Unary RPCs, such as the one wrapped by this function, receive a single request proto message which includes all the inputs for the RPC. In this case, the proto message is a google.devtools.cloudprofiler.v2.CreateProfileRequest. Proto messages are converted to C++ classes by Protobuf, using the Protobuf mapping rules.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
StatusOr< google::devtools::cloudprofiler::v2::Profile >

the result of the RPC. The response message type (google.devtools.cloudprofiler.v2.Profile) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the StatusOr contains the error details.

CreateOfflineProfile(std::string const &, google::devtools::cloudprofiler::v2::Profile const &, Options)

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.

Parameters
Name Description
parent std::string const &

Parent project to create the profile in.

profile google::devtools::cloudprofiler::v2::Profile const &

Contents of the profile to create.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
StatusOr< google::devtools::cloudprofiler::v2::Profile >

the result of the RPC. The response message type (google.devtools.cloudprofiler.v2.Profile) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the StatusOr contains the error details.

CreateOfflineProfile(google::devtools::cloudprofiler::v2::CreateOfflineProfileRequest const &, Options)

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.

Parameters
Name Description
request google::devtools::cloudprofiler::v2::CreateOfflineProfileRequest const &

Unary RPCs, such as the one wrapped by this function, receive a single request proto message which includes all the inputs for the RPC. In this case, the proto message is a google.devtools.cloudprofiler.v2.CreateOfflineProfileRequest. Proto messages are converted to C++ classes by Protobuf, using the Protobuf mapping rules.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
StatusOr< google::devtools::cloudprofiler::v2::Profile >

the result of the RPC. The response message type (google.devtools.cloudprofiler.v2.Profile) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the StatusOr contains the error details.

UpdateProfile(google::devtools::cloudprofiler::v2::Profile const &, google::protobuf::FieldMask const &, Options)

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.

Parameters
Name Description
profile google::devtools::cloudprofiler::v2::Profile const &

Profile to update.

update_mask google::protobuf::FieldMask const &

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.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
StatusOr< google::devtools::cloudprofiler::v2::Profile >

the result of the RPC. The response message type (google.devtools.cloudprofiler.v2.Profile) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the StatusOr contains the error details.

UpdateProfile(google::devtools::cloudprofiler::v2::UpdateProfileRequest const &, Options)

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.

Parameters
Name Description
request google::devtools::cloudprofiler::v2::UpdateProfileRequest const &

Unary RPCs, such as the one wrapped by this function, receive a single request proto message which includes all the inputs for the RPC. In this case, the proto message is a google.devtools.cloudprofiler.v2.UpdateProfileRequest. Proto messages are converted to C++ classes by Protobuf, using the Protobuf mapping rules.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
StatusOr< google::devtools::cloudprofiler::v2::Profile >

the result of the RPC. The response message type (google.devtools.cloudprofiler.v2.Profile) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the StatusOr contains the error details.