bneradt commented on code in PR #12763:
URL: https://github.com/apache/trafficserver/pull/12763#discussion_r2836485801


##########
doc/admin-guide/logging/formatting.en.rst:
##########
@@ -451,6 +453,10 @@ cqcl  Client Request         Client request content 
length, in bytes.
 cqhl  Client Request         Client request header length, in bytes.
 cqql  Client Request         Client request header and content length combined,
                              in bytes.
+cqqtl Client Request         Same as cqql_, but for the first transaction on a
+                             TLS connection, also includes TLS handshake bytes
+                             received from the client. Note that this metrics

Review Comment:
   `this metrics` -> `this metric`



##########
src/iocore/net/TLSBasicSupport.cc:
##########
@@ -72,6 +72,36 @@ TLSBasicSupport::clear()
 {
   this->_tls_handshake_begin_time = 0;
   this->_tls_handshake_end_time   = 0;
+  this->_tls_handshake_bytes_in   = 0;
+  this->_tls_handshake_bytes_out  = 0;
+}
+
+bool
+TLSBasicSupport::get_tls_handshake_bytes(uint64_t &bytes_in, uint64_t 
&bytes_out)
+{
+  if (_tls_handshake_bytes_in > 0 || _tls_handshake_bytes_out > 0) {
+    bytes_in  = _tls_handshake_bytes_in;
+    bytes_out = _tls_handshake_bytes_out;
+    return false;
+  }
+
+  SSL *ssl = this->_get_ssl_object();
+  if (ssl == nullptr) {
+    bytes_in  = 0;
+    bytes_out = 0;
+    return false;
+  }
+
+  BIO *rbio = SSL_get_rbio(ssl);
+  BIO *wbio = SSL_get_wbio(ssl);
+
+  uint64_t bio_in  = rbio ? BIO_number_read(rbio) : 0;
+  uint64_t bio_out = wbio ? BIO_number_written(wbio) : 0;
+
+  bytes_in = _tls_handshake_bytes_in = bio_in;
+  bytes_out = _tls_handshake_bytes_out = bio_out;
+
+  return true;

Review Comment:
   Shouldn't that first return return true? It set values.



##########
src/iocore/net/SSLStats.cc:
##########
@@ -280,6 +280,8 @@ SSLInitializeStatistics()
   ssl_rsb.user_agent_version_too_high       = 
Metrics::Counter::createPtr("proxy.process.ssl.user_agent_version_too_high");
   ssl_rsb.user_agent_version_too_low        = 
Metrics::Counter::createPtr("proxy.process.ssl.user_agent_version_too_low");
   ssl_rsb.user_agent_wrong_version          = 
Metrics::Counter::createPtr("proxy.process.ssl.user_agent_wrong_version");
+  ssl_rsb.tls_handshake_bytes_in_total      = 
Metrics::Counter::createPtr("proxy.process.ssl.total_handshake_bytes_read_in");
+  ssl_rsb.tls_handshake_bytes_out_total     = 
Metrics::Counter::createPtr("proxy.process.ssl.total_handshake_bytes_write_in");

Review Comment:
   Seems to be a mismatch in variable name and the metric used. Should the 
variable be `in_total` or the metric pulled from `write_out`? 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to