From 712cf57dc85656999c4c0b86cc6a8e0756be63a3 Mon Sep 17 00:00:00 2001 From: Jasmeet Bagga Date: Tue, 13 Aug 2024 21:43:59 -0700 Subject: [PATCH] Start adding DSF_CTRL_EVENT for network event logging Summary: As titled Reviewed By: peygar Differential Revision: D61226533 fbshipit-source-id: 8ab48c4a1b7228351c48d8c95561299133997d91 --- fboss/agent/DsfSubscription.cpp | 11 +++++++++++ fboss/agent/DsfSubscription.h | 1 + 2 files changed, 12 insertions(+) diff --git a/fboss/agent/DsfSubscription.cpp b/fboss/agent/DsfSubscription.cpp index 7a7acb01ac559..3680ef02e9124 100644 --- a/fboss/agent/DsfSubscription.cpp +++ b/fboss/agent/DsfSubscription.cpp @@ -53,6 +53,7 @@ std::vector> getAllSubscribePaths( DsfSubscription::makeRemoteEndpoint(localNodeName, localIP)) .tokens()}; } +auto constexpr kDsfCtrlLogPrefix = "DSF_CTRL_EVENT: "; } // namespace namespace facebook::fboss { @@ -94,6 +95,8 @@ DsfSubscription::DsfSubscription( handleFsdbUpdate(std::move(operStateUnit)); }, getServerOptions(localIp_.str(), remoteIp_.str())); + XLOG(DBG2) << kDsfCtrlLogPrefix + << "added subscription for : " << remoteEndpointStr(); } DsfSubscription::~DsfSubscription() { @@ -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()); @@ -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& in) { bool changed{false}; auto out = in->clone(); diff --git a/fboss/agent/DsfSubscription.h b/fboss/agent/DsfSubscription.h index e1a9764727bd5..566a187fc9a1b 100644 --- a/fboss/agent/DsfSubscription.h +++ b/fboss/agent/DsfSubscription.h @@ -45,6 +45,7 @@ class DsfSubscription { } private: + std::string remoteEndpointStr() const; void updateWithRollbackProtection( const std::map>& switchId2SystemPorts,