mirror of
https://github.com/facebookincubator/mvfst.git
synced 2025-11-09 10:00:57 +03:00
HTTP Priority update logging in QLog
Summary: as title Reviewed By: mjoras Differential Revision: D24903759 fbshipit-source-id: 39127b658e6cb06025272c1c5ab0f7de2ae1a54a
This commit is contained in:
committed by
Facebook GitHub Bot
parent
218873a107
commit
7c85871c3e
@@ -2925,6 +2925,9 @@ QuicTransportBase::setStreamPriority(
|
|||||||
// It's not an error to prioritize a stream after it's sent its FIN - this
|
// It's not an error to prioritize a stream after it's sent its FIN - this
|
||||||
// can reprioritize retransmissions.
|
// can reprioritize retransmissions.
|
||||||
conn_->streamManager->setStreamPriority(id, level, incremental);
|
conn_->streamManager->setStreamPriority(id, level, incremental);
|
||||||
|
if (conn_->qLogger) {
|
||||||
|
conn_->qLogger->addPriorityUpdate(id, level, incremental);
|
||||||
|
}
|
||||||
return folly::unit;
|
return folly::unit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -441,6 +441,16 @@ void FileQLogger::addPathValidationEvent(bool success) {
|
|||||||
success, vantagePoint, refTime));
|
success, vantagePoint, refTime));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void FileQLogger::addPriorityUpdate(
|
||||||
|
quic::StreamId streamId,
|
||||||
|
uint8_t urgency,
|
||||||
|
bool incremental) {
|
||||||
|
auto refTime = std::chrono::duration_cast<std::chrono::microseconds>(
|
||||||
|
std::chrono::steady_clock::now().time_since_epoch());
|
||||||
|
handleEvent(std::make_unique<quic::QLogPriorityUpdateEvent>(
|
||||||
|
streamId, urgency, incremental, refTime));
|
||||||
|
}
|
||||||
|
|
||||||
void FileQLogger::outputLogsToFile(const std::string& path, bool prettyJson) {
|
void FileQLogger::outputLogsToFile(const std::string& path, bool prettyJson) {
|
||||||
if (streaming_) {
|
if (streaming_) {
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -112,6 +112,10 @@ class FileQLogger : public BaseQLogger {
|
|||||||
override;
|
override;
|
||||||
virtual void addConnectionMigrationUpdate(bool intentionalMigration) override;
|
virtual void addConnectionMigrationUpdate(bool intentionalMigration) override;
|
||||||
virtual void addPathValidationEvent(bool success) override;
|
virtual void addPathValidationEvent(bool success) override;
|
||||||
|
void addPriorityUpdate(
|
||||||
|
quic::StreamId streamId,
|
||||||
|
uint8_t urgency,
|
||||||
|
bool incremental) override;
|
||||||
|
|
||||||
void outputLogsToFile(const std::string& path, bool prettyJson);
|
void outputLogsToFile(const std::string& path, bool prettyJson);
|
||||||
folly::dynamic toDynamic() const;
|
folly::dynamic toDynamic() const;
|
||||||
|
|||||||
@@ -110,6 +110,11 @@ class QLogger {
|
|||||||
folly::Optional<std::chrono::milliseconds> timeSinceStreamCreation) = 0;
|
folly::Optional<std::chrono::milliseconds> timeSinceStreamCreation) = 0;
|
||||||
virtual void addConnectionMigrationUpdate(bool intentionalMigration) = 0;
|
virtual void addConnectionMigrationUpdate(bool intentionalMigration) = 0;
|
||||||
virtual void addPathValidationEvent(bool success) = 0;
|
virtual void addPathValidationEvent(bool success) = 0;
|
||||||
|
virtual void addPriorityUpdate(
|
||||||
|
quic::StreamId streamId,
|
||||||
|
uint8_t urgency,
|
||||||
|
bool incremental) = 0;
|
||||||
|
|
||||||
virtual void setDcid(folly::Optional<ConnectionId> connID) = 0;
|
virtual void setDcid(folly::Optional<ConnectionId> connID) = 0;
|
||||||
virtual void setScid(folly::Optional<ConnectionId> connID) = 0;
|
virtual void setScid(folly::Optional<ConnectionId> connID) = 0;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -839,6 +839,28 @@ folly::dynamic QLogPathValidationEvent::toDynamic() const {
|
|||||||
return d;
|
return d;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QLogPriorityUpdateEvent::QLogPriorityUpdateEvent(
|
||||||
|
StreamId streamId,
|
||||||
|
uint8_t urgency,
|
||||||
|
bool incremental,
|
||||||
|
std::chrono::microseconds refTimeIn)
|
||||||
|
: streamId_(streamId), urgency_(urgency), incremental_(incremental) {
|
||||||
|
eventType = QLogEventType::PriorityUpdate;
|
||||||
|
refTime = refTimeIn;
|
||||||
|
}
|
||||||
|
|
||||||
|
folly::dynamic QLogPriorityUpdateEvent::toDynamic() const {
|
||||||
|
folly::dynamic d = folly::dynamic::array(
|
||||||
|
folly::to<std::string>(refTime.count()), "HTTP3", toString(eventType));
|
||||||
|
folly::dynamic data = folly::dynamic::object();
|
||||||
|
|
||||||
|
data["id"] = streamId_;
|
||||||
|
data["urgency"] = urgency_;
|
||||||
|
data["incremental"] = incremental_;
|
||||||
|
d.push_back(std::move(data));
|
||||||
|
return d;
|
||||||
|
}
|
||||||
|
|
||||||
folly::StringPiece toString(QLogEventType type) {
|
folly::StringPiece toString(QLogEventType type) {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case QLogEventType::PacketSent:
|
case QLogEventType::PacketSent:
|
||||||
@@ -883,6 +905,8 @@ folly::StringPiece toString(QLogEventType type) {
|
|||||||
return "connection_migration";
|
return "connection_migration";
|
||||||
case QLogEventType::PathValidation:
|
case QLogEventType::PathValidation:
|
||||||
return "path_validation";
|
return "path_validation";
|
||||||
|
case QLogEventType::PriorityUpdate:
|
||||||
|
return "priority";
|
||||||
}
|
}
|
||||||
folly::assume_unreachable();
|
folly::assume_unreachable();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -334,7 +334,8 @@ enum class QLogEventType : uint32_t {
|
|||||||
AppLimitedUpdate,
|
AppLimitedUpdate,
|
||||||
BandwidthEstUpdate,
|
BandwidthEstUpdate,
|
||||||
ConnectionMigration,
|
ConnectionMigration,
|
||||||
PathValidation
|
PathValidation,
|
||||||
|
PriorityUpdate
|
||||||
};
|
};
|
||||||
|
|
||||||
folly::StringPiece toString(QLogEventType type);
|
folly::StringPiece toString(QLogEventType type);
|
||||||
@@ -670,4 +671,21 @@ class QLogPathValidationEvent : public QLogEvent {
|
|||||||
VantagePoint vantagePoint_;
|
VantagePoint vantagePoint_;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class QLogPriorityUpdateEvent : public QLogEvent {
|
||||||
|
public:
|
||||||
|
explicit QLogPriorityUpdateEvent(
|
||||||
|
StreamId id,
|
||||||
|
uint8_t urgency,
|
||||||
|
bool incremental,
|
||||||
|
std::chrono::microseconds refTimeIn);
|
||||||
|
~QLogPriorityUpdateEvent() override = default;
|
||||||
|
|
||||||
|
folly::dynamic toDynamic() const override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
StreamId streamId_;
|
||||||
|
uint8_t urgency_;
|
||||||
|
bool incremental_;
|
||||||
|
};
|
||||||
|
|
||||||
} // namespace quic
|
} // namespace quic
|
||||||
|
|||||||
@@ -75,5 +75,6 @@ class MockQLogger : public QLogger {
|
|||||||
MOCK_METHOD1(addPathValidationEvent, void(bool));
|
MOCK_METHOD1(addPathValidationEvent, void(bool));
|
||||||
MOCK_METHOD1(setDcid, void(folly::Optional<ConnectionId>));
|
MOCK_METHOD1(setDcid, void(folly::Optional<ConnectionId>));
|
||||||
MOCK_METHOD1(setScid, void(folly::Optional<ConnectionId>));
|
MOCK_METHOD1(setScid, void(folly::Optional<ConnectionId>));
|
||||||
|
MOCK_METHOD3(addPriorityUpdate, void(quic::StreamId, uint8_t, bool));
|
||||||
};
|
};
|
||||||
} // namespace quic::test
|
} // namespace quic::test
|
||||||
|
|||||||
Reference in New Issue
Block a user