You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by zw...@apache.org on 2016/07/10 00:40:33 UTC

[trafficserver] branch master updated: TS-4610 Fixes HTTP and HTTP2 stats

This is an automated email from the ASF dual-hosted git repository.

zwoop pushed a commit to branch master
in repository https://git-dual.apache.org/repos/asf/trafficserver.git

The following commit(s) were added to refs/heads/master by this push:
       new  8c44ecf   TS-4610 Fixes HTTP and HTTP2 stats
8c44ecf is described below

commit 8c44ecf436137b7d8389fd75544fd410caa1455b
Author: Susan Hinrichs <sh...@ieee.org>
AuthorDate: Sat Jul 9 18:36:26 2016 -0600

    TS-4610 Fixes HTTP and HTTP2 stats
    
    This closes #763
---
 proxy/http/Http1ClientSession.cc     | 1 -
 proxy/http/Http1ClientTransaction.cc | 3 ---
 proxy/http/HttpSM.cc                 | 6 +++---
 proxy/http2/HTTP2.cc                 | 2 +-
 proxy/http2/HTTP2.h                  | 7 ++++---
 proxy/http2/Http2ClientSession.cc    | 8 ++------
 proxy/http2/Http2Stream.h            | 1 +
 7 files changed, 11 insertions(+), 17 deletions(-)

