Skip to main content

profiles

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

Overview

Nameprofiles
TypeResource
Idgoogle.cloudprofiler.profiles

Fields

NameDatatypeDescription
namestringOutput only. Opaque, server-assigned, unique ID for this profile.
deploymentobjectDeployment contains the deployment identification information.
durationstringDuration 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.
profileBytesstringInput 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.
startTimestringOutput only. Start time for the profile. This output is only present in response from the ListProfiles method.

Methods

NameAccessible byRequired ParamsDescription
listSELECTprojectsIdLists 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".
patchUPDATEprofilesId, projectsIdUpdateProfile 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.

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 }}';

INSERT example

Use the following StackQL query and manifest file to create a new profiles resource.

/*+ create */
INSERT INTO google.cloudprofiler.profiles (
projectsId,
deployment,
profileType
)
SELECT
'{{ projectsId }}',
'{{ deployment }}',
'{{ profileType }}'
;

UPDATE example

Updates a profiles resource.

/*+ update */
UPDATE google.cloudprofiler.profiles
SET
profileType = '{{ profileType }}',
deployment = '{{ deployment }}',
duration = '{{ duration }}',
profileBytes = '{{ profileBytes }}',
labels = '{{ labels }}'
WHERE
profilesId = '{{ profilesId }}'
AND projectsId = '{{ projectsId }}';