Skip to content

Commit

Permalink
Start adding DSF_CTRL_EVENT for network event logging
Browse files Browse the repository at this point in the history
Summary: As titled

Reviewed By: peygar

Differential Revision: D61226533

fbshipit-source-id: 8ab48c4a1b7228351c48d8c95561299133997d91
  • Loading branch information
Jasmeet Bagga authored and facebook-github-bot committed Aug 14, 2024
1 parent e5d0ac6 commit 712cf57
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
11 changes: 11 additions & 0 deletions fboss/agent/DsfSubscription.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ std::vector<std::vector<std::string>> getAllSubscribePaths(
DsfSubscription::makeRemoteEndpoint(localNodeName, localIP))
.tokens()};
}
auto constexpr kDsfCtrlLogPrefix = "DSF_CTRL_EVENT: ";
} // namespace

namespace facebook::fboss {
Expand Down Expand Up @@ -94,6 +95,8 @@ DsfSubscription::DsfSubscription(
handleFsdbUpdate(std::move(operStateUnit));
},
getServerOptions(localIp_.str(), remoteIp_.str()));
XLOG(DBG2) << kDsfCtrlLogPrefix
<< "added subscription for : " << remoteEndpointStr();
}

DsfSubscription::~DsfSubscription() {
Expand All @@ -103,8 +106,15 @@ DsfSubscription::~DsfSubscription() {
}
fsdbPubSubMgr_->removeStatePathSubscription(
getAllSubscribePaths(localNodeName_, localIp_), remoteIp_.str());
XLOG(DBG2) << kDsfCtrlLogPrefix
<< "removed subscription for : " << remoteEndpointStr();
}

std::string DsfSubscription::remoteEndpointStr() const {
static const std::string kRemoteEndpoint =
remoteNodeName_ + "_" + remoteIp_.str();
return kRemoteEndpoint;
}
fsdb::FsdbStreamClient::State DsfSubscription::getStreamState() const {
return fsdbPubSubMgr_->getStatePathSubsriptionState(
getAllSubscribePaths(localNodeName_, localIp_), remoteIp_.str());
Expand Down Expand Up @@ -258,6 +268,7 @@ void DsfSubscription::updateWithRollbackProtection(

void DsfSubscription::processGRHoldTimerExpired() {
sw_->stats()->dsfSessionGrExpired();
XLOG(DBG2) << kDsfCtrlLogPrefix << "GR expired for : " << remoteEndpointStr();
auto updateDsfStateFn = [this](const std::shared_ptr<SwitchState>& in) {
bool changed{false};
auto out = in->clone();
Expand Down
1 change: 1 addition & 0 deletions fboss/agent/DsfSubscription.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ class DsfSubscription {
}

private:
std::string remoteEndpointStr() const;
void updateWithRollbackProtection(
const std::map<SwitchID, std::shared_ptr<SystemPortMap>>&
switchId2SystemPorts,
Expand Down

0 comments on commit 712cf57

Please sign in to comment.