Commit 839b743b authored by Jim Jagielski's avatar Jim Jagielski
Browse files

Merge r1671397, r1672466, r1672564 from trunk:

Add output for "?auto" version of server-status
to proxy status, mod_ssl session cache info,
mod_cache_socache and the status hook of the
individual socache implementations.


Followon to r1671397 for proxy server-status
in auto mode:
- don't show HTML legend
- Show correct worker name


More followon to r1671397 for proxy server-status
in auto mode:
- remove remaining HTML markup

Submitted by: rjung
Reviewed/backported by: jim


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1674660 13f79535-47bb-0310-9956-ffa450edef68
parent 161b5209
Loading
Loading
Loading
Loading
+0 −10
Changes for STATUS: 0 added lines, 10 removed lines.
Original line number Diff line number Diff line
@@ -105,16 +105,6 @@ RELEASE SHOWSTOPPERS:
PATCHES ACCEPTED TO BACKPORT FROM TRUNK:
  [ start all new proposals below, under PATCHES PROPOSED. ]

  *) mod_ssl, mod_proxy, mod_cache_socache, mod_socache_*: Add plain text
     output to status hook (server-status) when called with "?auto"
     (machine readable form).
     trunk patch: http://svn.apache.org/r1671397
                  http://svn.apache.org/r1672466
                  http://svn.apache.org/r1672564
     2.4.x patch: http://people.apache.org/~rjung/patches/enhance-socache-status-auto.patch
                  (same as trunk but combined into one)
     +1: rjung, covener, jim

  *) mod_proxy_wstunnel: Bypass the handler while the connection is not
     upgraded to WebSocket, so that other modules can possibly take over
     the leading HTTP requests.
+12 −0
Changes for modules/cache/mod_cache_socache.c: 12 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -1387,6 +1387,7 @@ static int socache_status_hook(request_rec *r, int flags)
        return DECLINED;
    }

    if (!(flags & AP_STATUS_SHORT)) {
        ap_rputs("<hr>\n"
                 "<table cellspacing=0 cellpadding=0>\n"
                 "<tr><td bgcolor=\"#000000\">\n"
@@ -1394,6 +1395,10 @@ static int socache_status_hook(request_rec *r, int flags)
                 "mod_cache_socache Status:</font></b>\n"
                 "</td></tr>\n"
                 "<tr><td bgcolor=\"#ffffff\">\n", r);
    }
    else {
        ap_rputs("ModCacheSocacheStatus\n", r);
    }

    if (socache_mutex) {
        status = apr_global_mutex_lock(socache_mutex);
@@ -1404,7 +1409,12 @@ static int socache_status_hook(request_rec *r, int flags)
    }

    if (status != APR_SUCCESS) {
        if (!(flags & AP_STATUS_SHORT)) {
            ap_rputs("No cache status data available\n", r);
        }
        else {
            ap_rputs("NotAvailable\n", r);
        }
    } else {
        conf->provider->socache_provider->status(conf->provider->socache_instance,
                                                 r, flags);
@@ -1418,7 +1428,9 @@ static int socache_status_hook(request_rec *r, int flags)
        }
    }

    if (!(flags & AP_STATUS_SHORT)) {
        ap_rputs("</td></tr>\n</table>\n", r);
    }
    return OK;
}

+10 −0
Changes for modules/cache/mod_socache_dbm.c: 10 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@
#include "http_protocol.h"
#include "http_config.h"
#include "mpm_common.h"
#include "mod_status.h"

#include "apr.h"
#include "apr_strings.h"
@@ -497,9 +498,18 @@ static void socache_dbm_status(ap_socache_instance_t *ctx, request_rec *r,
        avg = (int)(size / (long)elts);
    else
        avg = 0;
    if (!(flags & AP_STATUS_SHORT)) {
        ap_rprintf(r, "cache type: <b>DBM</b>, maximum size: <b>unlimited</b><br>");
        ap_rprintf(r, "current entries: <b>%d</b>, current size: <b>%ld</b> bytes<br>", elts, size);
        ap_rprintf(r, "average entry size: <b>%d</b> bytes<br>", avg);
    }
    else {
        ap_rputs("CacheType: DBM\n", r);
        ap_rputs("CacheMaximumSize: unlimited\n", r);
        ap_rprintf(r, "CacheCurrentEntries: %d\n", elts);
        ap_rprintf(r, "CacheCurrentSize: %ld\n", size);
        ap_rprintf(r, "CacheAvgEntrySize: %d\n", avg);
    }
    return;
}

+7 −0
Changes for modules/cache/mod_socache_dc.c: 7 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@
#include "http_request.h"
#include "http_config.h"
#include "http_protocol.h"
#include "mod_status.h"

#include "apr_strings.h"
#include "apr_time.h"
@@ -151,9 +152,15 @@ static void socache_dc_status(ap_socache_instance_t *ctx, request_rec *r, int fl
{
    ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, APLOGNO(00747)
                  "distributed scache 'socache_dc_status'");
    if (!(flags & AP_STATUS_SHORT)) {
        ap_rprintf(r, "cache type: <b>DC (Distributed Cache)</b>, "
                   " target: <b>%s</b><br>", ctx->target);
    }
    else {
        ap_rputs("CacheType: DC\n", r);
        ap_rvputs(r, "CacheTarget: ", ctx->target, "\n", NULL);
    }
}

static apr_status_t socache_dc_iterate(ap_socache_instance_t *instance,
                                       server_rec *s, void *userctx,
+31 −1
Changes for modules/cache/mod_socache_shmcb.c: 31 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@
#include "http_request.h"
#include "http_protocol.h"
#include "http_config.h"
#include "mod_status.h"

#include "apr.h"
#include "apr_strings.h"
@@ -606,7 +607,8 @@ static void socache_shmcb_status(ap_socache_instance_t *ctx,
                                 header->subcache_num);
    cache_pct = (100 * cache_total) / (header->subcache_data_size *
                                       header->subcache_num);
    /* Generate HTML */
    /* Generate Output */
    if (!(flags & AP_STATUS_SHORT)) {
        ap_rprintf(r, "cache type: <b>SHMCB</b>, shared memory: <b>%" APR_SIZE_T_FMT "</b> "
                   "bytes, current entries: <b>%d</b><br>",
                   ctx->shm_size, total);
@@ -640,6 +642,34 @@ static void socache_shmcb_status(ap_socache_instance_t *ctx,
        ap_rprintf(r, "total removes since starting: <b>%lu</b> hit, "
                   "<b>%lu</b> miss<br>", header->stat_removes_hit,
                   header->stat_removes_miss);
    }
    else {
        ap_rputs("CacheType: SHMCB\n", r);
        ap_rprintf(r, "CacheSharedMemory: %" APR_SIZE_T_FMT "\n",
                   ctx->shm_size);
        ap_rprintf(r, "CacheCurrentEntries: %d\n", total);
        ap_rprintf(r, "CacheSubcaches: %d\n", header->subcache_num);
        ap_rprintf(r, "CacheIndexesPerSubcaches: %d\n", header->index_num);
        if (non_empty_subcaches) {
            apr_time_t average_expiry = (apr_time_t)(expiry_total / (double)non_empty_subcaches);
            if (now < average_expiry) {
                ap_rprintf(r, "CacheTimeLeftOldestAvg: %d\n", (int)apr_time_sec(average_expiry - now));
                ap_rprintf(r, "CacheTimeLeftOldestMin: %d\n", (int)apr_time_sec(min_expiry - now));
                ap_rprintf(r, "CacheTimeLeftOldestMax: %d\n", (int)apr_time_sec(max_expiry - now));
            }
        }

        ap_rprintf(r, "CacheIndexUsage: %d%%\n", index_pct);
        ap_rprintf(r, "CacheUsage: %d%%\n", cache_pct);
        ap_rprintf(r, "CacheStoreCount: %lu\n", header->stat_stores);
        ap_rprintf(r, "CacheReplaceCount: %lu\n", header->stat_replaced);
        ap_rprintf(r, "CacheExpireCount: %lu\n", header->stat_expiries);
        ap_rprintf(r, "CacheDiscardCount: %lu\n", header->stat_scrolled);
        ap_rprintf(r, "CacheRetrieveHitCount: %lu\n", header->stat_retrieves_hit);
        ap_rprintf(r, "CacheRetrieveMissCount: %lu\n", header->stat_retrieves_miss);
        ap_rprintf(r, "CacheRemoveHitCount: %lu\n", header->stat_removes_hit);
        ap_rprintf(r, "CacheRemoveMissCount: %lu\n", header->stat_removes_miss);
    }
    ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, APLOGNO(00841) "leaving shmcb_status");
}

Loading