Cloud Profiler v2 API - Class ProfilerServiceClient (2.4.0)

public abstract class ProfilerServiceClient

Reference documentation and code samples for the Cloud Profiler v2 API class ProfilerServiceClient.

ProfilerService client wrapper, for convenient use.

Inheritance

object > ProfilerServiceClient

Namespace

Google.Cloud.Profiler.V2

Assembly

Google.Cloud.Profiler.V2.dll

Remarks

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

The APIs listed in this service are intended for use within our profiler agents only.

Properties

DefaultEndpoint

public static string DefaultEndpoint { get; }

The default endpoint for the ProfilerService service, which is a host of "cloudprofiler.googleapis.com" and a port of 443.

Property Value
TypeDescription
string

DefaultScopes

public static IReadOnlyList<string> DefaultScopes { get; }

The default ProfilerService scopes.

Property Value
TypeDescription
IReadOnlyListstring
Remarks

GrpcClient

public virtual ProfilerService.ProfilerServiceClient GrpcClient { get; }

The underlying gRPC ProfilerService client

Property Value
TypeDescription
ProfilerServiceProfilerServiceClient

ServiceMetadata

public static ServiceMetadata ServiceMetadata { get; }

The service metadata associated with this client type.

Property Value
TypeDescription
ServiceMetadata

Methods

Create()

public static ProfilerServiceClient Create()

Synchronously creates a ProfilerServiceClient using the default credentials, endpoint and settings. To specify custom credentials or other settings, use ProfilerServiceClientBuilder.

Returns
TypeDescription
ProfilerServiceClient

The created ProfilerServiceClient.

CreateAsync(CancellationToken)

public static Task<ProfilerServiceClient> CreateAsync(CancellationToken cancellationToken = default)

Asynchronously creates a ProfilerServiceClient using the default credentials, endpoint and settings. To specify custom credentials or other settings, use ProfilerServiceClientBuilder.

Parameter
NameDescription
cancellationTokenCancellationToken

The CancellationToken to use while creating the client.

Returns
TypeDescription
TaskProfilerServiceClient

The task representing the created ProfilerServiceClient.

CreateOfflineProfile(ProjectName, Profile, CallSettings)

public virtual Profile CreateOfflineProfile(ProjectName parent, Profile profile, CallSettings callSettings = null)

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.

Direct use of this API is discouraged, please use a supported profiler agent instead for profile collection.

Parameters
NameDescription
parentProjectName

Parent project to create the profile in.

profileProfile

Contents of the profile to create.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Profile

The RPC response.

Example
// Create client
ProfilerServiceClient profilerServiceClient = ProfilerServiceClient.Create();
// Initialize request argument(s)
ProjectName parent = ProjectName.FromProject("[PROJECT]");
Profile profile = new Profile();
// Make the request
Profile response = profilerServiceClient.CreateOfflineProfile(parent, profile);

CreateOfflineProfile(CreateOfflineProfileRequest, CallSettings)

public virtual Profile CreateOfflineProfile(CreateOfflineProfileRequest request, CallSettings callSettings = null)

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.

Direct use of this API is discouraged, please use a supported profiler agent instead for profile collection.

Parameters
NameDescription
requestCreateOfflineProfileRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Profile

The RPC response.

Example
// Create client
ProfilerServiceClient profilerServiceClient = ProfilerServiceClient.Create();
// Initialize request argument(s)
CreateOfflineProfileRequest request = new CreateOfflineProfileRequest
{
    ParentAsProjectName = ProjectName.FromProject("[PROJECT]"),
    Profile = new Profile(),
};
// Make the request
Profile response = profilerServiceClient.CreateOfflineProfile(request);

CreateOfflineProfile(string, Profile, CallSettings)

public virtual Profile CreateOfflineProfile(string parent, Profile profile, CallSettings callSettings = null)

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.

Direct use of this API is discouraged, please use a supported profiler agent instead for profile collection.

Parameters
NameDescription
parentstring

Parent project to create the profile in.

profileProfile

Contents of the profile to create.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Profile

The RPC response.

Example
// Create client
ProfilerServiceClient profilerServiceClient = ProfilerServiceClient.Create();
// Initialize request argument(s)
string parent = "projects/[PROJECT]";
Profile profile = new Profile();
// Make the request
Profile response = profilerServiceClient.CreateOfflineProfile(parent, profile);

