You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by an...@apache.org on 2010/06/11 21:19:18 UTC
svn commit: r953844 - in /trafficserver/traffic/trunk/proxy/http2:
HttpAccept.cc HttpConfig.cc HttpConfig.h
Author: andrewhsu
Date: Fri Jun 11 19:19:17 2010
New Revision: 953844
URL: http://svn.apache.org/viewvc?rev=953844&view=rev
Log:
TS-18 added stats to track ipv4 and ipv6 requests
Tested: Fedora-13-x86_64
Using StatSystemV2, registered 'http.request.ipv4' and
'http.request.ipv6'.
Modified:
trafficserver/traffic/trunk/proxy/http2/HttpAccept.cc
trafficserver/traffic/trunk/proxy/http2/HttpConfig.cc
trafficserver/traffic/trunk/proxy/http2/HttpConfig.h
Modified: trafficserver/traffic/trunk/proxy/http2/HttpAccept.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/http2/HttpAccept.cc?rev=953844&r1=953843&r2=953844&view=diff
==============================================================================
--- trafficserver/traffic/trunk/proxy/http2/HttpAccept.cc (original)
+++ trafficserver/traffic/trunk/proxy/http2/HttpAccept.cc Fri Jun 11 19:19:17 2010
@@ -26,6 +26,7 @@
#include "HttpAssert.h"
#include "HttpClientSession.h"
#include "I_Machine.h"
+#include "StatSystemV2.h"
int
@@ -73,6 +74,24 @@ HttpAccept::mainEvent(int event, void *d
netvc->attributes = attr;
Debug("http_seq", "HttpAccept:mainEvent] accepted connection");
+
+ // check what type of socket address we just accepted
+ // by looking at the address family value of sockaddr_storage
+ // and logging to stat system
+ switch(netvc->get_remote_addr().ss_family) {
+ case AF_INET:
+ StatSystemV2::increment(http_stat_ipv4_accept);
+ break;
+ case AF_INET6:
+ StatSystemV2::increment(http_stat_ipv6_accept);
+ break;
+ default:
+ // don't do anything if the address family is not ipv4 or ipv6
+ // (there are many other address families in <sys/socket.h>
+ // but we don't have a need to report on all the others today)
+ break;
+ }
+
HttpClientSession *new_session = THREAD_ALLOC_INIT(httpClientSessionAllocator, netvc->thread);
new_session->new_connection(netvc, backdoor);
Modified: trafficserver/traffic/trunk/proxy/http2/HttpConfig.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/http2/HttpConfig.cc?rev=953844&r1=953843&r2=953844&view=diff
==============================================================================
--- trafficserver/traffic/trunk/proxy/http2/HttpConfig.cc (original)
+++ trafficserver/traffic/trunk/proxy/http2/HttpConfig.cc Fri Jun 11 19:19:17 2010
@@ -32,6 +32,7 @@
#include "P_Net.h"
#include "P_RecUtils.h"
#include <iostream>
+#include "StatSystemV2.h"
using namespace std;
@@ -86,6 +87,10 @@ public:
// static variables
//
////////////////////////////////////////////////////////////////
+
+uint32_t http_stat_ipv4_accept;
+uint32_t http_stat_ipv6_accept;
+
int
HttpConfig::m_id = 0;
HttpConfigParams
@@ -944,6 +949,8 @@ register_stat_callbacks()
RECD_COUNTER, RECP_NULL,
(int) http_total_x_redirect_stat, RecRawStatSyncCount);
+ StatSystemV2::registerStat("http.request.ipv4", &http_stat_ipv4_accept);
+ StatSystemV2::registerStat("http.request.ipv6", &http_stat_ipv6_accept);
}
Modified: trafficserver/traffic/trunk/proxy/http2/HttpConfig.h
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/http2/HttpConfig.h?rev=953844&r1=953843&r2=953844&view=diff
==============================================================================
--- trafficserver/traffic/trunk/proxy/http2/HttpConfig.h (original)
+++ trafficserver/traffic/trunk/proxy/http2/HttpConfig.h Fri Jun 11 19:19:17 2010
@@ -303,6 +303,10 @@ enum
http_stat_count
};
+// keep track of incoming accepted connections by address family;
+extern uint32_t http_stat_ipv4_accept; /**< ipv4 incoming requests */
+extern uint32_t http_stat_ipv6_accept; /**< ipv6 incoming requests */
+
extern RecRawStatBlock *http_rsb;
/* Stats should only be accessed using these macros */