Commit 7a6aa0bb authored by Renjie Tang's avatar Renjie Tang Committed by Commit Bot

Support even more frames in net log.

Things that will be logged under normal mode:
PADDING_FRAME: The number of padding bytes.
NEW_CONNECTION_ID_FRAME: the new connection id, and its sequencer_number.
NEW_TOKEN_FRAME: The address validation token received.
RETIRE_CONNECTION_ID_FRAME: the sequencer number.
MESSAGE_FRAME: the frame length.

Change-Id: Id66fbe17dd9a35437fe1d5162b57d5a0b995134a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1832717Reviewed-by: default avatarNick Harper <nharper@chromium.org>
Commit-Queue: Renjie Tang <renjietang@chromium.org>
Cr-Commit-Position: refs/heads/master@{#707536}
parent 087aa3d1
...@@ -2095,6 +2095,74 @@ EVENT_TYPE(QUIC_SESSION_MAX_STREAMS_FRAME_SENT) ...@@ -2095,6 +2095,74 @@ EVENT_TYPE(QUIC_SESSION_MAX_STREAMS_FRAME_SENT)
// } // }
EVENT_TYPE(QUIC_SESSION_MAX_STREAMS_FRAME_RECEIVED) EVENT_TYPE(QUIC_SESSION_MAX_STREAMS_FRAME_RECEIVED)
// Session sent a PADDING frame.
// {
// "num_padding_bytes": <The number of padding bytes>
// }
EVENT_TYPE(QUIC_SESSION_PADDING_FRAME_SENT)
// Session received a PADDING frame.
// {
// "num_padding_bytes": <The number of padding bytes>
// }
EVENT_TYPE(QUIC_SESSION_PADDING_FRAME_RECEIVED)
// Session sent a NEW_CONNECITON_ID frame.
// {
// "connection_id": <The new connection id>
// "sequencer_number": <Connection id sequence number that specifies the
// order that connection ids must be used in.>
// "retire_prior_to": <retire prior to>
// }
EVENT_TYPE(QUIC_SESSION_NEW_CONNECTION_ID_FRAME_SENT)
// Session received a NEW_CONNECITON_ID frame.
// {
// "connection_id": <The new connection id>
// "sequence_number": <Connection id sequence number that specifies the
// order that connection ids must be used in.>
// "retire_prior_to": <retire prior to>
// }
EVENT_TYPE(QUIC_SESSION_NEW_CONNECTION_ID_FRAME_RECEIVED)
// Session sent a NEW_TOKEN frame.
// {
// "token": <String representation of the token>
// }
EVENT_TYPE(QUIC_SESSION_NEW_TOKEN_FRAME_SENT)
// Session received a NEW_TOKEN frame.
// {
// "token": <String representation of the token>
// }
EVENT_TYPE(QUIC_SESSION_NEW_TOKEN_FRAME_RECEIVED)
// Session sent a RETIRE_CONNECTION_ID frame.
// {
// "sequence_number": <Connection id sequence number that specifies the
// order that connection ids must be used in.>
// }
EVENT_TYPE(QUIC_SESSION_RETIRE_CONNECTION_ID_FRAME_SENT)
// Session received a RETIRE_CONNECTION_ID frame.
// {
// "sequence_number": <Connection id sequence number that specifies the
// order that connection ids must be used in.>
// }
EVENT_TYPE(QUIC_SESSION_RETIRE_CONNECTION_ID_FRAME_RECEIVED)
// Session sent a MESSAGE frame.
// {
// "message_length": <the length of the message>
// }
EVENT_TYPE(QUIC_SESSION_MESSAGE_FRAME_SENT)
// Session received a MESSAGE frame.
// {
// "message_length": <the length of the message>
// }
EVENT_TYPE(QUIC_SESSION_MESSAGE_FRAME_RECEIVED)
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
// QuicHttpStream // QuicHttpStream
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
......
...@@ -304,6 +304,31 @@ base::Value NetLogQuicMaxStreamsFrameParams( ...@@ -304,6 +304,31 @@ base::Value NetLogQuicMaxStreamsFrameParams(
return dict; return dict;
} }
base::Value NetLogQuicNewConnectionIdFrameParams(
const quic::QuicNewConnectionIdFrame* frame) {
base::Value dict(base::Value::Type::DICTIONARY);
dict.SetStringKey("connection_id", frame->connection_id.ToString());
dict.SetKey("sequence_number", NetLogNumberValue(frame->sequence_number));
dict.SetKey("retire_prior_to", NetLogNumberValue(frame->retire_prior_to));
return dict;
}
base::Value NetLogQuicRetireConnectionIdFrameParams(
const quic::QuicRetireConnectionIdFrame* frame) {
base::Value dict(base::Value::Type::DICTIONARY);
dict.SetKey("sequence_number", NetLogNumberValue(frame->sequence_number));
return dict;
}
base::Value NetLogQuicNewTokenFrameParams(
const quic::QuicNewTokenFrame* frame) {
base::Value dict(base::Value::Type::DICTIONARY);
dict.SetKey("token", NetLogBinaryValue(
reinterpret_cast<const void*>(frame->token.data()),
frame->token.length()));
return dict;
}
void UpdatePublicResetAddressMismatchHistogram( void UpdatePublicResetAddressMismatchHistogram(
const IPEndPoint& server_hello_address, const IPEndPoint& server_hello_address,
const IPEndPoint& public_reset_address) { const IPEndPoint& public_reset_address) {
...@@ -448,6 +473,9 @@ void QuicConnectionLogger::OnFrameAddedToPacket(const quic::QuicFrame& frame) { ...@@ -448,6 +473,9 @@ void QuicConnectionLogger::OnFrameAddedToPacket(const quic::QuicFrame& frame) {
return; return;
switch (frame.type) { switch (frame.type) {
case quic::PADDING_FRAME: case quic::PADDING_FRAME:
net_log_.AddEventWithIntParams(
NetLogEventType::QUIC_SESSION_PADDING_FRAME_SENT, "num_padding_bytes",
frame.padding_frame.num_padding_bytes);
break; break;
case quic::STREAM_FRAME: case quic::STREAM_FRAME:
net_log_.AddEvent(NetLogEventType::QUIC_SESSION_STREAM_FRAME_SENT, [&] { net_log_.AddEvent(NetLogEventType::QUIC_SESSION_STREAM_FRAME_SENT, [&] {
...@@ -510,6 +538,11 @@ void QuicConnectionLogger::OnFrameAddedToPacket(const quic::QuicFrame& frame) { ...@@ -510,6 +538,11 @@ void QuicConnectionLogger::OnFrameAddedToPacket(const quic::QuicFrame& frame) {
net_log_.AddEvent(NetLogEventType::QUIC_SESSION_MTU_DISCOVERY_FRAME_SENT); net_log_.AddEvent(NetLogEventType::QUIC_SESSION_MTU_DISCOVERY_FRAME_SENT);
break; break;
case quic::NEW_CONNECTION_ID_FRAME: case quic::NEW_CONNECTION_ID_FRAME:
net_log_.AddEvent(
NetLogEventType::QUIC_SESSION_NEW_CONNECTION_ID_FRAME_SENT, [&] {
return NetLogQuicNewConnectionIdFrameParams(
frame.new_connection_id_frame);
});
break; break;
case quic::MAX_STREAMS_FRAME: case quic::MAX_STREAMS_FRAME:
net_log_.AddEvent( net_log_.AddEvent(
...@@ -543,6 +576,9 @@ void QuicConnectionLogger::OnFrameAddedToPacket(const quic::QuicFrame& frame) { ...@@ -543,6 +576,9 @@ void QuicConnectionLogger::OnFrameAddedToPacket(const quic::QuicFrame& frame) {
}); });
break; break;
case quic::MESSAGE_FRAME: case quic::MESSAGE_FRAME:
net_log_.AddEventWithIntParams(
NetLogEventType::QUIC_SESSION_MESSAGE_FRAME_SENT, "message_length",
frame.message_frame->message_length);
break; break;
case quic::CRYPTO_FRAME: case quic::CRYPTO_FRAME:
net_log_.AddEvent(NetLogEventType::QUIC_SESSION_CRYPTO_FRAME_SENT, [&] { net_log_.AddEvent(NetLogEventType::QUIC_SESSION_CRYPTO_FRAME_SENT, [&] {
...@@ -551,8 +587,16 @@ void QuicConnectionLogger::OnFrameAddedToPacket(const quic::QuicFrame& frame) { ...@@ -551,8 +587,16 @@ void QuicConnectionLogger::OnFrameAddedToPacket(const quic::QuicFrame& frame) {
}); });
break; break;
case quic::NEW_TOKEN_FRAME: case quic::NEW_TOKEN_FRAME:
net_log_.AddEvent(
NetLogEventType::QUIC_SESSION_NEW_TOKEN_FRAME_SENT,
[&] { return NetLogQuicNewTokenFrameParams(frame.new_token_frame); });
break; break;
case quic::RETIRE_CONNECTION_ID_FRAME: case quic::RETIRE_CONNECTION_ID_FRAME:
net_log_.AddEvent(
NetLogEventType::QUIC_SESSION_RETIRE_CONNECTION_ID_FRAME_SENT, [&] {
return NetLogQuicRetireConnectionIdFrameParams(
frame.retire_connection_id_frame);
});
break; break;
default: default:
DCHECK(false) << "Illegal frame type: " << frame.type; DCHECK(false) << "Illegal frame type: " << frame.type;
...@@ -846,6 +890,48 @@ void QuicConnectionLogger::OnPingFrame(const quic::QuicPingFrame& frame) { ...@@ -846,6 +890,48 @@ void QuicConnectionLogger::OnPingFrame(const quic::QuicPingFrame& frame) {
net_log_.AddEvent(NetLogEventType::QUIC_SESSION_PING_FRAME_RECEIVED); net_log_.AddEvent(NetLogEventType::QUIC_SESSION_PING_FRAME_RECEIVED);
} }
void QuicConnectionLogger::OnPaddingFrame(const quic::QuicPaddingFrame& frame) {
if (!net_log_.IsCapturing())
return;
net_log_.AddEventWithIntParams(
NetLogEventType::QUIC_SESSION_PADDING_FRAME_RECEIVED, "num_padding_bytes",
frame.num_padding_bytes);
}
void QuicConnectionLogger::OnNewConnectionIdFrame(
const quic::QuicNewConnectionIdFrame& frame) {
if (!net_log_.IsCapturing())
return;
net_log_.AddEvent(
NetLogEventType::QUIC_SESSION_NEW_CONNECTION_ID_FRAME_RECEIVED,
[&] { return NetLogQuicNewConnectionIdFrameParams(&frame); });
}
void QuicConnectionLogger::OnNewTokenFrame(
const quic::QuicNewTokenFrame& frame) {
if (!net_log_.IsCapturing())
return;
net_log_.AddEvent(NetLogEventType::QUIC_SESSION_NEW_TOKEN_FRAME_RECEIVED,
[&] { return NetLogQuicNewTokenFrameParams(&frame); });
}
void QuicConnectionLogger::OnRetireConnectionIdFrame(
const quic::QuicRetireConnectionIdFrame& frame) {
if (!net_log_.IsCapturing())
return;
net_log_.AddEvent(
NetLogEventType::QUIC_SESSION_RETIRE_CONNECTION_ID_FRAME_RECEIVED,
[&] { return NetLogQuicRetireConnectionIdFrameParams(&frame); });
}
void QuicConnectionLogger::OnMessageFrame(const quic::QuicMessageFrame& frame) {
if (!net_log_.IsCapturing())
return;
net_log_.AddEventWithIntParams(
NetLogEventType::QUIC_SESSION_MESSAGE_FRAME_RECEIVED, "message_length",
frame.message_length);
}
void QuicConnectionLogger::OnPublicResetPacket( void QuicConnectionLogger::OnPublicResetPacket(
const quic::QuicPublicResetPacket& packet) { const quic::QuicPublicResetPacket& packet) {
UpdatePublicResetAddressMismatchHistogram( UpdatePublicResetAddressMismatchHistogram(
......
...@@ -86,6 +86,13 @@ class NET_EXPORT_PRIVATE QuicConnectionLogger ...@@ -86,6 +86,13 @@ class NET_EXPORT_PRIVATE QuicConnectionLogger
void OnBlockedFrame(const quic::QuicBlockedFrame& frame) override; void OnBlockedFrame(const quic::QuicBlockedFrame& frame) override;
void OnGoAwayFrame(const quic::QuicGoAwayFrame& frame) override; void OnGoAwayFrame(const quic::QuicGoAwayFrame& frame) override;
void OnPingFrame(const quic::QuicPingFrame& frame) override; void OnPingFrame(const quic::QuicPingFrame& frame) override;
void OnPaddingFrame(const quic::QuicPaddingFrame& frame) override;
void OnNewConnectionIdFrame(
const quic::QuicNewConnectionIdFrame& frame) override;
void OnNewTokenFrame(const quic::QuicNewTokenFrame& frame) override;
void OnRetireConnectionIdFrame(
const quic::QuicRetireConnectionIdFrame& frame) override;
void OnMessageFrame(const quic::QuicMessageFrame& frame) override;
void OnPublicResetPacket(const quic::QuicPublicResetPacket& packet) override; void OnPublicResetPacket(const quic::QuicPublicResetPacket& packet) override;
void OnVersionNegotiationPacket( void OnVersionNegotiationPacket(
const quic::QuicVersionNegotiationPacket& packet) override; const quic::QuicVersionNegotiationPacket& packet) override;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment