1313 * See the License for the specific language governing permissions and
1414 * limitations under the License.
1515 */
16- 'use strict' ;
1716
1817/**
1918 * @typedef {object } DebugAgentConfig
2019 */
21-
22- module . exports = {
23- // FIXME(ofrobots): presently this is dependent what cwd() is at the time this
24- // file is first required. We should make the default config static.
20+ export interface DebugAgentConfig {
2521 /**
2622 * @property {?string }
2723 * @memberof DebugAgentConfig
2824 * @default
2925 */
30- workingDirectory : process . cwd ( ) ,
26+ workingDirectory : string | null ,
3127
3228 /**
3329 * @property {?string } A user specified way of identifying the service
3430 * that the debug agent is monitoring.
3531 * @memberof DebugAgentConfig
3632 * @default
3733 */
38- description : null ,
34+ description : string | null ,
3935
4036 /**
4137 * @property {boolean } Whether or not it is permitted to evaluate expressions.
@@ -44,10 +40,8 @@ module.exports = {
4440 * @memberof DebugAgentConfig
4541 * @default
4642 */
47- allowExpressions : false ,
43+ allowExpressions : boolean ,
4844
49- // FIXME(ofrobots): today we prioritize GAE_MODULE_NAME/GAE_MODULE_VERSION
50- // over the user specified config. We should reverse that.
5145 /**
5246 * @property {object } Identifies the context of the running service -
5347 * [ServiceContext](https://cloud.google.com/error-reporting/reference/rest/v1beta1/ServiceContext?authuser=2).
@@ -64,20 +58,20 @@ module.exports = {
6458 * @property {?string } the service name
6559 * @default
6660 */
67- service : null ,
61+ service : string | null ,
6862
6963 /**
7064 * @property {?string } the service version
7165 * @default
7266 */
73- version : null ,
67+ version : string | null ,
7468
7569 /**
7670 * @property {?string } a unique deployment identifier. This is used
7771 * internally only.
7872 * @private
7973 */
80- minorVersion_ : null
74+ minorVersion_ : string | null
8175 } ,
8276
8377 /**
@@ -89,31 +83,31 @@ module.exports = {
8983 * @memberof DebugAgentConfig
9084 * @default
9185 */
92- appPathRelativeToRepository : null ,
86+ appPathRelativeToRepository : string | null ,
9387
9488 /**
9589 * @property {number } agent log level 0-disabled, 1-error, 2-warn, 3-info,
9690 * 4-debug
9791 * @memberof DebugAgentConfig
9892 * @default
9993 */
100- logLevel : 1 ,
94+ logLevel : number ,
10195
10296 /**
10397 * @property {number } How frequently should the list of breakpoints be
10498 * refreshed from the cloud debug server.
10599 * @memberof DebugAgentConfig
106100 * @default
107101 */
108- breakpointUpdateIntervalSec : 10 ,
102+ breakpointUpdateIntervalSec : number ,
109103
110104 /**
111105 * @property {number } breakpoints and logpoints older than this number of
112106 * seconds will be expired on the server.
113107 * @memberof DebugAgentConfig
114108 * @default
115109 */
116- breakpointExpirationSec : 60 * 60 * 24 , // 24 hours
110+ breakpointExpirationSec : number ,
117111
118112 /**
119113 * @property {object } configuration options on what is captured on a
@@ -126,29 +120,29 @@ module.exports = {
126120 * belonging to node-core.
127121 * @default
128122 */
129- includeNodeModules : false ,
123+ includeNodeModules : boolean ,
130124
131125
132126 /**
133127 * @property {number } Maximum number of stack frames to capture data for.
134128 * The limit is aimed to reduce overall capture time.
135129 * @default
136130 */
137- maxFrames : 20 ,
131+ maxFrames : number ,
138132
139133 /**
140134 * @property {number } We collect locals and arguments on a few top frames.
141135 * For the rest only collect the source location
142136 * @default
143137 */
144- maxExpandFrames : 5 ,
138+ maxExpandFrames : number ,
145139
146140 /**
147141 * @property {number } To reduce the overall capture time, limit the number
148142 * of properties gathered on large objects. A value of 0 disables the limit.
149143 * @default
150144 */
151- maxProperties : 10 ,
145+ maxProperties : number ,
152146
153147 /**
154148 * @property {number } Total 'size' of data to gather. This is NOT the
@@ -159,14 +153,14 @@ module.exports = {
159153 * traffic. A value of 0 disables the limit.
160154 * @default
161155 */
162- maxDataSize : 20000 ,
156+ maxDataSize : number ,
163157
164158 /**
165159 * @property {number } To limit the size of the buffer, we truncate long
166160 * strings. A value of 0 disables truncation.
167161 * @default
168162 */
169- maxStringLength : 100
163+ maxStringLength : number
170164 } ,
171165
172166 /**
@@ -180,14 +174,14 @@ module.exports = {
180174 * @memberof DebugAgentConfig
181175 * @default
182176 */
183- maxLogsPerSecond : 50 ,
177+ maxLogsPerSecond : number ,
184178
185179 /**
186180 * @property {number } Number of seconds to wait after the
187181 * `maxLogsPerSecond` rate is hit before logging resumes per logpoint.
188182 * @default
189183 */
190- logDelaySeconds : 1
184+ logDelaySeconds : number
191185 } ,
192186
193187 /**
@@ -197,8 +191,8 @@ module.exports = {
197191 * @private
198192 */
199193 internal : {
200- registerDelayOnFetcherErrorSec : 300 , // 5 minutes.
201- maxRegistrationRetryDelay : 40
194+ registerDelayOnFetcherErrorSec : number ,
195+ maxRegistrationRetryDelay : number
202196 } ,
203197
204198 /**
@@ -207,13 +201,58 @@ module.exports = {
207201 * @memberof DebugAgentConfig
208202 * @private
209203 */
210- forceNewAgent_ : false ,
204+ forceNewAgent_ : boolean ,
211205
212206 /**
213207 * @property {boolean } Uses by tests to cause the start() function to return
214208 * the debuglet.
215209 * @memberof DebugAgentConfig
216210 * @private
217211 */
212+ testMode_ : boolean
213+ }
214+
215+ const defaultConfig : DebugAgentConfig = {
216+ // FIXME(ofrobots): presently this is dependent what cwd() is at the time this
217+ // file is first required. We should make the default config static.
218+ workingDirectory : process . cwd ( ) ,
219+ description : null ,
220+ allowExpressions : false ,
221+
222+ // FIXME(ofrobots): today we prioritize GAE_MODULE_NAME/GAE_MODULE_VERSION
223+ // over the user specified config. We should reverse that.
224+ serviceContext : {
225+ service : null ,
226+ version : null ,
227+ minorVersion_ : null
228+ } ,
229+
230+ appPathRelativeToRepository : null ,
231+ logLevel : 1 ,
232+ breakpointUpdateIntervalSec : 10 ,
233+ breakpointExpirationSec : 60 * 60 * 24 , // 24 hours
234+
235+ capture : {
236+ includeNodeModules : false ,
237+ maxFrames : 20 ,
238+ maxExpandFrames : 5 ,
239+ maxProperties : 10 ,
240+ maxDataSize : 20000 ,
241+ maxStringLength : 100
242+ } ,
243+
244+ log : {
245+ maxLogsPerSecond : 50 ,
246+ logDelaySeconds : 1
247+ } ,
248+
249+ internal : {
250+ registerDelayOnFetcherErrorSec : 300 , // 5 minutes.
251+ maxRegistrationRetryDelay : 40
252+ } ,
253+
254+ forceNewAgent_ : false ,
218255 testMode_ : false
219256} ;
257+
258+ export default defaultConfig ;
0 commit comments