Skip to content
This repository was archived by the owner on Jan 23, 2024. It is now read-only.

Commit 2774034

Browse files
authored
docs: modify docs to remove deprecated functionality (#89)
Cloud Debugger API has been shut down, so the docs should reflect the current state.
1 parent 29b4ecd commit 2774034

File tree

1 file changed

+30
-102
lines changed

1 file changed

+30
-102
lines changed

README.md

Lines changed: 30 additions & 102 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
1-
# Python Cloud Debugger Agent
1+
# Python Snapshot Debugger Agent
22

3-
Google [Cloud Debugger](https://cloud.google.com/debugger/) for
4-
Python 3.6, Python 3.7, Python 3.8, Python 3.9, and Python 3.10.
3+
[Snapshot debugger](https://github.com/GoogleCloudPlatform/snapshot-debugger/)
4+
agent for Python 3.6, Python 3.7, Python 3.8, Python 3.9, and Python 3.10.
55

66
## Overview
77

8-
Cloud Debugger (also known as Stackdriver Debugger) lets you inspect the state
8+
Snapshot Debugger lets you inspect the state
99
of a running cloud application, at any code location, without stopping or
1010
slowing it down. It is not your traditional process debugger but rather an
1111
always on, whole app debugger taking snapshots from any instance of the app.
1212

13-
Cloud Debugger is safe for use with production apps or during development. The
13+
Snapshot Debugger is safe for use with production apps or during development. The
1414
Python debugger agent only few milliseconds to the request latency when a debug
1515
snapshot is captured. In most cases, this is not noticeable to users.
1616
Furthermore, the Python debugger agent does not allow modification of
1717
application state in any way, and has close to zero impact on the app instances.
1818

19-
Cloud Debugger attaches to all instances of the app providing the ability to
19+
Snapshot Debugger attaches to all instances of the app providing the ability to
2020
take debug snapshots and add logpoints. A snapshot captures the call-stack and
2121
variables from any one instance that executes the snapshot location. A logpoint
2222
writes a formatted message to the application log whenever any instance of the
@@ -25,26 +25,22 @@ app executes the logpoint location.
2525
The Python debugger agent is only supported on Linux at the moment. It was
2626
tested on Debian Linux, but it should work on other distributions as well.
2727

28-
Cloud Debugger consists of 3 primary components:
28+
Snapshot Debugger consists of 3 primary components:
2929

3030
1. The Python debugger agent (this repo implements one for CPython 3.6,
3131
3.7, 3.8, 3.9, and 3.10).
32-
2. Cloud Debugger service storing and managing snapshots/logpoints. Explore the
33-
APIs using
34-
[APIs Explorer](https://cloud.google.com/debugger/api/reference/rest/).
32+
2. A Firebase Realtime Database for storing and managing snapshots/logpoints.
33+
Explore the
34+
[schema](https://github.com/GoogleCloudPlatform/snapshot-debugger/blob/main/docs/SCHEMA.md).
3535
3. User interface, including a command line interface
36-
[`gcloud debug`](https://cloud.google.com/sdk/gcloud/reference/debug/) and a
37-
Web interface on
38-
[Google Cloud Console](https://console.cloud.google.com/debug/). See the
39-
[online help](https://cloud.google.com/debugger/docs/using/snapshots) on how
40-
to use Google Cloud Console Debug page.
36+
[`snapshot-dbg-cli`](https://pypi.org/project/snapshot-dbg-cli/) and a
37+
[VSCode extension](https://github.com/GoogleCloudPlatform/snapshot-debugger/tree/main/snapshot_dbg_extension)
4138

4239
## Getting Help
4340

41+
1. File an [issue](https://github.com/GoogleCloudPlatform/cloud-debug-python/issues)
4442
1. StackOverflow:
4543
http://stackoverflow.com/questions/tagged/google-cloud-debugger
46-
2. Send email to: [Cloud Debugger Feedback](mailto:cdbg-feedback@google.com)
47-
3. Send Feedback from Google Cloud Console
4844

4945
## Installation
5046

@@ -86,22 +82,13 @@ minimal image with the agent installed.
8682

8783
### Google Cloud Platform
8884

89-
1. First, make sure that you created the VM with this option enabled:
90-
91-
> Allow API access to all Google Cloud services in the same project.
92-
93-
This option lets the Python debugger agent authenticate with the machine
94-
account of the Virtual Machine.
95-
96-
It is possible to use the Python debugger agent without it. Please see the
97-
[next section](#outside-google-cloud-platform) for details.
85+
1. First, make sure that the VM has the
86+
[required scopes](https://github.com/GoogleCloudPlatform/snapshot-debugger/blob/main/docs/configuration.md#access-scopes).
9887

9988
2. Install the Python debugger agent as explained in the
10089
[Installation](#installation) section.
10190

102-
3. Enable the debugger in your application using one of the two options:
103-
104-
_Option A_: add this code to the beginning of your `main()` function:
91+
3. Enable the debugger in your application:
10592

10693
```python
10794
# Attach Python Cloud Debugger
@@ -112,20 +99,7 @@ minimal image with the agent installed.
11299
pass
113100
```
114101

115-
_Option B_: run the debugger agent as a module:
116-
117-
<pre>
118-
python \
119-
<b>-m googleclouddebugger --module=[MODULE] --version=[VERSION] --</b> \
120-
myapp.py
121-
</pre>
122-
123-
**Note:** This option does not work well with tools such as
124-
`multiprocessing` or `gunicorn`. These tools spawn workers in separate
125-
processes, but the debugger does not get enabled on these worker processes.
126-
Please use _Option A_ instead.
127-
128-
Where, in both cases:
102+
Where:
129103

130104
* `[MODULE]` is the name of your app. This, along with the version, is
131105
used to identify the debug target in the UI.<br>
@@ -160,7 +134,7 @@ account.
160134
1. Use the Google Cloud Console Service Accounts
161135
[page](https://console.cloud.google.com/iam-admin/serviceaccounts/project)
162136
to create a credentials file for an existing or new service account. The
163-
service account must have at least the `Stackdriver Debugger Agent` role.
137+
service account must have at least the `roles/firebasedatabase.admin` role.
164138

165139
2. Once you have the service account credentials JSON file, deploy it alongside
166140
the Python debugger agent.
@@ -174,8 +148,6 @@ account.
174148
Alternatively, you can provide the path to the credentials file directly to
175149
the debugger agent.
176150

177-
_Option A_:
178-
179151
```python
180152
# Attach Python Cloud Debugger
181153
try:
@@ -187,19 +159,6 @@ account.
187159
except ImportError:
188160
pass
189161
```
190-
191-
_Option B_:
192-
193-
<pre>
194-
python \
195-
<b>-m googleclouddebugger \
196-
--module=[MODULE] \
197-
--version=[VERSION] \
198-
--service_account_json_file=<i>/path/to/credentials.json</i> \
199-
--</b> \
200-
myapp.py
201-
</pre>
202-
203162
4. Follow the rest of the steps in the [GCP](#google-cloud-platform) section.
204163

205164
### Django Web Framework
@@ -224,45 +183,15 @@ Alternatively, you can pass the `--noreload` flag when running the Django
224183
using the `--noreload` flag disables the autoreload feature in Django, which
225184
means local changes to files will not be automatically picked up by Django.
226185

227-
### Snapshot Debugger - Firebase Realtime Database Backend
228-
229-
This functionality is available for release 3.0 onward of this agent and
230-
provides support for the Snapshot Debugger, which is being provided as a
231-
replacement for the deprecated Cloud Debugger service.
232-
233-
The agent can be configured to use Firebase Realtime Database as a backend
234-
instead of the Cloud Debugger service. If the Firebase backend is used,
235-
breakpoints can be viewed and set using the Snapshot Debugger CLI instead of the
236-
Cloud Console.
237-
238-
To use the Firebase backend, set the flag when enabling the agent:
239-
240-
```python
241-
try:
242-
import googleclouddebugger
243-
googleclouddebugger.enable(use_firebase=True)
244-
except ImportError:
245-
pass
246-
```
247-
248-
Additional configuration can be provided if necessary:
249-
250-
```python
251-
try:
252-
import googleclouddebugger
253-
googleclouddebugger.enable(
254-
use_firebase=True,
255-
project_id='my-project-id',
256-
firebase_db_url='https://my-database-url.firebaseio.com',
257-
service_account_json_file='path/to/service_account.json',
258-
)
259-
except ImportError:
260-
pass
261-
```
262-
263-
See https://github.com/GoogleCloudPlatform/snapshot-debugger and
264-
https://cloud.google.com/debugger/docs/deprecations for more details.
186+
## Historical note
265187

188+
Version 3.x of this agent supported both the now shutdown Cloud Debugger service
189+
(by default) and the
190+
[Snapshot Debugger](https://github.com/GoogleCloudPlatform/snapshot-debugger/)
191+
(Firebase RTDB backend) by setting the `use_firebase` flag to true. Version 4.0
192+
removed support for the Cloud Debugger service, making the Snapshot Debugger the
193+
default. To note the `use_firebase` flag is now obsolete, but still present for
194+
backward compatibility.
266195

267196
## Flag Reference
268197

@@ -298,11 +227,10 @@ which are automatically available on machines hosted on GCP, or can be set via
298227
`gcloud auth application-default login` or the `GOOGLE_APPLICATION_CREDENTIALS`
299228
environment variable.
300229

301-
`breakpoint_enable_canary`: Whether to enable the
302-
[breakpoint canary feature](https://cloud.google.com/debugger/docs/using/snapshots#with_canarying).
303-
It expects a boolean value (`True`/`False`) or a string, with `'True'`
304-
interpreted as `True` and any other string interpreted as `False`). If not
305-
provided, the breakpoint canarying will not be enabled.
230+
`firebase_db_url`: Url pointing to a configured Firebase Realtime Database for
231+
the agent to use to store snapshot data.
232+
https://**PROJECT_ID**-cdbg.firebaseio.com will be used if not provided. where
233+
**PROJECT_ID** is your project ID.
306234

307235
## Development
308236

0 commit comments

Comments
 (0)