NAME

gcloud beta debug snapshots create - create debug snapshots for a Cloud Debugger debug target (debuggee)

SYNOPSIS

gcloud beta debug snapshots create LOCATION [--condition=CONDITION] [--expression=EXPRESSION] [--target=(ID|DESCRIPTION_REGEXP)] [--wait=WAIT; default=10] [GCLOUD_WIDE_FLAG ...]

DESCRIPTION

(BETA) gcloud beta debug snapshots create is used to create a debug snapshot on a Cloud Debugger debug target. Snapshots allow you to capture stack traces and local variables from your running service without interfering with normal operations.

When any instance of the target executes the snapshot location, the optional condition expression is evaluated. If the result is true (or if there is no condition), the instance captures the current thread state and reports it back to Cloud Debugger. Once any instance captures a snapshot, the snapshot is marked as completed, and it will not be captured again.

You can view snapshot results in the developer console. It is also possible to inspect snapshot results with the "snapshots describe" command.

EXAMPLES

To create a snapshot with no conditions or expressions at line 41 of file main.py of a debug target (debuggee), run:

$ gcloud beta debug snapshots create main.py:41 \ --target=<debuggee_id>

To create a snapshot at line 41 of file main.py on a debug target (debuggee) that will only trigger if the variable name has the value of 'foo', run:

$ gcloud beta debug snapshots create main.py:41 \ --target=<debuggee_id> --condition="name == 'foo'"

To create a snapshot at line 41 of file main.py on a debug target (debuggee) with the expressions name[0] and name[1], run:

$ gcloud beta debug snapshots create main.py:41 \ --target=<debuggee_id> --expression="name[0]" \ --expression="name[1]"

POSITIONAL ARGUMENTS

LOCATION

The location where the snapshot should be taken. Locations are of the form FILE:LINE, where FILE can be simply the file name, or the file name preceded by enough path components to differntiate it from other files with the same name. If the file name is not unique in the debug target, the behavior is unspecified.

FLAGS

--condition=CONDITION

A condition to restrict when the snapshot is taken. When the snapshot location is executed, the condition will be evaluated, and the snapshot will be generated only if the condition is true.

--expression=EXPRESSION

An expression to evaluate when the snapshot is taken. You may specify --expression multiple times.

--target=(ID|DESCRIPTION_REGEXP)

The debug target. It may be a target ID or name obtained from 'debug targets list', or it may be a regular expression uniquely specifying a debuggee based on its description or name. For App Engine projects, if not specified, the default target is the most recent deployment of the default module and version.

--wait=WAIT; default=10

The number of seconds to wait to ensure that no error is returned from a debugger agent when creating the snapshot. When a snapshot is created, there will be a delay before the agents see and apply the snapshot. Until at least one agent has attempted to enable the snapshot, it cannot be determined if the snapshot is valid.

GCLOUD WIDE FLAGS

These flags are available to all commands: --access-token-file, --account, --billing-project, --configuration, --flags-file, --flatten, --format, --help, --impersonate-service-account, --log-http, --project, --quiet, --trace-token, --user-output-enabled, --verbosity.

Run $ gcloud help for details.

NOTES

This command is currently in beta and might change without notice. This variant is also available:

$ gcloud debug snapshots create