diff --git a/proxy/http/Http1ClientSession.cc b/proxy/http/Http1ClientSession.cc
index 8fa326c..94007e7 100644
--- a/proxy/http/Http1ClientSession.cc
+++ b/proxy/http/Http1ClientSession.cc
@@ -233,7 +233,6 @@ void
 Http1ClientSession::do_io_close(int alerrno)
 {
   if (read_state == HCS_ACTIVE_READER) {
-    HTTP_DECREMENT_DYN_STAT(http_current_client_transactions_stat);
     if (trans.m_active) {
       trans.m_active = false;
       HTTP_DECREMENT_DYN_STAT(http_current_active_client_connections_stat);
diff --git a/proxy/http/Http1ClientTransaction.cc b/proxy/http/Http1ClientTransaction.cc
index a5673c3..a5ae268 100644
--- a/proxy/http/Http1ClientTransaction.cc
+++ b/proxy/http/Http1ClientTransaction.cc
@@ -37,9 +37,6 @@ Http1ClientTransaction::release(IOBufferReader *r)
     m_active = false;
     HTTP_DECREMENT_DYN_STAT(http_current_active_client_connections_stat);
   }
-
-  HTTP_DECREMENT_DYN_STAT(http_current_client_transactions_stat);
-
   parent->ssn_last_txn_time = Thread::get_hrtime();
 
   // Make sure that the state machine is returning
diff --git a/proxy/http/HttpSM.cc b/proxy/http/HttpSM.cc
index 9016c4b..f3b2340 100644
--- a/proxy/http/HttpSM.cc
+++ b/proxy/http/HttpSM.cc
@@ -204,7 +204,7 @@ HttpVCTable::cleanup_entry(HttpVCTableEntry *e)
     // Update stats
     switch (e->vc_type) {
     case HTTP_UA_VC:
-      //              HTTP_DECREMENT_DYN_STAT(http_current_client_transactions_stat);
+      // proxy.process.http.current_client_transactions is decremented in HttpSM::destroy
       break;
     default:
       // This covers:
@@ -358,6 +358,7 @@ HttpSM::cleanup()
 void
 HttpSM::destroy()
 {
+  HTTP_DECREMENT_DYN_STAT(http_current_client_transactions_stat);
   cleanup();
   httpSMAllocator.free(this);
 }
@@ -539,6 +540,7 @@ HttpSM::attach_client_session(ProxyClientTransaction *client_vc, IOBufferReader
 
   ink_release_assert(ua_session->get_half_close_flag() == false);
   mutex = client_vc->mutex;
+  HTTP_INCREMENT_DYN_STAT(http_current_client_transactions_stat);
   if (ua_session->debug()) {
     debug_on = true;
   }
@@ -558,8 +560,6 @@ HttpSM::attach_client_session(ProxyClientTransaction *client_vc, IOBufferReader
   t_state.backdoor_request            = !client_vc->hooks_enabled();
   t_state.client_info.port_attribute  = static_cast<HttpProxyPort::TransportType>(netvc->attributes);
 
-  HTTP_INCREMENT_DYN_STAT(http_current_client_transactions_stat);
-
   // Record api hook set state
   hooks_set = client_vc->has_hooks();
 
diff --git a/proxy/http2/HTTP2.cc b/proxy/http2/HTTP2.cc
index d9218ff..00a09b0 100644
--- a/proxy/http2/HTTP2.cc
+++ b/proxy/http2/HTTP2.cc
@@ -711,7 +711,7 @@ Http2::init()
   RecRegisterRawStat(http2_rsb, RECT_PROCESS, HTTP2_STAT_CURRENT_CLIENT_STREAM_NAME, RECD_INT, RECP_NON_PERSISTENT,
                      static_cast<int>(HTTP2_STAT_CURRENT_CLIENT_STREAM_COUNT), RecRawStatSyncSum);
   RecRegisterRawStat(http2_rsb, RECT_PROCESS, HTTP2_STAT_TOTAL_CLIENT_STREAM_NAME, RECD_INT, RECP_PERSISTENT,
-                     static_cast<int>(HTTP2_STAT_TOTAL_TRANSACTIONS_TIME), RecRawStatSyncCount);
+                     static_cast<int>(HTTP2_STAT_TOTAL_CLIENT_STREAM_COUNT), RecRawStatSyncCount);
   RecRegisterRawStat(http2_rsb, RECT_PROCESS, HTTP2_STAT_TOTAL_TRANSACTIONS_TIME_NAME, RECD_INT, RECP_PERSISTENT,
                      static_cast<int>(HTTP2_STAT_TOTAL_TRANSACTIONS_TIME), RecRawStatSyncSum);
   RecRegisterRawStat(http2_rsb, RECT_PROCESS, HTTP2_STAT_TOTAL_CLIENT_CONNECTION_NAME, RECD_INT, RECP_PERSISTENT,
diff --git a/proxy/http2/HTTP2.h b/proxy/http2/HTTP2.h
index f77be18..eb1e7b2 100644
--- a/proxy/http2/HTTP2.h
+++ b/proxy/http2/HTTP2.h
@@ -68,9 +68,10 @@ const uint8_t HTTP2_PRIORITY_DEFAULT_WEIGHT             = 15;
 
 // Statistics
 enum {
-  HTTP2_STAT_CURRENT_CLIENT_SESSION_COUNT,  // Current # of active HTTP2
-                                            // sessions.
-  HTTP2_STAT_CURRENT_CLIENT_STREAM_COUNT,   // Current # of active HTTP2 streams.
+  HTTP2_STAT_CURRENT_CLIENT_SESSION_COUNT, // Current # of active HTTP2
+                                           // sessions.
+  HTTP2_STAT_CURRENT_CLIENT_STREAM_COUNT,  // Current # of active HTTP2 streams.
+  HTTP2_STAT_TOTAL_CLIENT_STREAM_COUNT,
   HTTP2_STAT_TOTAL_TRANSACTIONS_TIME,       // Total stream time and streams
   HTTP2_STAT_TOTAL_CLIENT_CONNECTION_COUNT, // Total connections running http2
   HTTP2_STAT_STREAM_ERRORS_COUNT,
diff --git a/proxy/http2/Http2ClientSession.cc b/proxy/http2/Http2ClientSession.cc
index 70ec06f..88d226f 100644
--- a/proxy/http2/Http2ClientSession.cc
+++ b/proxy/http2/Http2ClientSession.cc
@@ -75,6 +75,8 @@ Http2ClientSession::destroy()
 {
   DebugHttp2Ssn("session destroy");
 
+  HTTP2_DECREMENT_THREAD_DYN_STAT(HTTP2_STAT_CURRENT_CLIENT_SESSION_COUNT, this->mutex->thread_holding);
+
   // Update stats on how we died.  May want to eliminate this.  Was useful for
   // tracking down which cases we were having problems cleaning up.  But for general
   // use probably not worth the effort
@@ -150,10 +152,6 @@ Http2ClientSession::new_connection(NetVConnection *new_vc, MIOBuffer *iobuf, IOB
   client_vc->set_inactivity_timeout(HRTIME_SECONDS(Http2::accept_no_activity_timeout));
   this->mutex = new_vc->mutex;
 
-  // These macros must have the mutex set.
-  HTTP_INCREMENT_DYN_STAT(http_current_client_connections_stat);
-  HTTP_INCREMENT_DYN_STAT(http_total_client_connections_stat);
-
   this->connection_state.mutex = new_ProxyMutex();
 
   DebugHttp2Ssn("session born, netvc %p", this->client_vc);
@@ -235,8 +233,6 @@ Http2ClientSession::do_io_close(int alerrno)
   DebugHttp2Ssn("session closed");
 
   ink_assert(this->mutex->thread_holding == this_ethread());
-  HTTP2_DECREMENT_THREAD_DYN_STAT(HTTP2_STAT_CURRENT_CLIENT_SESSION_COUNT, this->mutex->thread_holding);
-  HTTP_DECREMENT_DYN_STAT(http_current_client_connections_stat);
   send_connection_event(&this->connection_state, HTTP2_SESSION_EVENT_FINI, this);
   do_api_callout(TS_HTTP_SSN_CLOSE_HOOK);
 }
diff --git a/proxy/http2/Http2Stream.h b/proxy/http2/Http2Stream.h
index 90828a2..d9461a9 100644
--- a/proxy/http2/Http2Stream.h
+++ b/proxy/http2/Http2Stream.h
@@ -84,6 +84,7 @@ public:
     _thread           = this_ethread();
     this->client_rwnd = initial_rwnd;
     HTTP2_INCREMENT_THREAD_DYN_STAT(HTTP2_STAT_CURRENT_CLIENT_STREAM_COUNT, _thread);
+    HTTP2_INCREMENT_THREAD_DYN_STAT(HTTP2_STAT_TOTAL_CLIENT_STREAM_COUNT, _thread);
     sm_reader = request_reader = request_buffer.alloc_reader();
     http_parser_init(&http_parser);
     // FIXME: Are you sure? every "stream" needs request_header?

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