Commit 46f3f79f authored by Zhongyi Shi's avatar Zhongyi Shi Committed by Commit Bot

Add net log for port migration.

Bug: 999285
Change-Id: I32d677d9eeaaad3225e41a7c1b4c89aa665f26d2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1776730
Commit-Queue: Zhongyi Shi <zhongyi@chromium.org>
Reviewed-by: default avatarRyan Hamilton <rch@chromium.org>
Reviewed-by: default avatarEric Roman <eroman@chromium.org>
Cr-Commit-Position: refs/heads/master@{#698598}
parent adc8f05a
......@@ -2055,22 +2055,23 @@ EVENT_TYPE(QUIC_CHROMIUM_CLIENT_STREAM_READ_RESPONSE_TRAILERS)
// "connection_migration_mode": <The connection migration mode>
// }
EVENT_TYPE(QUIC_CONNECTION_MIGRATION_MODE)
// Records that QUIC connection migration has been triggered.
// {
// "trigger": <The reason for the migration attempt>
// }
EVENT_TYPE(QUIC_CONNECTION_MIGRATION_TRIGGERED)
// Records that a QUIC connection migration attempt of the session
// identified by connection_id failed.
// Records a failed QUIC connection migration attempt of the session
// identified by connection_id.
// {
// "connection_id": <Connection ID of the session>
// "reason": <Failure reason>
// "reason": <String of the failure reason>
// }
EVENT_TYPE(QUIC_CONNECTION_MIGRATION_FAILURE)
// Records that a QUIC connection migration attempt of the session
// identified by connection_id succeeded.
// Records a successful QUIC connection migration attempt of the session
// identified by connection_id.
// {
// "connection_id": <Connection ID of the session>
// }
......@@ -2142,6 +2143,28 @@ EVENT_TYPE(QUIC_CONNECTIVITY_PROBING_MANAGER_PROBE_SENT)
// }
EVENT_TYPE(QUIC_CONNECTIVITY_PROBING_MANAGER_PROBE_RECEIVED)
// ------------------------------------------------------------------------
// QuicPortMigration
// ------------------------------------------------------------------------
// Records that QUIC port migration has been triggered.
EVENT_TYPE(QUIC_PORT_MIGRATION_TRIGGERED)
// Records a failed QUIC port migration attempt of the session identified
// by connection_id.
// {
// "connection_id": <Connection ID of the session>
// "reason": <String of the failure reason>
// }
EVENT_TYPE(QUIC_PORT_MIGRATION_FAILURE)
// Records a successful QUIC port migration attempt of the session
// identified by connection_id.
// {
// "connection_id": <Connection ID of the session>
// }
EVENT_TYPE(QUIC_PORT_MIGRATION_SUCCESS)
// ------------------------------------------------------------------------
// HttpStreamParser
// ------------------------------------------------------------------------
......
......@@ -23,6 +23,7 @@ SOURCE_TYPE(SOCKET)
SOURCE_TYPE(HTTP2_SESSION)
SOURCE_TYPE(QUIC_SESSION)
SOURCE_TYPE(QUIC_CONNECTION_MIGRATION)
SOURCE_TYPE(QUIC_PORT_MIGRATION)
SOURCE_TYPE(HOST_RESOLVER_IMPL_JOB)
SOURCE_TYPE(DISK_CACHE_ENTRY)
SOURCE_TYPE(MEMORY_CACHE_ENTRY)
......
......@@ -134,16 +134,16 @@ void RecordConnectionCloseErrorCode(quic::QuicErrorCode error,
}
}
base::Value NetLogQuicConnectionMigrationFailureParams(
base::Value NetLogQuicMigrationFailureParams(
quic::QuicConnectionId connection_id,
const std::string& reason) {
base::StringPiece reason) {
base::DictionaryValue dict;
dict.SetString("connection_id", connection_id.ToString());
dict.SetString("reason", reason);
return std::move(dict);
}
base::Value NetLogQuicConnectionMigrationSuccessParams(
base::Value NetLogQuicMigrationSuccessParams(
quic::QuicConnectionId connection_id) {
base::DictionaryValue dict;
dict.SetString("connection_id", connection_id.ToString());
......@@ -2439,25 +2439,22 @@ void QuicChromiumClientSession::MaybeMigrateToDifferentPortOnPathDegrading() {
// Migration before handshake is not allowed.
if (!IsCryptoHandshakeConfirmed()) {
// TODO(zhongyi): add histogram and net log entries.
HistogramAndLogMigrationFailure(
net_log_, MIGRATION_STATUS_PATH_DEGRADING_BEFORE_HANDSHAKE_CONFIRMED,
connection_id(), "Path degrading before handshake confirmed");
return;
}
// TODO(zhongyi): replace with port migration net log.
const NetLogWithSource migration_net_log = NetLogWithSource::Make(
net_log_.net_log(), NetLogSourceType::QUIC_CONNECTION_MIGRATION);
migration_net_log.BeginEventWithStringParams(
NetLogEventType::QUIC_CONNECTION_MIGRATION_TRIGGERED, "trigger",
"port migration on PathDegrading");
net_log_.net_log(), NetLogSourceType::QUIC_PORT_MIGRATION);
migration_net_log.BeginEvent(NetLogEventType::QUIC_PORT_MIGRATION_TRIGGERED);
if (!stream_factory_)
return;
// Probe a different port, session will migrate to the probed port on success.
// TODO(zhongyi): maybe pass in the network handle current socket is on?
StartProbing(default_network_, peer_address(), migration_net_log);
migration_net_log.EndEvent(
NetLogEventType::QUIC_CONNECTION_MIGRATION_TRIGGERED);
migration_net_log.EndEvent(NetLogEventType::QUIC_PORT_MIGRATION_TRIGGERED);
}
void QuicChromiumClientSession::
......@@ -2798,19 +2795,33 @@ void QuicChromiumClientSession::HistogramAndLogMigrationFailure(
const NetLogWithSource& net_log,
QuicConnectionMigrationStatus status,
quic::QuicConnectionId connection_id,
const std::string& reason) {
net_log.AddEvent(NetLogEventType::QUIC_CONNECTION_MIGRATION_FAILURE, [&] {
return NetLogQuicConnectionMigrationFailureParams(connection_id, reason);
const char* reason) {
NetLogEventType event_type =
current_migration_cause_ == CHANGE_PORT_ON_PATH_DEGRADING
? NetLogEventType::QUIC_PORT_MIGRATION_FAILURE
: NetLogEventType::QUIC_CONNECTION_MIGRATION_FAILURE;
net_log.AddEvent(event_type, [&] {
return NetLogQuicMigrationFailureParams(connection_id, reason);
});
// |current_migration_cause_| will be reset afterwards.
LogMigrationResultToHistogram(status);
}
void QuicChromiumClientSession::HistogramAndLogMigrationSuccess(
const NetLogWithSource& net_log,
quic::QuicConnectionId connection_id) {
net_log.AddEvent(NetLogEventType::QUIC_CONNECTION_MIGRATION_SUCCESS, [&] {
return NetLogQuicConnectionMigrationSuccessParams(connection_id);
NetLogEventType event_type =
current_migration_cause_ == CHANGE_PORT_ON_PATH_DEGRADING
? NetLogEventType::QUIC_PORT_MIGRATION_SUCCESS
: NetLogEventType::QUIC_CONNECTION_MIGRATION_SUCCESS;
net_log.AddEvent(event_type, [&] {
return NetLogQuicMigrationSuccessParams(connection_id);
});
// |current_migration_cause_| will be reset afterwards.
LogMigrationResultToHistogram(MIGRATION_STATUS_SUCCESS);
}
......
......@@ -752,7 +752,7 @@ class NET_EXPORT_PRIVATE QuicChromiumClientSession
void HistogramAndLogMigrationFailure(const NetLogWithSource& net_log,
QuicConnectionMigrationStatus status,
quic::QuicConnectionId connection_id,
const std::string& reason);
const char* reason);
void HistogramAndLogMigrationSuccess(const NetLogWithSource& net_log,
quic::QuicConnectionId connection_id);
......
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