Skip to content

Commit 89cf5af

Browse files
shinrichbryancall
authored andcommitted
Log H2 priority information
1 parent 78c7c0c commit 89cf5af

File tree

10 files changed

+110
-13
lines changed

10 files changed

+110
-13
lines changed

doc/admin-guide/logging/formatting.en.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,8 @@ Connections and Transactions
184184
.. _sstc:
185185
.. _ccid:
186186
.. _ctid:
187+
.. _ctpw:
188+
.. _ctpd:
187189

188190
The following log fields are used to list various details of connections and
189191
transactions between |TS| proxies and origin servers.
@@ -203,6 +205,10 @@ ctid Client Request Client Transaction ID, a non-negative number for a transact
203205
which is different for all currently-active transactions on the
204206
same client connection. For client HTTP/2 transactions, this
205207
value is the stream ID for the transaction.
208+
ctpw Client Request Client Transaction Priority Weight, the priority weight for the
209+
underlying HTTP/2 protocol.
210+
ctpd Client Request Client Transaction Priority Dependence, the transaction ID that
211+
the current transaction depends on for HTTP/2 priority logic.
206212
===== ============== ==================================================================
207213

208214
.. _admin-logging-fields-content-type:

proxy/ProxyTransaction.cc

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,3 +199,15 @@ void
199199
ProxyTransaction::set_h2c_upgrade_flag()
200200
{
201201
}
202+
203+
int
204+
ProxyTransaction::get_transaction_priority_weight() const
205+
{
206+
return 0;
207+
}
208+
209+
int
210+
ProxyTransaction::get_transaction_priority_dependence() const
211+
{
212+
return 0;
213+
}

proxy/ProxyTransaction.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,11 @@ class ProxyTransaction : public VConnection
5050
virtual void set_inactivity_timeout(ink_hrtime timeout_in) = 0;
5151
virtual void cancel_inactivity_timeout() = 0;
5252
virtual int get_transaction_id() const = 0;
53-
virtual bool allow_half_open() const = 0;
54-
virtual void increment_client_transactions_stat() = 0;
55-
virtual void decrement_client_transactions_stat() = 0;
53+
virtual int get_transaction_priority_weight() const;
54+
virtual int get_transaction_priority_dependence() const;
55+
virtual bool allow_half_open() const = 0;
56+
virtual void increment_client_transactions_stat() = 0;
57+
virtual void decrement_client_transactions_stat() = 0;
5658

5759
virtual NetVConnection *get_netvc() const;
5860
virtual bool is_first_transaction() const;

proxy/http/HttpSM.cc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -488,7 +488,9 @@ HttpSM::attach_client_session(ProxyTransaction *client_vc, IOBufferReader *buffe
488488
// It seems to be possible that the ua_txn pointer will go stale before log entries for this HTTP transaction are
489489
// generated. Therefore, collect information that may be needed for logging from the ua_txn object at this point.
490490
//
491-
_client_transaction_id = ua_txn->get_transaction_id();
491+
_client_transaction_id = ua_txn->get_transaction_id();
492+
_client_transaction_priority_weight = ua_txn->get_transaction_priority_weight();
493+
_client_transaction_priority_dependence = ua_txn->get_transaction_priority_dependence();
492494
{
493495
auto p = ua_txn->get_proxy_ssn();
494496

proxy/http/HttpSM.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -613,6 +613,18 @@ class HttpSM : public Continuation
613613
return _client_transaction_id;
614614
}
615615

616+
int
617+
client_transaction_priority_weight() const
618+
{
619+
return _client_transaction_priority_weight;
620+
}
621+
622+
int
623+
client_transaction_priority_dependence() const
624+
{
625+
return _client_transaction_priority_dependence;
626+
}
627+
616628
void set_server_netvc_inactivity_timeout(NetVConnection *netvc);
617629
void set_server_netvc_active_timeout(NetVConnection *netvc);
618630
void set_server_netvc_connect_timeout(NetVConnection *netvc);
@@ -621,6 +633,7 @@ class HttpSM : public Continuation
621633
private:
622634
PostDataBuffers _postbuf;
623635
int _client_connection_id = -1, _client_transaction_id = -1;
636+
int _client_transaction_priority_weight = -1, _client_transaction_priority_dependence = -1;
624637
};
625638

626639
// Function to get the cache_sm object - YTS Team, yamsat

proxy/http2/Http2Stream.cc

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1063,3 +1063,19 @@ Http2Stream::mark_body_done()
10631063
this->write_vio.nbytes = response_header.length_get() + chunked_handler.dechunked_size;
10641064
}
10651065
}
1066+
1067+
int
1068+
Http2Stream::get_transaction_priority_weight() const
1069+
{
1070+
return priority_node ? priority_node->weight : 0;
1071+
}
1072+
1073+
int
1074+
Http2Stream::get_transaction_priority_dependence() const
1075+
{
1076+
if (!priority_node) {
1077+
return -1;
1078+
} else {
1079+
return priority_node->parent ? priority_node->parent->id : 0;
1080+
}
1081+
}

