This is an automated email from the ASF dual-hosted git repository. zwoop pushed a commit to branch 8.1.x in repository https://gitbox.apache.org/repos/asf/trafficserver.git
commit 8af30a85f5d8012559b5dab0334f1ef0a4908bf8 Author: Susan Hinrichs <[email protected]> AuthorDate: Mon Sep 23 17:28:27 2019 +0000 Log H2 priority information (cherry picked from commit 89cf5afacc6eab8f24eed5ece5eeb2ca36ac5359) Conflicts: proxy/ProxyTransaction.cc proxy/ProxyTransaction.h proxy/http/HttpSM.h proxy/http2/Http2Stream.cc proxy/http2/Http2Stream.h --- doc/admin-guide/logging/formatting.en.rst | 6 ++++++ proxy/ProxyClientTransaction.cc | 12 ++++++++++++ proxy/ProxyClientTransaction.h | 2 ++ proxy/http/HttpSM.cc | 4 +++- proxy/http/HttpSM.h | 13 +++++++++++++ proxy/http2/Http2Stream.cc | 16 ++++++++++++++++ proxy/http2/Http2Stream.h | 2 ++ proxy/logging/Log.cc | 10 ++++++++++ proxy/logging/LogAccess.cc | 32 +++++++++++++++++++++++++++++++ proxy/logging/LogAccess.h | 20 ++++++++++--------- 10 files changed, 107 insertions(+), 10 deletions(-) diff --git a/doc/admin-guide/logging/formatting.en.rst b/doc/admin-guide/logging/formatting.en.rst index 3f15da6..6f253df 100644 --- a/doc/admin-guide/logging/formatting.en.rst +++ b/doc/admin-guide/logging/formatting.en.rst @@ -185,6 +185,8 @@ Connections and Transactions .. _sstc: .. _ccid: .. _ctid: +.. _ctpw: +.. _ctpd: The following log fields are used to list various details of connections and transactions between |TS| proxies and origin servers. @@ -204,6 +206,10 @@ ctid Client Request Client Transaction ID, a non-negative number for a transact which is different for all currently-active transactions on the same client connection. For client HTTP/2 transactions, this value is the stream ID for the transaction. +ctpw Client Request Client Transaction Priority Weight, the priority weight for the + underlying HTTP/2 protocol. +ctpd Client Request Client Transaction Priority Dependence, the transaction ID that + the current transaction depends on for HTTP/2 priority logic. ===== ============== ================================================================== .. _admin-logging-fields-content-type: diff --git a/proxy/ProxyClientTransaction.cc b/proxy/ProxyClientTransaction.cc index 17c1c93..dcbdf5f 100644 --- a/proxy/ProxyClientTransaction.cc +++ b/proxy/ProxyClientTransaction.cc @@ -115,3 +115,15 @@ ProxyClientTransaction::set_tx_error_code(ProxyError e) this->current_reader->t_state.client_info.tx_error_code = e; } } + +int +ProxyClientTransaction::get_transaction_priority_weight() const +{ + return 0; +} + +int +ProxyClientTransaction::get_transaction_priority_dependence() const +{ + return 0; +} diff --git a/proxy/ProxyClientTransaction.h b/proxy/ProxyClientTransaction.h index 12fcf30..560c5c6 100644 --- a/proxy/ProxyClientTransaction.h +++ b/proxy/ProxyClientTransaction.h @@ -235,6 +235,8 @@ public: return current_reader; } + virtual int get_transaction_priority_weight() const; + virtual int get_transaction_priority_dependence() const; virtual bool allow_half_open() const = 0; virtual const char * diff --git a/proxy/http/HttpSM.cc b/proxy/http/HttpSM.cc index e23ab53..b137470 100644 --- a/proxy/http/HttpSM.cc +++ b/proxy/http/HttpSM.cc @@ -432,7 +432,9 @@ HttpSM::attach_client_session(ProxyClientTransaction *client_vc, IOBufferReader // It seems to be possible that the ua_txn pointer will go stale before log entries for this HTTP transaction are // generated. Therefore, collect information that may be needed for logging from the ua_txn object at this point. // - _client_transaction_id = ua_txn->get_transaction_id(); + _client_transaction_id = ua_txn->get_transaction_id(); + _client_transaction_priority_weight = ua_txn->get_transaction_priority_weight(); + _client_transaction_priority_dependence = ua_txn->get_transaction_priority_dependence(); { auto p = ua_txn->get_parent(); diff --git a/proxy/http/HttpSM.h b/proxy/http/HttpSM.h index b49e203..ebfdeba 100644 --- a/proxy/http/HttpSM.h +++ b/proxy/http/HttpSM.h @@ -617,9 +617,22 @@ public: return _client_transaction_id; } + int + client_transaction_priority_weight() const + { + return _client_transaction_priority_weight; + } + + int + client_transaction_priority_dependence() const + { + return _client_transaction_priority_dependence; + } + private: PostDataBuffers _postbuf; int _client_connection_id = -1, _client_transaction_id = -1; + int _client_transaction_priority_weight = -1, _client_transaction_priority_dependence = -1; }; // Function to get the cache_sm object - YTS Team, yamsat diff --git a/proxy/http2/Http2Stream.cc b/proxy/http2/Http2Stream.cc index 2294dd5..6b33d3d 100644 --- a/proxy/http2/Http2Stream.cc +++ b/proxy/http2/Http2Stream.cc @@ -949,3 +949,19 @@ Http2Stream::_switch_thread_if_not_on_right_thread(int event, void *edata) } return true; } + +int +Http2Stream::get_transaction_priority_weight() const +{ + return priority_node ? priority_node->weight : 0; +} + +int +Http2Stream::get_transaction_priority_dependence() const +{ + if (!priority_node) { + return -1; + } else { + return priority_node->parent ? priority_node->parent->id : 0; + } +} diff --git a/proxy/http2/Http2Stream.h b/proxy/http2/Http2Stream.h index 1e176e9..e93ae14 100644 --- a/proxy/http2/Http2Stream.h +++ b/proxy/http2/Http2Stream.h @@ -94,6 +94,8 @@ public: bool allow_half_open() const override; bool is_first_transaction() const override; int get_transaction_id() const override; + int get_transaction_priority_weight() const override; + int get_transaction_priority_dependence() const override; bool ignore_keep_alive() override; void clear_inactive_timer(); diff --git a/proxy/logging/Log.cc b/proxy/logging/Log.cc index 63b3419..b48afe5 100644 --- a/proxy/logging/Log.cc +++ b/proxy/logging/Log.cc @@ -869,6 +869,16 @@ Log::init_fields() global_field_list.add(field, false); ink_hash_table_insert(field_symbol_hash, "ctid", field); + field = new LogField("client_transaction_priority_weight", "ctpw", LogField::sINT, + &LogAccess::marshal_client_http_transaction_priority_weight, &LogAccess::unmarshal_int_to_str); + global_field_list.add(field, false); + ink_hash_table_insert(field_symbol_hash, "ctpw", field); + + field = new LogField("client_transaction_priority_dependence", "ctpd", LogField::sINT, + &LogAccess::marshal_client_http_transaction_priority_dependence, &LogAccess::unmarshal_int_to_str); + global_field_list.add(field, false); + ink_hash_table_insert(field_symbol_hash, "ctpd", field); + init_status |= FIELDS_INITIALIZED; } diff --git a/proxy/logging/LogAccess.cc b/proxy/logging/LogAccess.cc index 7f8388a..c51a634 100644 --- a/proxy/logging/LogAccess.cc +++ b/proxy/logging/LogAccess.cc @@ -2475,6 +2475,38 @@ LogAccess::marshal_client_http_transaction_id(char *buf) -------------------------------------------------------------------------*/ int +LogAccess::marshal_client_http_transaction_priority_weight(char *buf) +{ + if (buf) { + int64_t id = 0; + if (m_http_sm) { + id = m_http_sm->client_transaction_priority_weight(); + } + marshal_int(buf, id); + } + return INK_MIN_ALIGN; +} + +/*------------------------------------------------------------------------- + -------------------------------------------------------------------------*/ + +int +LogAccess::marshal_client_http_transaction_priority_dependence(char *buf) +{ + if (buf) { + int64_t id = 0; + if (m_http_sm) { + id = m_http_sm->client_transaction_priority_dependence(); + } + marshal_int(buf, id); + } + return INK_MIN_ALIGN; +} + +/*------------------------------------------------------------------------- + -------------------------------------------------------------------------*/ + +int LogAccess::marshal_http_header_field(LogField::Container container, char *field, char *buf) { char *str = nullptr; diff --git a/proxy/logging/LogAccess.h b/proxy/logging/LogAccess.h index a4a721a..860c089 100644 --- a/proxy/logging/LogAccess.h +++ b/proxy/logging/LogAccess.h @@ -232,15 +232,17 @@ public: // other fields // - inkcoreapi int marshal_transfer_time_ms(char *); // INT - inkcoreapi int marshal_transfer_time_s(char *); // INT - inkcoreapi int marshal_file_size(char *); // INT - inkcoreapi int marshal_plugin_identity_id(char *); // INT - inkcoreapi int marshal_plugin_identity_tag(char *); // STR - inkcoreapi int marshal_process_uuid(char *); // STR - inkcoreapi int marshal_client_http_connection_id(char *); // INT - inkcoreapi int marshal_client_http_transaction_id(char *); // INT - inkcoreapi int marshal_cache_lookup_url_canon(char *); // STR + inkcoreapi int marshal_transfer_time_ms(char *); // INT + inkcoreapi int marshal_transfer_time_s(char *); // INT + inkcoreapi int marshal_file_size(char *); // INT + inkcoreapi int marshal_plugin_identity_id(char *); // INT + inkcoreapi int marshal_plugin_identity_tag(char *); // STR + inkcoreapi int marshal_process_uuid(char *); // STR + inkcoreapi int marshal_client_http_connection_id(char *); // INT + inkcoreapi int marshal_client_http_transaction_id(char *); // INT + inkcoreapi int marshal_client_http_transaction_priority_weight(char *); // INT + inkcoreapi int marshal_client_http_transaction_priority_dependence(char *); // INT + inkcoreapi int marshal_cache_lookup_url_canon(char *); // STR // named fields from within a http header //
