Skip to main content

profiles

Creates, updates, deletes, gets or lists a profiles resource.

Overview

Nameprofiles
TypeResource
Idgoogle.cloudprofiler.profiles

Fields

The following fields are returned by SELECT queries:

Successful response

NameDatatypeDescription
namestringOutput only. Opaque, server-assigned, unique ID for this profile.
deploymentobjectDeployment this profile corresponds to. (id: Deployment)
durationstring (google-duration)Duration of the profiling session. Input (for the offline mode) or output (for the online mode). The field represents requested profiling duration. It may slightly differ from the effective profiling duration, which is recorded in the profile data, in case the profiling can't be stopped immediately (e.g. in case stopping the profiling is handled asynchronously).
labelsobjectInput only. Labels associated to this specific profile. These labels will get merged with the deployment labels for the final data set. See documentation on deployment labels for validation rules and limits.
profileBytesstring (byte)Input only. Profile bytes, as a gzip compressed serialized proto, the format is https://github.com/google/pprof/blob/master/proto/profile.proto.
profileTypestringType of profile. For offline mode, this must be specified when creating the profile. For online mode it is assigned and returned by the server.
startTimestring (google-datetime)Output only. Start time for the profile. This output is only present in response from the ListProfiles method.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
listselectprojectsIdpageSize, pageTokenLists profiles which have been collected so far and for which the caller has permission to view.
createinsertprojectsIdCreateProfile 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".
patchupdateprojectsId, profilesIdupdateMaskUpdateProfile 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.
create_offlineexecprojectsIdCreateOfflineProfile 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

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
profilesIdstring
projectsIdstring
pageSizeinteger (int32)
pageTokenstring
updateMaskstring (google-fieldmask)

SELECT examples

Lists profiles which have been collected so far and for which the caller has permission to view.

SELECT
name,
deployment,
duration,
labels,
profileBytes,
profileType,
startTime
FROM google.cloudprofiler.profiles
WHERE projectsId = '{{ projectsId }}' -- required
AND pageSize = '{{ pageSize }}'
AND pageToken = '{{ pageToken }}';

INSERT examples

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

INSERT INTO google.cloudprofiler.profiles (
data__deployment,
data__profileType,
projectsId
)
SELECT
'{{ deployment }}',
'{{ profileType }}',
'{{ projectsId }}'
RETURNING
name,
deployment,
duration,
labels,
profileBytes,
profileType,
startTime
;

UPDATE examples

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.

UPDATE google.cloudprofiler.profiles
SET
data__profileType = '{{ profileType }}',
data__deployment = '{{ deployment }}',
data__duration = '{{ duration }}',
data__profileBytes = '{{ profileBytes }}',
data__labels = '{{ labels }}'
WHERE
projectsId = '{{ projectsId }}' --required
AND profilesId = '{{ profilesId }}' --required
AND updateMask = '{{ updateMask}}'
RETURNING
name,
deployment,
duration,
labels,
profileBytes,
profileType,
startTime;

Lifecycle Methods

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.

EXEC google.cloudprofiler.profiles.create_offline 
@projectsId='{{ projectsId }}' --required
@@json=
'{
"profileType": "{{ profileType }}",
"deployment": "{{ deployment }}",
"duration": "{{ duration }}",
"profileBytes": "{{ profileBytes }}",
"labels": "{{ labels }}"
}';