proxy/http2/Http2Stream.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,8 @@ class Http2Stream : public ProxyTransaction
9797
void increment_client_transactions_stat() override;
9898
void decrement_client_transactions_stat() override;
9999
int get_transaction_id() const override;
100+
int get_transaction_priority_weight() const override;
101+
int get_transaction_priority_dependence() const override;
100102

101103
void clear_inactive_timer();
102104
void clear_active_timer();

proxy/logging/Log.cc

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -887,6 +887,16 @@ Log::init_fields()
887887
global_field_list.add(field, false);
888888
field_symbol_hash.emplace("ctid", field);
889889

890+
field = new LogField("client_transaction_priority_weight", "ctpw", LogField::sINT,
891+
&LogAccess::marshal_client_http_transaction_priority_weight, &LogAccess::unmarshal_int_to_str);
892+
global_field_list.add(field, false);
893+
field_symbol_hash.emplace("ctpw", field);
894+
895+
field = new LogField("client_transaction_priority_dependence", "ctpd", LogField::sINT,
896+
&LogAccess::marshal_client_http_transaction_priority_dependence, &LogAccess::unmarshal_int_to_str);
897+
global_field_list.add(field, false);
898+
field_symbol_hash.emplace("ctpd", field);
899+
890900
init_status |= FIELDS_INITIALIZED;
891901
}
892902

proxy/logging/LogAccess.cc

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2552,6 +2552,38 @@ LogAccess::marshal_client_http_transaction_id(char *buf)
25522552
return INK_MIN_ALIGN;
25532553
}
25542554

2555+
/*-------------------------------------------------------------------------
2556+
-------------------------------------------------------------------------*/
2557+
2558+
int
2559+
LogAccess::marshal_client_http_transaction_priority_weight(char *buf)
2560+
{
2561+
if (buf) {
2562+
int64_t id = 0;
2563+
if (m_http_sm) {
2564+
id = m_http_sm->client_transaction_priority_weight();
2565+
}
2566+
marshal_int(buf, id);
2567+
}
2568+
return INK_MIN_ALIGN;
2569+
}
2570+
2571+
/*-------------------------------------------------------------------------
2572+
-------------------------------------------------------------------------*/
2573+
2574+
int
2575+
LogAccess::marshal_client_http_transaction_priority_dependence(char *buf)
2576+
{
2577+
if (buf) {
2578+
int64_t id = 0;
2579+
if (m_http_sm) {
2580+
id = m_http_sm->client_transaction_priority_dependence();
2581+
}
2582+
marshal_int(buf, id);
2583+
}
2584+
return INK_MIN_ALIGN;
2585+
}
2586+
25552587
/*-------------------------------------------------------------------------
25562588
-------------------------------------------------------------------------*/
25572589

proxy/logging/LogAccess.h

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -239,15 +239,17 @@ class LogAccess
239239

240240
// other fields
241241
//
242-
inkcoreapi int marshal_transfer_time_ms(char *); // INT
243-
inkcoreapi int marshal_transfer_time_s(char *); // INT
244-
inkcoreapi int marshal_file_size(char *); // INT
245-
inkcoreapi int marshal_plugin_identity_id(char *); // INT
246-
inkcoreapi int marshal_plugin_identity_tag(char *); // STR
247-
inkcoreapi int marshal_process_uuid(char *); // STR
248-
inkcoreapi int marshal_client_http_connection_id(char *); // INT
249-
inkcoreapi int marshal_client_http_transaction_id(char *); // INT
250-
inkcoreapi int marshal_cache_lookup_url_canon(char *); // STR
242+
inkcoreapi int marshal_transfer_time_ms(char *); // INT
243+
inkcoreapi int marshal_transfer_time_s(char *); // INT
244+
inkcoreapi int marshal_file_size(char *); // INT
245+
inkcoreapi int marshal_plugin_identity_id(char *); // INT
246+
inkcoreapi int marshal_plugin_identity_tag(char *); // STR
247+
inkcoreapi int marshal_process_uuid(char *); // STR
248+
inkcoreapi int marshal_client_http_connection_id(char *); // INT
249+
inkcoreapi int marshal_client_http_transaction_id(char *); // INT
250+
inkcoreapi int marshal_client_http_transaction_priority_weight(char *); // INT
251+
inkcoreapi int marshal_client_http_transaction_priority_dependence(char *); // INT
252+
inkcoreapi int marshal_cache_lookup_url_canon(char *); // STR
251253

252254
// named fields from within a http header
253255
//

0 commit comments

Comments
 (0)