Skip to content

Commit 465f9a1

Browse files
committed
multi-server, multi-container tracking
1 parent 6522d7c commit 465f9a1

File tree

4 files changed

+28
-11
lines changed

4 files changed

+28
-11
lines changed

handlers/Main.cfc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ component extends="coldbox.system.RestHandler" {
6666
debuggerService : variables.debuggerService,
6767
environment : variables.debuggerService.getEnvironment(),
6868
profilers : variables.debuggerService.getProfilerStorage(),
69-
currentProfiler : variables.debuggerService.getProfilerStorage()[ 1 ],
69+
currentProfiler : variables.debuggerService.getProfilerStorage()[ 1 ] ?: {},
7070
manifestRoot : event.getModuleRoot( "cbDebugger" ) & "/includes"
7171
}
7272
);

models/DebuggerService.cfc

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,6 @@ component
8383

8484
// Store Environment struct
8585
variables.environment = {
86-
"inetHost" : discoverInetHost(),
8786
"cfmlEngine" : server.coldfusion.productName,
8887
"cfmlVersion" : ( server.keyExists( "lucee" ) ? server.lucee.version : server.coldfusion.productVersion ),
8988
"javaVersion" : variables.jvmRuntime.version().toString(),
@@ -95,9 +94,7 @@ component
9594
"coldboxSuffix" : variables.controller.getColdBoxSettings().suffix,
9695
"appName" : variables.controller.getSetting( "appName" ),
9796
"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 )
97+
"appHash" : variables.controller.getAppHash()
10198
};
10299

103100
// Initialize secret key
@@ -207,7 +204,10 @@ component
207204
"queryString" : cgi.QUERY_STRING,
208205
"httpHost" : cgi.HTTP_HOST,
209206
"httpReferer" : cgi.HTTP_REFERER,
210-
"formData" : serializeJSON( form ?: {} )
207+
"formData" : serializeJSON( form ?: {} ),
208+
"inetHost" : discoverInetHost(),
209+
"dockerHost" : ( isNull( cgi.local_host ) ? "" : cgi.local_host ),
210+
"dockerIp" : ( isNull( cgi.local_addr ) ? "0.0.0.0" : cgi.local_addr )
211211
};
212212

213213
// Event before recording
@@ -313,6 +313,7 @@ component
313313
}
314314

315315
// Close out the profiler
316+
param request.cbDebugger.startCount = 0;
316317
request.cbDebugger.append(
317318
{
318319
"timers" : variables.timerService.getSortedTimers(),

views/main/partials/profilerReport.cfm

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@
118118
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor">
119119
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 7v10c0 2.21 3.582 4 8 4s8-1.79 8-4V7M4 7c0 2.21 3.582 4 8 4s8-1.79 8-4M4 7c0-2.21 3.582-4 8-4s8 1.79 8 4m0 5c0 2.21-3.582 4-8 4s-8-1.79-8-4" />
120120
</svg>
121-
#args.environment.inetHost#
121+
#args.profiler.inetHost#
122122
</div>
123123

124124
<div class="ml10" title="Thread Info">
@@ -128,12 +128,12 @@
128128
#args.profiler.threadInfo.replaceNoCase( "Thread", "" )#
129129
</div>
130130

131-
<cfif len( args.environment.dockerHost )>
131+
<cfif len( args.profiler.dockerHost )>
132132
<div class="ml10" title="Docker Info">
133133
<svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6" fill="none" viewBox="0 0 24 24" stroke="currentColor">
134134
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M20 7l-8-4-8 4m16 0l-8 4m8-4v10l-8 4m0-10L4 7m8 4v10M4 7v10l8 4" />
135135
</svg>
136-
#args.environment.dockerHost# / #args.environment.dockerIp#
136+
#args.profiler.dockerHost# / #args.profiler.dockerIp#
137137
</div>
138138
</cfif>
139139

views/main/partials/profilers.cfm

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
</th>
88
<th align="left" width="150">
99
Server<br>
10-
Thread
10+
Thread<br>
11+
Docker Info
1112
</th>
1213
<th align="left" width="75">
1314
Response Type
@@ -32,9 +33,11 @@
3233
<div>
3334
#timeformat( thisProfiler.timestamp, "hh:mm:ss.l tt" )#
3435
</div>
36+
3537
<div class="cbd-text-muted">
3638
<small>#dateformat( thisProfiler.timestamp, "mmm.dd.yyyy" )#</small>
3739
</div>
40+
3841
<div class="mt5">
3942
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor">
4043
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9.75 17L9 20l-1 1h8l-1-1-.75-3M3 13h18M5 17h14a2 2 0 002-2V5a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z" />
@@ -52,11 +55,17 @@
5255
<!--- Machine Info + Thread Info --->
5356
<td>
5457
<div>
55-
#args.environment.inetHost#
58+
#thisProfiler.inetHost#
5659
</div>
5760
<div class="mt5">
5861
#thisProfiler.threadInfo.replaceNoCase( "Thread", "" )#
5962
</div>
63+
64+
<cfif len( thisProfiler.dockerHost )>
65+
<div class="mt5">
66+
#thisProfiler.dockerHost# / #thisProfiler.dockerIp#
67+
</div>
68+
</cfif>
6069
</td>
6170

6271
<!--- Response & Content TYPE --->
@@ -121,4 +130,11 @@
121130
</tr>
122131
</cfloop>
123132
</table>
133+
134+
<cfif !arrayLen( args.profilers )>
135+
<div class="m10 cbd-text-red">
136+
<em>No profilers found just yet! Go execute your app!</em>
137+
</div>
138+
</cfif>
139+
124140
</cfoutput>

0 commit comments

Comments
 (0)