Repository: trafficserver Updated Branches: refs/heads/master aaa01044a -> f8928a7c0
TS-3842: Add stats for HTTP/2 errors Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/f8928a7c Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/f8928a7c Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/f8928a7c Branch: refs/heads/master Commit: f8928a7c0c6e822cdfd380ec301102704d686e60 Parents: aaa0104 Author: Bryan Call <[email protected]> Authored: Fri Aug 14 20:24:59 2015 -0700 Committer: Bryan Call <[email protected]> Committed: Fri Aug 14 20:24:59 2015 -0700 ---------------------------------------------------------------------- proxy/http2/HTTP2.cc | 6 ++++++ proxy/http2/HTTP2.h | 2 ++ proxy/http2/Http2ConnectionState.cc | 3 +++ 3 files changed, 11 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/trafficserver/blob/f8928a7c/proxy/http2/HTTP2.cc ---------------------------------------------------------------------- diff --git a/proxy/http2/HTTP2.cc b/proxy/http2/HTTP2.cc index d77242c..a8450e2 100644 --- a/proxy/http2/HTTP2.cc +++ b/proxy/http2/HTTP2.cc @@ -38,6 +38,8 @@ static char const *const HTTP2_STAT_CURRENT_CLIENT_STREAM_NAME = "proxy.process. static char const *const HTTP2_STAT_TOTAL_CLIENT_STREAM_NAME = "proxy.process.http2.total_client_streams"; static char const *const HTTP2_STAT_TOTAL_TRANSACTIONS_TIME_NAME = "proxy.process.http2.total_transactions_time"; static char const *const HTTP2_STAT_TOTAL_CLIENT_CONNECTION_NAME = "proxy.process.http2.total_client_connections"; +static char const *const HTTP2_STAT_CONNECTION_ERRORS_NAME = "proxy.process.http2.connection_errors"; +static char const *const HTTP2_STAT_STREAM_ERRORS_NAME = "proxy.process.http2.stream_errors"; union byte_pointer { byte_pointer(void *p) : ptr(p) {} @@ -769,6 +771,10 @@ Http2::init() static_cast<int>(HTTP2_STAT_TOTAL_TRANSACTIONS_TIME), RecRawStatSyncSum); RecRegisterRawStat(http2_rsb, RECT_PROCESS, HTTP2_STAT_TOTAL_CLIENT_CONNECTION_NAME, RECD_INT, RECP_PERSISTENT, static_cast<int>(HTTP2_STAT_TOTAL_CLIENT_CONNECTION_COUNT), RecRawStatSyncSum); + RecRegisterRawStat(http2_rsb, RECT_PROCESS, HTTP2_STAT_CONNECTION_ERRORS_NAME, RECD_INT, RECP_PERSISTENT, + static_cast<int>(HTTP2_STAT_CONNECTION_ERRORS_COUNT), RecRawStatSyncSum); + RecRegisterRawStat(http2_rsb, RECT_PROCESS, HTTP2_STAT_STREAM_ERRORS_NAME, RECD_INT, RECP_PERSISTENT, + static_cast<int>(HTTP2_STAT_STREAM_ERRORS_COUNT), RecRawStatSyncSum); } #if TS_HAS_TESTS http://git-wip-us.apache.org/repos/asf/trafficserver/blob/f8928a7c/proxy/http2/HTTP2.h ---------------------------------------------------------------------- diff --git a/proxy/http2/HTTP2.h b/proxy/http2/HTTP2.h index 29f31fe..a27b6a3 100644 --- a/proxy/http2/HTTP2.h +++ b/proxy/http2/HTTP2.h @@ -68,6 +68,8 @@ enum { HTTP2_STAT_CURRENT_CLIENT_STREAM_COUNT, // Current # of active HTTP2 streams. 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, + HTTP2_STAT_CONNECTION_ERRORS_COUNT, HTTP2_N_STATS // Terminal counter, NOT A STAT INDEX. }; http://git-wip-us.apache.org/repos/asf/trafficserver/blob/f8928a7c/proxy/http2/Http2ConnectionState.cc ---------------------------------------------------------------------- diff --git a/proxy/http2/Http2ConnectionState.cc b/proxy/http2/Http2ConnectionState.cc index 2e00220..345a0a1 100644 --- a/proxy/http2/Http2ConnectionState.cc +++ b/proxy/http2/Http2ConnectionState.cc @@ -736,7 +736,9 @@ Http2ConnectionState::main_event_handler(int event, void *edata) } if (error.cls != HTTP2_ERROR_CLASS_NONE) { + EThread *ethread = this_ethread(); if (error.cls == HTTP2_ERROR_CLASS_CONNECTION) { + HTTP2_INCREMENT_THREAD_DYN_STAT(HTTP2_STAT_CONNECTION_ERRORS_COUNT, ethread); this->send_goaway_frame(last_streamid, error.code); cleanup_streams(); // XXX We need to think a bit harder about how to coordinate the client @@ -748,6 +750,7 @@ Http2ConnectionState::main_event_handler(int event, void *edata) // half-closed state ... SET_HANDLER(&Http2ConnectionState::state_closed); } else if (error.cls == HTTP2_ERROR_CLASS_STREAM) { + HTTP2_INCREMENT_THREAD_DYN_STAT(HTTP2_STAT_STREAM_ERRORS_COUNT, ethread); this->send_rst_stream_frame(last_streamid, error.code); } }
