maskit commented on a change in pull request #6836:
URL: https://github.com/apache/trafficserver/pull/6836#discussion_r437091495
##########
File path: mgmt/RecordsConfig.cc
##########
@@ -1374,6 +1374,8 @@ static const RecordElement RecordsConfig[] =
,
{RECT_CONFIG, "proxy.config.quic.client.keylog_file", RECD_STRING, nullptr ,
RECU_RESTART_TS, RR_NULL, RECC_NULL, nullptr, RECA_NULL}
,
+ {RECT_CONFIG, "proxy.config.quic.qlog_file", RECD_STRING, nullptr ,
RECU_RESTART_TS, RR_NULL, RECC_NULL, nullptr, RECA_NULL}
Review comment:
Why is this not a directory name nor a filename prefix? It seems like
the filename is always the same and 2nd connection overwrites the existing
file. What if two concurrent connections tried to dump logs at the same time?
This is the reason I suggested to include timestamp or CID to filenames.
##########
File path: iocore/net/QUICNetVConnection.cc
##########
@@ -463,6 +462,14 @@ QUICNetVConnection::start()
this->_frame_dispatcher->add_handler(this->_stream_manager);
this->_frame_dispatcher->add_handler(this->_path_validator);
this->_frame_dispatcher->add_handler(this->_handshake_handler);
+
+ // regist qlog
+ if (this->_context->config()->qlog_file() != nullptr) {
+ this->_qlog = std::make_unique<QLog::QLogListener>(*this->_context.get(),
this->_original_quic_connection_id.hex());
+ this->_qlog->last_trace().set_vantage_point(
+ {"ats", QLog::Trace::VantagePointType::server,
QLog::Trace::VantagePointType::server});
+ this->_context->regist_callback(this->_qlog);
Review comment:
Seems like a nice idea 👍
I guess we can reuse this mechanism for variety of things (e.g. plugin
hooks, metrics, etc.) in the future.
##########
File path: iocore/net/QUICNetVConnection.cc
##########
@@ -463,6 +462,14 @@ QUICNetVConnection::start()
this->_frame_dispatcher->add_handler(this->_stream_manager);
this->_frame_dispatcher->add_handler(this->_path_validator);
this->_frame_dispatcher->add_handler(this->_handshake_handler);
+
+ // regist qlog
+ if (this->_context->config()->qlog_file() != nullptr) {
+ this->_qlog = std::make_unique<QLog::QLogListener>(*this->_context.get(),
this->_original_quic_connection_id.hex());
Review comment:
I think we can pass `*this->_context` without `get()`.
##########
File path: iocore/net/QUICNetVConnection.cc
##########
@@ -1697,8 +1712,10 @@ QUICNetVConnection::_recv_and_ack(const QUICPacketR
&packet, bool *has_non_probi
*has_non_probing_frame = false;
}
- error = this->_frame_dispatcher->receive_frames(level, payload, size,
ack_only, is_flow_controlled, has_non_probing_frame,
- static_cast<const
QUICPacketR *>(&packet));
+ error = this->_frame_dispatcher->receive_frames(*this->_context.get(),
level, payload, size, ack_only, is_flow_controlled,
Review comment:
Same as above, we should be able to pass `*this->_context`.
##########
File path: iocore/net/quic/qlog/QLogFrame.cc
##########
@@ -0,0 +1,282 @@
+/** @file
+ *
+ * A brief file description
+ *
+ * @section license License
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "QLogFrame.h"
+
+namespace QLog
+{
+template <typename Real>
+Real &
+Convert(const QUICFrame *frame)
+{
+ // FIXME: dangerous
+ auto tmp = const_cast<QUICFrame *>(frame);
Review comment:
I don't understand why we need to remove `const`. I haven't compiled the
new code yet so I'm not sure if it's possible with the new code, but we should
keep `const`.
##########
File path: iocore/net/quic/qlog/QLogFrame.cc
##########
@@ -0,0 +1,282 @@
+/** @file
+ *
+ * A brief file description
+ *
+ * @section license License
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "QLogFrame.h"
+
+namespace QLog
+{
+template <typename Real>
+Real &
+Convert(const QUICFrame *frame)
+{
+ // FIXME: dangerous
+ auto tmp = const_cast<QUICFrame *>(frame);
Review comment:
```cpp
template <typename Real>
const Real &
Convert(const QUICFrame *frame)
{
#if defined(DEBUG)
auto ref = dynamic_cast<const Real *>(frame);
ink_assert(ref != nullptr);
return *ref;
#endif
return *static_cast<const Real *>(frame);
}
```
```cpp
return std::make_unique<Frame::AckFrame>(Convert<const QUICAckFrame>(frame));
```
```cpp
AckFrame(const QUICAckFrame &frame) : QLogFrame(frame.type())
```
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]