CreateOfflineProfileAsync(ProjectName, Profile, CallSettings)

public virtual Task<Profile> CreateOfflineProfileAsync(ProjectName parent, Profile profile, CallSettings callSettings = null)

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.

Direct use of this API is discouraged, please use a supported profiler agent instead for profile collection.

Parameters
NameDescription
parentProjectName

Parent project to create the profile in.

profileProfile

Contents of the profile to create.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
TaskProfile

A Task containing the RPC response.

Example
// Create client
ProfilerServiceClient profilerServiceClient = await ProfilerServiceClient.CreateAsync();
// Initialize request argument(s)
ProjectName parent = ProjectName.FromProject("[PROJECT]");
Profile profile = new Profile();
// Make the request
Profile response = await profilerServiceClient.CreateOfflineProfileAsync(parent, profile);

CreateOfflineProfileAsync(ProjectName, Profile, CancellationToken)

public virtual Task<Profile> CreateOfflineProfileAsync(ProjectName parent, Profile profile, CancellationToken cancellationToken)

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.

Direct use of this API is discouraged, please use a supported profiler agent instead for profile collection.

Parameters
NameDescription
parentProjectName

Parent project to create the profile in.

profileProfile

Contents of the profile to create.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
TaskProfile

A Task containing the RPC response.

Example
// Create client
ProfilerServiceClient profilerServiceClient = await ProfilerServiceClient.CreateAsync();
// Initialize request argument(s)
ProjectName parent = ProjectName.FromProject("[PROJECT]");
Profile profile = new Profile();
// Make the request
Profile response = await profilerServiceClient.CreateOfflineProfileAsync(parent, profile);

CreateOfflineProfileAsync(CreateOfflineProfileRequest, CallSettings)

public virtual Task<Profile> CreateOfflineProfileAsync(CreateOfflineProfileRequest request, CallSettings callSettings = null)

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.

Direct use of this API is discouraged, please use a supported profiler agent instead for profile collection.

Parameters
NameDescription
requestCreateOfflineProfileRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
TaskProfile

A Task containing the RPC response.

Example
// Create client
ProfilerServiceClient profilerServiceClient = await ProfilerServiceClient.CreateAsync();
// Initialize request argument(s)
CreateOfflineProfileRequest request = new CreateOfflineProfileRequest
{
    ParentAsProjectName = ProjectName.FromProject("[PROJECT]"),
    Profile = new Profile(),
};
// Make the request
Profile response = await profilerServiceClient.CreateOfflineProfileAsync(request);

CreateOfflineProfileAsync(CreateOfflineProfileRequest, CancellationToken)

public virtual Task<Profile> CreateOfflineProfileAsync(CreateOfflineProfileRequest request, CancellationToken cancellationToken)

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.

Direct use of this API is discouraged, please use a supported profiler agent instead for profile collection.

Parameters
NameDescription
requestCreateOfflineProfileRequest

The request object containing all of the parameters for the API call.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
TaskProfile

A Task containing the RPC response.

Example
// Create client
ProfilerServiceClient profilerServiceClient = await ProfilerServiceClient.CreateAsync();
// Initialize request argument(s)
CreateOfflineProfileRequest request = new CreateOfflineProfileRequest
{
    ParentAsProjectName = ProjectName.FromProject("[PROJECT]"),
    Profile = new Profile(),
};
// Make the request
Profile response = await profilerServiceClient.CreateOfflineProfileAsync(request);

CreateOfflineProfileAsync(string, Profile, CallSettings)

public virtual Task<Profile> CreateOfflineProfileAsync(string parent, Profile profile, CallSettings callSettings = null)

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.

Direct use of this API is discouraged, please use a supported profiler agent instead for profile collection.

Parameters
NameDescription
parentstring

Parent project to create the profile in.

profileProfile

Contents of the profile to create.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
TaskProfile

A Task containing the RPC response.

Example
// Create client
ProfilerServiceClient profilerServiceClient = await ProfilerServiceClient.CreateAsync();
// Initialize request argument(s)
string parent = "projects/[PROJECT]";
Profile profile = new Profile();
// Make the request
Profile response = await profilerServiceClient.CreateOfflineProfileAsync(parent, profile);

