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.__ v2
Package
@google-cloud/cloudprofilerConstructors
(constructor)(opts, gaxInstance)
constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback);
Construct an instance of ProfilerServiceClient.
Parameters | |
---|---|
Name | Description |
opts |
ClientOptions
|
gaxInstance |
typeof gax | typeof fallback
: loaded instance of |
Properties
apiEndpoint
get apiEndpoint(): string;
The DNS address for this API service.
apiEndpoint
static get apiEndpoint(): string;
The DNS address for this API service - same as servicePath.
auth
auth: gax.GoogleAuth;
descriptors
descriptors: Descriptors;
innerApiCalls
innerApiCalls: {
[name: string]: Function;
};
pathTemplates
pathTemplates: {
[name: string]: gax.PathTemplate;
};
port
static get port(): number;
The port for this API service.
profilerServiceStub
profilerServiceStub?: Promise<{
[name: string]: Function;
}>;
scopes
static get scopes(): string[];
The scopes needed to make gRPC calls for every method defined in this service.
servicePath
static get servicePath(): string;
The DNS address for this API service.
universeDomain
get universeDomain(): string;
warn
warn: (code: string, message: string, warnType?: string) => void;
Methods
close()
close(): Promise<void>;
Terminate the gRPC channel and close the client.
The client will no longer be usable and all future behavior is undefined.
Returns | |
---|---|
Type | Description |
Promise<void> | {Promise} A promise that resolves when the client is closed. |
createOfflineProfile(request, options)
createOfflineProfile(request?: protos.google.devtools.cloudprofiler.v2.ICreateOfflineProfileRequest, options?: CallOptions): Promise<[
protos.google.devtools.cloudprofiler.v2.IProfile,
(protos.google.devtools.cloudprofiler.v2.ICreateOfflineProfileRequest | undefined),
{} | undefined
]>;
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](https://cloud.google.com/profiler/docs/about-profiler#profiling_agent) instead for profile collection._
Parameters | |
---|---|
Name | Description |
request |
ICreateOfflineProfileRequest
The request object that will be sent. |
options |
CallOptions
Call options. See CallOptions for more details. |
Returns | |
---|---|
Type | Description |
Promise<[
protos.google.devtools.cloudprofiler.v2.IProfile,
(protos.google.devtools.cloudprofiler.v2.ICreateOfflineProfileRequest | undefined),
{} | undefined
]> | {Promise} - The promise which resolves to an array. The first element of the array is an object representing Profile. Please see the documentation for more details and examples. |
/**
* This snippet has been automatically generated and should be regarded as a code template only.
* It will require modifications to work.
* It may require correct/in-range values for request initialization.
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* Parent project to create the profile in.
*/
// const parent = 'abc123'
/**
* Contents of the profile to create.
*/
// const profile = {}
// Imports the Cloudprofiler library
const {ProfilerServiceClient} = require('@google-cloud/cloudprofiler').v2;
// Instantiates a client
const cloudprofilerClient = new ProfilerServiceClient();
async function callCreateOfflineProfile() {
// Construct request
const request = {
};
// Run request
const response = await cloudprofilerClient.createOfflineProfile(request);
console.log(response);
}
callCreateOfflineProfile();
createOfflineProfile(request, options, callback)
createOfflineProfile(request: protos.google.devtools.cloudprofiler.v2.ICreateOfflineProfileRequest, options: CallOptions, callback: Callback<protos.google.devtools.cloudprofiler.v2.IProfile, protos.google.devtools.cloudprofiler.v2.ICreateOfflineProfileRequest | null | undefined, {} | null | undefined>): void;
Parameters | |
---|---|
Name | Description |
request |
ICreateOfflineProfileRequest
|
options |
CallOptions
|
callback |
Callback<protos.google.devtools.cloudprofiler.v2.IProfile, protos.google.devtools.cloudprofiler.v2.ICreateOfflineProfileRequest | null | undefined, {} | null | undefined>
|
Returns | |
---|---|
Type | Description |
void |
createOfflineProfile(request, callback)
createOfflineProfile(request: protos.google.devtools.cloudprofiler.v2.ICreateOfflineProfileRequest, callback: Callback<protos.google.devtools.cloudprofiler.v2.IProfile, protos.google.devtools.cloudprofiler.v2.ICreateOfflineProfileRequest | null | undefined, {} | null | undefined>): void;
Parameters | |
---|---|
Name | Description |
request |
ICreateOfflineProfileRequest
|
callback |
Callback<protos.google.devtools.cloudprofiler.v2.IProfile, protos.google.devtools.cloudprofiler.v2.ICreateOfflineProfileRequest | null | undefined, {} | null | undefined>
|
Returns | |
---|---|
Type | Description |
void |
createProfile(request, options)
createProfile(request?: protos.google.devtools.cloudprofiler.v2.ICreateProfileRequest, options?: CallOptions): Promise<[
protos.google.devtools.cloudprofiler.v2.IProfile,
protos.google.devtools.cloudprofiler.v2.ICreateProfileRequest | undefined,
{} | undefined
]>;
CreateProfile creates a new profile resource in the online mode.
_Direct use of this API is discouraged, please use a [supported profiler agent](https://cloud.google.com/profiler/docs/about-profiler#profiling_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 | |
---|---|
Name | Description |
request |
ICreateProfileRequest
The request object that will be sent. |
options |
CallOptions
Call options. See CallOptions for more details. |
Returns | |
---|---|
Type | Description |
Promise<[
protos.google.devtools.cloudprofiler.v2.IProfile,
protos.google.devtools.cloudprofiler.v2.ICreateProfileRequest | undefined,
{} | undefined
]> | {Promise} - The promise which resolves to an array. The first element of the array is an object representing Profile. Please see the documentation for more details and examples. |
/**
* This snippet has been automatically generated and should be regarded as a code template only.
* It will require modifications to work.
* It may require correct/in-range values for request initialization.
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* Parent project to create the profile in.
*/
// const parent = 'abc123'
/**
* Deployment details.
*/
// const deployment = {}
/**
* One or more profile types that the agent is capable of providing.
*/
// const profileType = [1,2,3,4]
// Imports the Cloudprofiler library
const {ProfilerServiceClient} = require('@google-cloud/cloudprofiler').v2;
// Instantiates a client
const cloudprofilerClient = new ProfilerServiceClient();
async function callCreateProfile() {
// Construct request
const request = {
};
// Run request
const response = await cloudprofilerClient.createProfile(request);
console.log(response);
}
callCreateProfile();
createProfile(request, options, callback)
createProfile(request: protos.google.devtools.cloudprofiler.v2.ICreateProfileRequest, options: CallOptions, callback: Callback<protos.google.devtools.cloudprofiler.v2.IProfile, protos.google.devtools.cloudprofiler.v2.ICreateProfileRequest | null | undefined, {} | null | undefined>): void;
Parameters | |
---|---|
Name | Description |
request |
ICreateProfileRequest
|
options |
CallOptions
|
callback |
Callback<protos.google.devtools.cloudprofiler.v2.IProfile, protos.google.devtools.cloudprofiler.v2.ICreateProfileRequest | null | undefined, {} | null | undefined>
|
Returns | |
---|---|
Type | Description |
void |
createProfile(request, callback)
createProfile(request: protos.google.devtools.cloudprofiler.v2.ICreateProfileRequest, callback: Callback<protos.google.devtools.cloudprofiler.v2.IProfile, protos.google.devtools.cloudprofiler.v2.ICreateProfileRequest | null | undefined, {} | null | undefined>): void;
Parameters | |
---|---|
Name | Description |
request |
ICreateProfileRequest
|
callback |
Callback<protos.google.devtools.cloudprofiler.v2.IProfile, protos.google.devtools.cloudprofiler.v2.ICreateProfileRequest | null | undefined, {} | null | undefined>
|
Returns | |
---|---|
Type | Description |
void |
getProjectId()
getProjectId(): Promise<string>;
Returns | |
---|---|
Type | Description |
Promise<string> |
getProjectId(callback)
getProjectId(callback: Callback<string, undefined, undefined>): void;
Parameter | |
---|---|
Name | Description |
callback |
Callback<string, undefined, undefined>
|
Returns | |
---|---|
Type | Description |
void |
initialize()
initialize(): Promise<{
[name: string]: Function;
}>;
Initialize the client. Performs asynchronous operations (such as authentication) and prepares the client. This function will be called automatically when any class method is called for the first time, but if you need to initialize it before calling an actual method, feel free to call initialize() directly.
You can await on this method if you want to make sure the client is initialized.
Returns | |
---|---|
Type | Description |
Promise<{
[name: string]: Function;
}> | {Promise} A promise that resolves to an authenticated service stub. |
matchProfileFromProfileName(profileName)
matchProfileFromProfileName(profileName: string): string | number;
Parse the profile from Profile resource.
Parameter | |
---|---|
Name | Description |
profileName |
string
A fully-qualified path representing Profile resource. |
Returns | |
---|---|
Type | Description |
string | number | {string} A string representing the profile. |
matchProjectFromProfileName(profileName)
matchProjectFromProfileName(profileName: string): string | number;
Parse the project from Profile resource.
Parameter | |
---|---|
Name | Description |
profileName |
string
A fully-qualified path representing Profile resource. |
Returns | |
---|---|
Type | Description |
string | number | {string} A string representing the project. |
matchProjectFromProjectName(projectName)
matchProjectFromProjectName(projectName: string): string | number;
Parse the project from Project resource.
Parameter | |
---|---|
Name | Description |
projectName |
string
A fully-qualified path representing Project resource. |
Returns | |
---|---|
Type | Description |
string | number | {string} A string representing the project. |
profilePath(project, profile)
profilePath(project: string, profile: string): string;
Return a fully-qualified profile resource name string.
Parameters | |
---|---|
Name | Description |
project |
string
|
profile |
string
|
Returns | |
---|---|
Type | Description |
string | {string} Resource name string. |
projectPath(project)
projectPath(project: string): string;
Return a fully-qualified project resource name string.
Parameter | |
---|---|
Name | Description |
project |
string
|
Returns | |
---|---|
Type | Description |
string | {string} Resource name string. |
updateProfile(request, options)
updateProfile(request?: protos.google.devtools.cloudprofiler.v2.IUpdateProfileRequest, options?: CallOptions): Promise<[
protos.google.devtools.cloudprofiler.v2.IProfile,
protos.google.devtools.cloudprofiler.v2.IUpdateProfileRequest | undefined,
{} | undefined
]>;
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](https://cloud.google.com/profiler/docs/about-profiler#profiling_agent) instead for profile collection._
Parameters | |
---|---|
Name | Description |
request |
IUpdateProfileRequest
The request object that will be sent. |
options |
CallOptions
Call options. See CallOptions for more details. |
Returns | |
---|---|
Type | Description |
Promise<[
protos.google.devtools.cloudprofiler.v2.IProfile,
protos.google.devtools.cloudprofiler.v2.IUpdateProfileRequest | undefined,
{} | undefined
]> | {Promise} - The promise which resolves to an array. The first element of the array is an object representing Profile. Please see the documentation for more details and examples. |
/**
* This snippet has been automatically generated and should be regarded as a code template only.
* It will require modifications to work.
* It may require correct/in-range values for request initialization.
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* Profile to update.
*/
// const profile = {}
/**
* 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.
*/
// const updateMask = {}
// Imports the Cloudprofiler library
const {ProfilerServiceClient} = require('@google-cloud/cloudprofiler').v2;
// Instantiates a client
const cloudprofilerClient = new ProfilerServiceClient();
async function callUpdateProfile() {
// Construct request
const request = {
};
// Run request
const response = await cloudprofilerClient.updateProfile(request);
console.log(response);
}
callUpdateProfile();
updateProfile(request, options, callback)
updateProfile(request: protos.google.devtools.cloudprofiler.v2.IUpdateProfileRequest, options: CallOptions, callback: Callback<protos.google.devtools.cloudprofiler.v2.IProfile, protos.google.devtools.cloudprofiler.v2.IUpdateProfileRequest | null | undefined, {} | null | undefined>): void;
Parameters | |
---|---|
Name | Description |
request |
IUpdateProfileRequest
|
options |
CallOptions
|
callback |
Callback<protos.google.devtools.cloudprofiler.v2.IProfile, protos.google.devtools.cloudprofiler.v2.IUpdateProfileRequest | null | undefined, {} | null | undefined>
|
Returns | |
---|---|
Type | Description |
void |
updateProfile(request, callback)
updateProfile(request: protos.google.devtools.cloudprofiler.v2.IUpdateProfileRequest, callback: Callback<protos.google.devtools.cloudprofiler.v2.IProfile, protos.google.devtools.cloudprofiler.v2.IUpdateProfileRequest | null | undefined, {} | null | undefined>): void;
Parameters | |
---|---|
Name | Description |
request |
IUpdateProfileRequest
|
callback |
Callback<protos.google.devtools.cloudprofiler.v2.IProfile, protos.google.devtools.cloudprofiler.v2.IUpdateProfileRequest | null | undefined, {} | null | undefined>
|
Returns | |
---|---|
Type | Description |
void |