You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Apr 3, 2024. It is now read-only.
Copy file name to clipboardExpand all lines: README.md
+44-16Lines changed: 44 additions & 16 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -19,12 +19,25 @@ This module provides Stackdriver Debugger support for Node.js applications. [Sta
19
19
## Quick Start
20
20
```shell
21
21
# Install with `npm` or add to your `package.json`.
22
-
npm install --save @google/cloud-debug
22
+
npm install --save @google-cloud/debug
23
+
```
23
24
24
-
# Require and start the agent at the top of your main script (but after '@google/cloud-trace' if you are also using it).
25
-
require('@google/cloud-debug').start();
25
+
```js
26
+
// Require and start in the startup of your application:
27
+
var debug =require('@google-cloud/debug')();
28
+
debug.startAgent();
29
+
// No config necessary if your code is running on Google Cloud Platform.
30
+
31
+
// ... or, if you are running elsewhere, you can manually provide credentials:
32
+
var debug =require('@google-cloud/debug')({
33
+
projectId:'particular-future-12345',
34
+
keyFilename:'/path/to/keyfile.json'
35
+
});
36
+
debug.startAgent();
26
37
```
27
-
Deploy your application, and navigate to the [Stackdriver Debug view][debug-tab] within the [Google Cloud Console][dev-console] to set snapshots and start debugging.
38
+
39
+
This starts the automatic Debugger Agent that enables your app to be debuggable using the Stackdriver [Stackdriver Debug view][debug-tab] within
40
+
the [Google Cloud Console][dev-console]. You can start adding snapshots and log-points to your application.
28
41
29
42
## Running on Google Cloud Platform
30
43
@@ -50,9 +63,21 @@ Container Engine nodes need to also be created with the `cloud-platform` scope,
50
63
51
64
If your application is running outside of Google Cloud Platform, such as locally, on-premise, or on another cloud provider, you can still use Stackdriver Debugger.
52
65
53
-
1. You will need to specify your project name. Your project name is visible in the [Google Cloud Console][cloud-console-projects], it may be something like `particular-future-12345`. If your application is [running on Google Cloud Platform](running-on-google-cloud-platform), you don't need to specify the project name.
66
+
1. You will need to specify your project name. Your project name is visible in the [Google Cloud Console][cloud-console-projects], it may be something like `particular-future-12345`. If your application is [running on Google Cloud Platform](running-on-google-cloud-platform), you don't need to specify the project name. You can specify this either in the module options, or through an environment variable:
54
67
68
+
```js
69
+
// In your app:
70
+
var debug = require('@google-cloud/debug')({
71
+
projectId: 'particular-future-12345',
72
+
keyFilename: '/path/to/keyfile.json'
73
+
});
74
+
debug.startAgent();
75
+
```
76
+
77
+
```bash
78
+
# Or in Bash:
55
79
export GCLOUD_PROJECT=<project name>
80
+
```
56
81
57
82
1. You need to provide service account credentials to your application.
58
83
* The recommended way is via [Application Default Credentials][app-default-credentials].
@@ -64,32 +89,34 @@ If your application is running outside of Google Cloud Platform, such as locally
64
89
65
90
```js
66
91
// Require and start the agent with configuration options
67
-
require('@google/cloud-debug').start({
92
+
require('@google-cloud/debug').start({
68
93
// The path to your key file:
69
94
keyFilename:'/path/to/keyfile.json',
70
95
71
96
// Or the contents of the key file:
72
97
credentials:require('./path/to/keyfile.json')
73
98
});
74
99
```
75
-
76
-
See the [default configuration][config-js] for more details.
100
+
101
+
See the [configuration object][configuration-object] for more details.
77
102
78
103
1. Generate a `source-context.json` file which contains information about the version of the source code used to build the application. This file should be located in the root directory of your application. When you open the Stackdriver Debugger in the Cloud Platform Console, it uses the information inthis file to display the correct version of the source.
79
104
80
105
gcloud beta debug source gen-repo-info-file
81
106
82
-
## Configuration
107
+
## Debug Agent Settings
83
108
84
-
See [the default configuration][config-js] for a list of possible configuration options. These options can be passed to the agent through the object argument to the start command as shown below:
109
+
You can customize the behaviour of the automatic debuggeragent. See [the agent configuration][config-js] for a list of possible configuration options. These options can be passed to the agent through the object argument to the startAgent method as shown below:
0 commit comments