CreateOfflineProfileAsync(string, Profile, CancellationToken)

public virtual Task<Profile> CreateOfflineProfileAsync(string parent, Profile profile, CancellationToken cancellationToken)

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.

Direct use of this API is discouraged, please use a supported profiler agent instead for profile collection.

Parameters
NameDescription
parentstring

Parent project to create the profile in.

profileProfile

Contents of the profile to create.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
TaskProfile

A Task containing the RPC response.

Example
// Create client
ProfilerServiceClient profilerServiceClient = await ProfilerServiceClient.CreateAsync();
// Initialize request argument(s)
string parent = "projects/[PROJECT]";
Profile profile = new Profile();
// Make the request
Profile response = await profilerServiceClient.CreateOfflineProfileAsync(parent, profile);

CreateProfile(CreateProfileRequest, CallSettings)

public virtual Profile CreateProfile(CreateProfileRequest request, CallSettings callSettings = null)

CreateProfile creates a new profile resource in the online mode.

Direct use of this API is discouraged, please use a supported profiler agent instead for profile collection.

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
NameDescription
requestCreateProfileRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Profile

The RPC response.

Example
// Create client
ProfilerServiceClient profilerServiceClient = ProfilerServiceClient.Create();
// Initialize request argument(s)
CreateProfileRequest request = new CreateProfileRequest
{
    Deployment = new Deployment(),
    ProfileType =
    {
        ProfileType.Unspecified,
    },
    ParentAsProjectName = ProjectName.FromProject("[PROJECT]"),
};
// Make the request
Profile response = profilerServiceClient.CreateProfile(request);

CreateProfileAsync(CreateProfileRequest, CallSettings)

public virtual Task<Profile> CreateProfileAsync(CreateProfileRequest request, CallSettings callSettings = null)

CreateProfile creates a new profile resource in the online mode.

Direct use of this API is discouraged, please use a supported profiler agent instead for profile collection.

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
NameDescription
requestCreateProfileRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
TaskProfile

A Task containing the RPC response.

Example
// Create client
ProfilerServiceClient profilerServiceClient = await ProfilerServiceClient.CreateAsync();
// Initialize request argument(s)
CreateProfileRequest request = new CreateProfileRequest
{
    Deployment = new Deployment(),
    ProfileType =
    {
        ProfileType.Unspecified,
    },
    ParentAsProjectName = ProjectName.FromProject("[PROJECT]"),
};
// Make the request
Profile response = await profilerServiceClient.CreateProfileAsync(request);

CreateProfileAsync(CreateProfileRequest, CancellationToken)

public virtual Task<Profile> CreateProfileAsync(CreateProfileRequest request, CancellationToken cancellationToken)

CreateProfile creates a new profile resource in the online mode.

Direct use of this API is discouraged, please use a supported profiler agent instead for profile collection.

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
NameDescription
requestCreateProfileRequest

The request object containing all of the parameters for the API call.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
TaskProfile

A Task containing the RPC response.

Example
// Create client
ProfilerServiceClient profilerServiceClient = await ProfilerServiceClient.CreateAsync();
// Initialize request argument(s)
CreateProfileRequest request = new CreateProfileRequest
{
    Deployment = new Deployment(),
    ProfileType =
    {
        ProfileType.Unspecified,
    },
    ParentAsProjectName = ProjectName.FromProject("[PROJECT]"),
};
// Make the request
Profile response = await profilerServiceClient.CreateProfileAsync(request);

ShutdownDefaultChannelsAsync()

public static Task ShutdownDefaultChannelsAsync()

Shuts down any channels automatically created by Create() and CreateAsync(CancellationToken). Channels which weren't automatically created are not affected.

Returns
TypeDescription
Task

A task representing the asynchronous shutdown operation.

Remarks

After calling this method, further calls to Create() and CreateAsync(CancellationToken) will create new channels, which could in turn be shut down by another call to this method.

UpdateProfile(Profile, FieldMask, CallSettings)

public virtual Profile UpdateProfile(Profile profile, FieldMask updateMask, CallSettings callSettings = null)

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.

Direct use of this API is discouraged, please use a supported profiler agent instead for profile collection.

