You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by sf...@apache.org on 2012/12/09 14:20:14 UTC
svn commit: r1418937 - in /httpd/httpd/branches/2.4.x: ./ CHANGES STATUS
docs/manual/mod/mod_headers.xml modules/metadata/mod_headers.c
Author: sf
Date: Sun Dec 9 13:20:13 2012
New Revision: 1418937
URL: http://svn.apache.org/viewvc?rev=1418937&view=rev
Log:
Merge r1389565, r1389566, r1389569:
Allow for exposure of loadavg and server load via mod_headers
Might as well show 'em all
Document new mod_headers params: %l, %i, %b
Submitted by: jim
Reviewed by: jailletc36, druggeri, minfrin
Modified:
httpd/httpd/branches/2.4.x/ (props changed)
httpd/httpd/branches/2.4.x/CHANGES
httpd/httpd/branches/2.4.x/STATUS
httpd/httpd/branches/2.4.x/docs/manual/mod/mod_headers.xml
httpd/httpd/branches/2.4.x/modules/metadata/mod_headers.c
Propchange: httpd/httpd/branches/2.4.x/
------------------------------------------------------------------------------
Merged /httpd/httpd/trunk:r1389566-1389569
Modified: httpd/httpd/branches/2.4.x/CHANGES
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.4.x/CHANGES?rev=1418937&r1=1418936&r2=1418937&view=diff
==============================================================================
--- httpd/httpd/branches/2.4.x/CHANGES [utf-8] (original)
+++ httpd/httpd/branches/2.4.x/CHANGES [utf-8] Sun Dec 9 13:20:13 2012
@@ -2,6 +2,9 @@
Changes with Apache 2.4.4
+ *) mod_header: Allow for exposure of loadavg and server load using new
+ format specifiers %l, %i, %b [Jim Jagielski]
+
*) core: Make ap_regcomp() return AP_REG_ESPACE if out of memory. Make
ap_pregcomp() abort if out of memory. This raises the minimum PCRE
requirement to version 6.0. [Stefan Fritsch]
Modified: httpd/httpd/branches/2.4.x/STATUS
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.4.x/STATUS?rev=1418937&r1=1418936&r2=1418937&view=diff
==============================================================================
--- httpd/httpd/branches/2.4.x/STATUS (original)
+++ httpd/httpd/branches/2.4.x/STATUS Sun Dec 9 13:20:13 2012
@@ -91,13 +91,6 @@ RELEASE SHOWSTOPPERS:
PATCHES ACCEPTED TO BACKPORT FROM TRUNK:
[ start all new proposals below, under PATCHES PROPOSED. ]
- * mod_headers: Allow for exposure of loadavg and server load via mod_headers
- trunk patch: http://svn.apache.org/viewvc?view=revision&revision=1389565
- http://svn.apache.org/viewvc?view=revision&revision=1389566
- http://svn.apache.org/viewvc?view=revision&revision=1389569 (doc)
- 2.4.x patch: http://people.apache.org/~jailletc36/backport_mod_header.patch
- +1: jailletc36, druggeri, minfrin
-
* various mods: host and URI escaping
trunk patch: http://svn.apache.org/viewvc?view=revision&revision=1413732
http://svn.apache.org/viewvc?view=revision&revision=1418752
Modified: httpd/httpd/branches/2.4.x/docs/manual/mod/mod_headers.xml
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.4.x/docs/manual/mod/mod_headers.xml?rev=1418937&r1=1418936&r2=1418937&view=diff
==============================================================================
--- httpd/httpd/branches/2.4.x/docs/manual/mod/mod_headers.xml (original)
+++ httpd/httpd/branches/2.4.x/docs/manual/mod/mod_headers.xml Sun Dec 9 13:20:13 2012
@@ -427,6 +427,24 @@ Header merge Cache-Control no-store env=
of the request. The value is preceded by <code>D=</code>.
The value is measured in microseconds.</td></tr>
+ <tr><td><code>%l</code></td>
+ <td>The current load averages of the actual server itself. It is
+ designed to expose the values obtained by <code>getloadavg()</code>
+ and this represents the current load average, the 5 minute average, and
+ the 15 minute average. The value is preceded by <code>l=</code> with each
+ average separated by <code>/</code>.
+ </td></tr>
+
+ <tr><td><code>%i</code></td>
+ <td>The current idle percentage of httpd (0 to 100) based on available
+ processes and threads. The value is preceded by <code>i=</code>.
+ </td></tr>
+
+ <tr><td><code>%b</code></td>
+ <td>The current busy percentage of httpd (0 to 100) based on available
+ processes and threads. The value is preceded by <code>b=</code>.
+ </td></tr>
+
<tr><td><code>%{VARNAME}e</code></td>
<td>The contents of the <a href="../env.html">environment
variable</a> <code>VARNAME</code>.</td></tr>
Modified: httpd/httpd/branches/2.4.x/modules/metadata/mod_headers.c
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.4.x/modules/metadata/mod_headers.c?rev=1418937&r1=1418936&r2=1418937&view=diff
==============================================================================
--- httpd/httpd/branches/2.4.x/modules/metadata/mod_headers.c (original)
+++ httpd/httpd/branches/2.4.x/modules/metadata/mod_headers.c Sun Dec 9 13:20:13 2012
@@ -220,6 +220,28 @@ static const char *header_request_ssl_va
}
}
+static const char *header_request_loadavg(request_rec *r, char *a)
+{
+ ap_loadavg_t t;
+ ap_get_loadavg(&t);
+ return apr_psprintf(r->pool, "l=%.2f/%.2f/%.2f", t.loadavg,
+ t.loadavg5, t.loadavg15);
+}
+
+static const char *header_request_idle(request_rec *r, char *a)
+{
+ ap_sload_t t;
+ ap_get_sload(&t);
+ return apr_psprintf(r->pool, "i=%d", t.idle);
+}
+
+static const char *header_request_busy(request_rec *r, char *a)
+{
+ ap_sload_t t;
+ ap_get_sload(&t);
+ return apr_psprintf(r->pool, "b=%d", t.busy);
+}
+
/*
* Config routines
*/
@@ -905,6 +927,9 @@ static int header_pre_config(apr_pool_t
register_format_tag_handler("t", header_request_time);
register_format_tag_handler("e", header_request_env_var);
register_format_tag_handler("s", header_request_ssl_var);
+ register_format_tag_handler("l", header_request_loadavg);
+ register_format_tag_handler("i", header_request_idle);
+ register_format_tag_handler("b", header_request_busy);
return OK;
}