trafficserver-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a..@apache.org
Subject [trafficserver] branch master updated: PR-1465: Add TCP accept metric which tracks the total number of TCP connections accepted.
Date Sun, 23 Apr 2017 19:53:54 GMT
This is an automated email from the ASF dual-hosted git repository.

amc pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficserver.git

The following commit(s) were added to refs/heads/master by this push:
       new  0444182   PR-1465: Add TCP accept metric which tracks the total number of TCP
connections accepted.
0444182 is described below

commit 04441826b32923cfc5c17f34e425f83a837522db
Author: Alan M. Carroll <solidwallofcode@yahoo-inc.com>
AuthorDate: Thu Feb 16 15:43:59 2017 +0000

    PR-1465: Add TCP accept metric which tracks the total number of TCP connections accepted.
---
 doc/admin-guide/monitoring/statistics/core/network-io.en.rst | 6 ++++++
 iocore/net/Net.cc                                            | 4 ++++
 iocore/net/P_Net.h                                           | 1 +
 iocore/net/UnixNetAccept.cc                                  | 3 +++
 4 files changed, 14 insertions(+)

diff --git a/doc/admin-guide/monitoring/statistics/core/network-io.en.rst b/doc/admin-guide/monitoring/statistics/core/network-io.en.rst
index 7fe900b..0fd32c1 100644
--- a/doc/admin-guide/monitoring/statistics/core/network-io.en.rst
+++ b/doc/admin-guide/monitoring/statistics/core/network-io.en.rst
@@ -75,3 +75,9 @@ Network I/O
    :type: counter
    :unit: bytes
 
+.. ts:stat:: global proxy.process.tcp.total_accepts integer
+   :type: counter
+
+   The total number of times a TCP connection was accepted on a proxy port. This may differ
from the
+   total of other network connection counters. For example if a user agent connects via TLS
but
+   sends a malformed ``CLIENT_HELLO`` this will count as a TCP connect but not an SSL connect.
diff --git a/iocore/net/Net.cc b/iocore/net/Net.cc
index 6e6c35e..94ed2aa 100644
--- a/iocore/net/Net.cc
+++ b/iocore/net/Net.cc
@@ -108,6 +108,10 @@ register_net_stats()
   NET_CLEAR_DYN_STAT(keep_alive_queue_timeout_total_stat);
   NET_CLEAR_DYN_STAT(keep_alive_queue_timeout_count_stat);
   NET_CLEAR_DYN_STAT(default_inactivity_timeout_stat);
+
+  RecRegisterRawStat(net_rsb, RECT_PROCESS, "proxy.process.tcp.total_accepts", RECD_INT,
RECP_NON_PERSISTENT,
+                     static_cast<int>(net_tcp_accept_stat), RecRawStatSyncSum);
+  NET_CLEAR_DYN_STAT(net_tcp_accept_stat);
 }
 
 void
diff --git a/iocore/net/P_Net.h b/iocore/net/P_Net.h
index c2c2fd9..9fecf19 100644
--- a/iocore/net/P_Net.h
+++ b/iocore/net/P_Net.h
@@ -55,6 +55,7 @@ enum Net_Stats {
   default_inactivity_timeout_stat,
   net_fastopen_attempts_stat,
   net_fastopen_successes_stat,
+  net_tcp_accept_stat,
   Net_Stat_Count
 };
 
diff --git a/iocore/net/UnixNetAccept.cc b/iocore/net/UnixNetAccept.cc
index cd0161f..2afd8dd 100644
--- a/iocore/net/UnixNetAccept.cc
+++ b/iocore/net/UnixNetAccept.cc
@@ -75,6 +75,7 @@ net_accept(NetAccept *na, void *ep, bool blockable)
       count = res;
       goto Ldone;
     }
+    NET_SUM_GLOBAL_DYN_STAT(net_tcp_accept_stat, 1);
 
     vc = static_cast<UnixNetVConnection *>(na->getNetProcessor()->allocate_vc(e->ethread));
     if (!vc)
@@ -269,6 +270,7 @@ NetAccept::do_blocking_accept(EThread *t)
     }
 
     NET_SUM_GLOBAL_DYN_STAT(net_connections_currently_open_stat, 1);
+    NET_SUM_GLOBAL_DYN_STAT(net_tcp_accept_stat, 1);
     vc->id = net_next_connection_number();
     vc->con.move(con);
     vc->submit_time = now;
@@ -356,6 +358,7 @@ NetAccept::acceptFastEvent(int event, void *ep)
 
     if (likely(fd >= 0)) {
       Debug("iocore_net", "accepted a new socket: %d", fd);
+      NET_SUM_GLOBAL_DYN_STAT(net_tcp_accept_stat, 1);
       if (opt.send_bufsize > 0) {
         if (unlikely(socketManager.set_sndbuf_size(fd, opt.send_bufsize))) {
           bufsz = ROUNDUP(opt.send_bufsize, 1024);

-- 
To stop receiving notification emails like this one, please contact
['"commits@trafficserver.apache.org" <commits@trafficserver.apache.org>'].

Mime
View raw message