Parameters
NameDescription
profileProfile

Profile to update.

updateMaskFieldMask

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.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Profile

The RPC response.

Example
// Create client
ProfilerServiceClient profilerServiceClient = ProfilerServiceClient.Create();
// Initialize request argument(s)
Profile profile = new Profile();
FieldMask updateMask = new FieldMask();
// Make the request
Profile response = profilerServiceClient.UpdateProfile(profile, updateMask);

UpdateProfile(UpdateProfileRequest, CallSettings)

public virtual Profile UpdateProfile(UpdateProfileRequest request, CallSettings callSettings = null)

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.

Direct use of this API is discouraged, please use a supported profiler agent instead for profile collection.

Parameters
NameDescription
requestUpdateProfileRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Profile

The RPC response.

Example
// Create client
ProfilerServiceClient profilerServiceClient = ProfilerServiceClient.Create();
// Initialize request argument(s)
UpdateProfileRequest request = new UpdateProfileRequest
{
    Profile = new Profile(),
    UpdateMask = new FieldMask(),
};
// Make the request
Profile response = profilerServiceClient.UpdateProfile(request);

UpdateProfileAsync(Profile, FieldMask, CallSettings)

public virtual Task<Profile> UpdateProfileAsync(Profile profile, FieldMask updateMask, CallSettings callSettings = null)

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.

Direct use of this API is discouraged, please use a supported profiler agent instead for profile collection.

Parameters
NameDescription
profileProfile

Profile to update.

updateMaskFieldMask

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.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
TaskProfile

A Task containing the RPC response.

Example
// Create client
ProfilerServiceClient profilerServiceClient = await ProfilerServiceClient.CreateAsync();
// Initialize request argument(s)
Profile profile = new Profile();
FieldMask updateMask = new FieldMask();
// Make the request
Profile response = await profilerServiceClient.UpdateProfileAsync(profile, updateMask);

UpdateProfileAsync(Profile, FieldMask, CancellationToken)

public virtual Task<Profile> UpdateProfileAsync(Profile profile, FieldMask updateMask, CancellationToken cancellationToken)

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.

Direct use of this API is discouraged, please use a supported profiler agent instead for profile collection.

Parameters
NameDescription
profileProfile

Profile to update.

updateMaskFieldMask

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.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
TaskProfile

A Task containing the RPC response.

Example
// Create client
ProfilerServiceClient profilerServiceClient = await ProfilerServiceClient.CreateAsync();
// Initialize request argument(s)
Profile profile = new Profile();
FieldMask updateMask = new FieldMask();
// Make the request
Profile response = await profilerServiceClient.UpdateProfileAsync(profile, updateMask);

UpdateProfileAsync(UpdateProfileRequest, CallSettings)

public virtual Task<Profile> UpdateProfileAsync(UpdateProfileRequest request, CallSettings callSettings = null)

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.

Direct use of this API is discouraged, please use a supported profiler agent instead for profile collection.

Parameters
NameDescription
requestUpdateProfileRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
TaskProfile

A Task containing the RPC response.

Example
// Create client
ProfilerServiceClient profilerServiceClient = await ProfilerServiceClient.CreateAsync();
// Initialize request argument(s)
UpdateProfileRequest request = new UpdateProfileRequest
{
    Profile = new Profile(),
    UpdateMask = new FieldMask(),
};
// Make the request
Profile response = await profilerServiceClient.UpdateProfileAsync(request);

UpdateProfileAsync(UpdateProfileRequest, CancellationToken)

public virtual Task<Profile> UpdateProfileAsync(UpdateProfileRequest request, CancellationToken cancellationToken)

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.

Direct use of this API is discouraged, please use a supported profiler agent instead for profile collection.

Parameters
NameDescription
requestUpdateProfileRequest

The request object containing all of the parameters for the API call.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
TaskProfile

A Task containing the RPC response.

Example
// Create client
ProfilerServiceClient profilerServiceClient = await ProfilerServiceClient.CreateAsync();
// Initialize request argument(s)
UpdateProfileRequest request = new UpdateProfileRequest
{
    Profile = new Profile(),
    UpdateMask = new FieldMask(),
};
// Make the request
Profile response = await profilerServiceClient.UpdateProfileAsync(request);