@@ -30,11 +30,6 @@ component
30
30
*/
31
31
property name = " cookieName" ;
32
32
33
- /**
34
- * The collection of request profilers we track in the debugger
35
- */
36
- property name = " profilers" type = " array" ;
37
-
38
33
/**
39
34
* The debugger configuration struct
40
35
*/
@@ -98,7 +93,11 @@ component
98
93
" coldboxName" : variables .controller .getColdBoxSettings ().codename ,
99
94
" coldboxVersion" : variables .controller .getColdBoxSettings ().version ,
100
95
" coldboxSuffix" : variables .controller .getColdBoxSettings ().suffix ,
101
- " coldboxModules" : variables .controller .getModuleService ().getLoadedModules ()
96
+ " appName" : variables .controller .getSetting ( " appName" ),
97
+ " appPath" : variables .controller .getSetting ( " applicationPath" ),
98
+ " appHash" : variables .controller .getAppHash (),
99
+ " dockerHost" : ( isNull ( cgi .local_host ) ? " " : cgi .local_host ),
100
+ " dockerIp" : ( isNull ( cgi .local_addr ) ? " 0.0.0.0" : cgi .local_addr )
102
101
};
103
102
104
103
// Initialize secret key
@@ -107,6 +106,13 @@ component
107
106
return this ;
108
107
}
109
108
109
+ /**
110
+ * Get the cache region configured for the debugger
111
+ */
112
+ private function getCacheRegion (){
113
+ return variables .controller .getCacheBox ().getCache ( variables .debuggerConfig .requestTracker .cacheName );
114
+ }
115
+
110
116
/**
111
117
* I generate a secret key value for the cookie which enables debug mode
112
118
*/
@@ -221,14 +227,42 @@ component
221
227
return request .cbDebugger ;
222
228
}
223
229
230
+ /**
231
+ * Get the key used in the off heap storage
232
+ */
233
+ function getStorageKey (){
234
+ return " cbDebugger-#variables .environment .appName .replace ( " " , " -" , " all" ) #" ;
235
+ }
236
+
224
237
/**
225
238
* Reset the request tracking profilers
226
239
*/
227
240
DebuggerService function resetProfilers (){
228
- variables .profilers = [];
241
+ if ( variables .debuggerConfig .requestTracker .storage eq " cachebox" ) {
242
+ getCacheRegion ().set ( getStorageKey (), [], 0 , 0 );
243
+ } else {
244
+ variables .profilers = [];
245
+ }
229
246
return this ;
230
247
}
231
248
249
+ /**
250
+ * Get the profiler storage array depending on the storage options
251
+ */
252
+ array function getProfilerStorage (){
253
+ if ( variables .debuggerConfig .requestTracker .storage eq " cachebox" ) {
254
+ return getCacheRegion ().getOrSet (
255
+ getStorageKey (),
256
+ function (){
257
+ return [];
258
+ },
259
+ 0
260
+ );
261
+ } else {
262
+ return variables .profilers ;
263
+ }
264
+ }
265
+
232
266
/**
233
267
* Record a profiler and it's timers internally
234
268
*
@@ -241,9 +275,14 @@ component
241
275
required executionTime ,
242
276
exception = {}
243
277
){
278
+ var targetStorage = getProfilerStorage ();
279
+
244
280
// size check, if passed, pop one
245
- if ( arrayLen ( variables .profilers ) gte variables .debuggerConfig .requestTracker .maxProfilers ) {
246
- popProfiler ();
281
+ if ( arrayLen ( targetStorage ) gte variables .debuggerConfig .requestTracker .maxProfilers ) {
282
+ arrayDeleteAt (
283
+ targetStorage ,
284
+ arrayLen ( targetStorage )
285
+ );
247
286
}
248
287
249
288
// Build out the exception data to trace if any?
@@ -306,11 +345,14 @@ component
306
345
{ requestTracker : request .cbDebugger }
307
346
);
308
347
309
- // New Profiler record to store into the stack
310
- arrayPrepend (
311
- variables .profilers ,
312
- request .cbDebugger
313
- );
348
+ // New Profiler record to store into the singleton stack
349
+ arrayPrepend ( targetStorage , request .cbDebugger );
350
+
351
+ // Are we using cache storage
352
+ if ( variables .debuggerConfig .requestTracker .storage eq " cachebox" ) {
353
+ // store indefintely using the debugger and app hash
354
+ getCacheRegion ().set ( getStorageKey (), targetStorage , 0 , 0 );
355
+ }
314
356
315
357
return this ;
316
358
}
@@ -323,7 +365,7 @@ component
323
365
* @return The profiler requested or an empty struct if not found
324
366
*/
325
367
struct function getProfilerById ( required id ){
326
- return variables . profilers
368
+ return getProfilerStorage ()
327
369
.filter ( function ( thisItem ){
328
370
return arguments .this Item .id .toString () == id ;
329
371
} )
@@ -333,17 +375,6 @@ component
333
375
}, {} );
334
376
}
335
377
336
- /**
337
- * Pop a profiler record from the top
338
- */
339
- DebuggerService function popProfiler (){
340
- arrayDeleteAt (
341
- variables .profilers ,
342
- arrayLen ( variables .profilers )
343
- );
344
- return this ;
345
- }
346
-
347
378
/**
348
379
* Push a new tracer into the debugger. This comes from LogBox, so we follow
349
380
* the same patterns
0 commit comments