Skip to content

Commit 84a8e4b

Browse files
committed
2.1.1.1 show status code / content type when available ( Lucee6 )
1 parent 0eb49bb commit 84a8e4b

File tree

9 files changed

+86
-25
lines changed

9 files changed

+86
-25
lines changed

Application.cfc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
request.adminType = "web";
4545
try {
4646
request.singleMode = getConfigSettings().mode == "single";
47-
if ( request.singleMode)
47+
if (request.singleMode)
4848
request.adminType="server";
4949
} catch (e){
5050
// lucee 6.0 only

box.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name":"Lucee Performance Analyzer",
33
"author":"Zac Spitzer",
4-
"version":"2.1.1.0",
4+
"version":"2.1.1.1",
55
"bugs":"https://github.com/zspitzer/lucee-performance-analyzer/issues",
66
"thumbnail": "https://raw.githubusercontent.com/zspitzer/lucee-performance-analyzer/master/build/images/logo.png",
77
"changelog":"",
60.8 KB
Binary file not shown.

source/cfml/plugins/css/style.css

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ td, th {
1616
padding: 4 4 4 4;
1717
vertical-align:top;
1818
}
19-
th {/* like .tblHead */
19+
th, .maintbl th {/* like .tblHead */
2020
background-color:#39c; /* ABC */
2121
color:#efede5;
2222
font-weight:normal;
@@ -89,3 +89,15 @@ a {
8989
.header {
9090
padding-bottom:12px;
9191
}
92+
93+
.statusCode-4, .statusCode-5, .statusCode-6{
94+
background-color: red;
95+
color: white;
96+
}
97+
98+
.statusCode-1, .statusCode-2 {
99+
/*normal */
100+
}
101+
.statusCode-3 {
102+
background-color: yellow;
103+
}

source/cfml/plugins/footer.cfm

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,10 @@
88
</cfscript>
99
<cfoutput>
1010
<hr>
11-
<p>This report is based on all the debugging logs currently in memory ( #this.perf.getRawLogCount()# logs, #this.perf.getDebugMemUsage()# ) click column headers to sort</p>
11+
<p>This report is based on all the debugging logs currently in memory ( #this.perf.getRawLogCount()# logs, #this.perf.getDebugMemUsage()# )
12+
<cfif this.perf.getRawLogCount() gt 0> click column headers to sort </cfif>
13+
14+
</p>
1215

1316
<cfif hasJavaMethod(getPageContext().getConfig().getDebuggerPool(), "purge" )>
1417
<input type="button" class="bm button submit" name="mainAction" value="Purge Logs"

source/cfml/plugins/perf.cfc

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -295,9 +295,9 @@ component {
295295
<cfquery name="local.q_parts" dbtype="query">
296296
select template, lines, min(_min) as minTime, max(_max) as maxTime, avg(_avg) as avgTime,
297297
sum(total) as totalTime, sum(_count) as totalCount,
298-
sum(total) as total, count(*) as executions, snippet
298+
sum(total) as total, count(*) as executions, snippet, start, _end
299299
from q_parts
300-
group by template, lines, snippet
300+
group by template, lines, snippet, start, _end
301301
order by totalTime desc
302302
</cfquery>
303303
```
@@ -490,7 +490,7 @@ component {
490490
}
491491

492492
public struct function getDebugLogs( required array logs ){
493-
var q = QueryNew( "template,requestUrl,path,total,query,load,app,scope,exceptions,starttime,id,size,isThread" );
493+
var q = QueryNew( "template,requestUrl,path,total,query,load,app,scope,exceptions,starttime,id,size,isThread,statusCode,ContentType,ContentLength" );
494494
local.totals = {
495495
app = 0,
496496
query: 0,
@@ -539,20 +539,27 @@ component {
539539

540540

541541
local.r = QueryAddRow( q );
542-
QuerySetCell( local.q, "size", log.size, local.r);
543-
QuerySetCell( local.q, "id", log.id, local.r);
544-
QuerySetCell( local.q, "starttime", log.starttime, local.r);
545-
QuerySetCell( local.q, "template", local.cgi.script_name, local.r);
546-
QuerySetCell( local.q, "path", path, local.r);
547-
QuerySetCell( local.q, "total", _total, local.r);
548-
QuerySetCell( local.q, "query", _query, local.r);
549-
QuerySetCell( local.q, "load", _load, local.r);
550-
QuerySetCell( local.q, "app", _app, local.r);
551-
QuerySetCell( local.q, "scope", _scope, local.r);
552-
QuerySetCell( local.q, "exceptions", _exp, local.r);
542+
QuerySetCell( local.q, "size", log.size, local.r );
543+
QuerySetCell( local.q, "id", log.id, local.r );
544+
QuerySetCell( local.q, "starttime", log.starttime, local.r );
545+
QuerySetCell( local.q, "template", local.cgi.script_name, local.r );
546+
QuerySetCell( local.q, "path", path, local.r );
547+
QuerySetCell( local.q, "total", _total, local.r );
548+
QuerySetCell( local.q, "query", _query, local.r );
549+
QuerySetCell( local.q, "load", _load, local.r );
550+
QuerySetCell( local.q, "app", _app, local.r );
551+
QuerySetCell( local.q, "scope", _scope, local.r );
552+
QuerySetCell( local.q, "exceptions", _exp, local.r );
553553
QuerySetCell( local.q, "requestUrl", local.log.scope.cgi.REQUEST_URL, local.r );
554554
QuerySetCell( local.q, "isThread", ( Len( local.log.scope.cgi.HTTP_USER_AGENT ) eq 0 ), local.r );
555555

556+
if ( StructKeyExists( log, "statusCode" ) )
557+
QuerySetCell( local.q, "statusCode", log.statusCode, local.r );
558+
if ( StructKeyExists( log, "ContentType" ) )
559+
QuerySetCell( local.q, "ContentType", log.ContentType, local.r );
560+
if ( StructKeyExists( log, "ContentLength" ) )
561+
QuerySetCell( local.q, "ContentLength", log.ContentLength, local.r );
562+
556563
local.totals.size += + local.log.size / 1000;
557564
local.totals.app += _app;
558565
local.totals.query += _query;

source/cfml/plugins/requests.cfm

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
</cfif>
2929
<tr class="#altRow( local.q.currentRow )#">
3030
<td>#renderRequestLink( arguments.req, local.q.path, local.q.id )# <cfif local.q.isThread>(thread)</cfif></td>
31+
<td class="statusCode-#Left(local.q.statusCode,1)#">#listFirst(local.q.statusCode," ")#</td>
3132
<td>
3233
<a href="#local.baseUrl#&url=#urlEncodedFormat(q.requestUrl)#" title="Filter by Request URL">By Url</a>,&nbsp;
3334
<cfset local.host = this.Perf.getHost(q.requestUrl)>
@@ -45,7 +46,7 @@
4546
<td align="right">#prettyTime( local.q.load )#</td>
4647
<td align="right">#prettyNum( local.q.scope )#</td>
4748
<td align="right">#prettyNum( local.q.exceptions )#</td>
48-
<td align="right">#prettyNum( local.q.size / 1000 )#</td>
49+
<td align="right" title="Kb">#prettyNum( local.q.size / 1000 )#</td>
4950
</tr>
5051
</cfoutput>
5152
</cfloop>
@@ -54,15 +55,15 @@
5455

5556
<cfsavecontent variable="local.totals">
5657
<tr class="log-totals">
57-
<td colspan="3" align="center">Totals</td>
58+
<td colspan="4" align="center">Totals</td>
5859
<cfoutput>
5960
<td align="right">#prettyTime( local.logs.totals.total )#</td>
6061
<td align="right">#prettyTime( local.logs.totals.app )#</td>
6162
<td align="right">#prettyTime( local.logs.totals.query )#</td>
6263
<td align="right">#prettyTime( local.logs.totals.load )#</td>
6364
<td align="right">#prettyNum( local.logs.totals.scope )#</td>
6465
<td align="right">#prettyNum( local.logs.totals.exceptions )#</td>
65-
<td align="right">#prettyNum( local.logs.totals.size )#</td>
66+
<td align="right" title="Kb">#prettyNum( local.logs.totals.size )#</td>
6667
</cfoutput>
6768
</tr>
6869
</cfsavecontent>
@@ -71,6 +72,7 @@
7172
<thead>
7273
<tr>
7374
<th data-type="text">Url</th>
75+
<th title="http status code">Code</th>
7476
<th data-type="text">Filter</th>
7577
<th>Timestamp</th>
7678
<th>Total</th>
@@ -79,7 +81,7 @@
7981
<th>Load</th>
8082
<th>Scope Problems</th>
8183
<th>Exceptions</th>
82-
<th>Size (Kb)</th>
84+
<th>Log Size</th>
8385
</tr>
8486
<cfif local.q.recordcount gt 10>
8587
<cfoutput>#totals#</cfoutput>

source/cfml/plugins/settings.cfm

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,4 +114,8 @@
114114
</tfoot>
115115
</table>
116116
</form>
117+
118+
<p>
119+
<b>Please consider making a <a href="https://opencollective.com/Lucee">donation / supporting</a> the Lucee project</b>, so we can make Lucee even better!
120+
</p>
117121
</cfoutput>

source/cfml/plugins/toolbar.cfm

Lines changed: 36 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
variables.template = arguments.req.template;
66
variables.req = arguments.req;
77
8-
local.reports = ["Requests", "Templates", "Scopes", "Queries", "Timers", "Exceptions", "Dumps", "Aborts", "Traces", "Memory", "Threads", "Settings"];
8+
local.reports = ["Requests", "Templates", "Scopes", "Queries", "Timers", "Exceptions", "Dumps", "Aborts", "Traces", "Parts", "Memory", "Threads", "Settings"];
99
//if ( Len( arguments.req.template ) || Len( arguments.req.url ) || Len( arguments.req.log ) )
1010
ArrayPrepend(local.reports, "Analysis");
1111
local.path_reports = ["Requests", "Templates", "Scopes", "Queries", "Timers", "Exceptions", "Dumps", "Aborts", "Traces", "Parts"];
@@ -108,8 +108,41 @@
108108
</h3>
109109
<cfset local.singleLog = this.perf.getLog(arguments.req.log )>
110110
<cfif StructCount(singleLog)>
111-
Url: #encodeForHtml( singleLog.scope.cgi.request_url )#<br>
112-
User-Agent: <cfif len(singleLog.scope.cgi.http_user_agent) eq 0>Empty, probably a Lucee thread<cfelse>#encodeForHtml(singleLog.scope.cgi.http_user_agent)#</cfif><br>
111+
<table>
112+
<tr>
113+
<td>Url</td>
114+
<td><a href="#singleLog.scope.cgi.request_url#" target="blank" rel="noopener">#encodeForHtml( singleLog.scope.cgi.request_url )#</a></td>
115+
</tr>
116+
<cfif len(singleLog.scope.cgi.http_referer)>
117+
<tr>
118+
<td>Http Referer</td>
119+
<td><a href="#singleLog.scope.cgi.http_referer#" target="blank" rel="noopener">#encodeForHtml( singleLog.scope.cgi.http_referer )#</a></td>
120+
</tr>
121+
</cfif>
122+
<tr>
123+
<td>User-Agent</td>
124+
<td><cfif len(singleLog.scope.cgi.http_user_agent) eq 0>Empty, probably a Lucee thread<cfelse>#encodeForHtml(singleLog.scope.cgi.http_user_agent)#</cfif></td>
125+
</tr>
126+
<cfif structKeyExists(singleLog, "StatusCode")>
127+
<tr>
128+
<td>Status-Code</td>
129+
<td><span class="statusCode-#Left(singleLog.statusCode,1)#">#listFirst(singleLog.statusCode," ")#</span></td>
130+
</tr>
131+
</cfif>
132+
<cfif structKeyExists(singleLog, "contentType")>
133+
<tr>
134+
<td>Content-Type</td>
135+
<td>#singleLog.contentType#</td>
136+
</tr>
137+
</cfif>
138+
<cfif structKeyExists(singleLog, "contentLength") and len(singleLog.contentLength) gt 0>
139+
<tr>
140+
<td>Content-Length</td>
141+
<td>#singleLog.contentLength#</td>
142+
</tr>
143+
</cfif>
144+
145+
</table>
113146
<cfelse>
114147
Log not found?<br>
115148
</cfif>

0 commit comments

Comments
 (0)