Skip to content

Commit

Permalink
Update link prober metrics posting logics #50 #53
Browse files Browse the repository at this point in the history
### Description of PR
Can't do a clean cherry pick from original commit & PR in master branch:
898a655 Update link prober metrics posting logics (#50)

Summary:
Fixes # (issue)

This PR is to post not only `link_prober_unknown_end` but also `link_prober_[active|standby]_start` metrics event to `LINK_PROBE_STATS|PORTNAME` table. Current behavior is to only post the former. 

sign-off: Jing Zhang [email protected] 

### Type of change
- [x] Bug fix
  • Loading branch information
zjswhhh authored Mar 31, 2022
1 parent dfd48d0 commit 256b01b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
12 changes: 9 additions & 3 deletions src/link_manager/LinkManagerStateMachine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -487,12 +487,18 @@ void LinkManagerStateMachine::handleStateChange(LinkProberEvent &event, link_pro
if (mContinuousLinkProberUnknownEvent == true && state != link_prober::LinkProberState::Unknown) {
mContinuousLinkProberUnknownEvent = false;
mMuxPortPtr->postLinkProberMetricsEvent(link_manager::LinkManagerStateMachine::LinkProberMetrics::LinkProberUnknownEnd);
} else if (state == link_prober::LinkProberState::Label::Unknown) {
}

if (mContinuousLinkProberUnknownEvent == false && state == link_prober::LinkProberState::Label::Unknown) {
mContinuousLinkProberUnknownEvent = true;
mMuxPortPtr->postLinkProberMetricsEvent(link_manager::LinkManagerStateMachine::LinkProberMetrics::LinkProberUnknownStart);
} else if (state == link_prober::LinkProberState::Label::Active) {
}

if (state == link_prober::LinkProberState::Label::Active) {
mMuxPortPtr->postLinkProberMetricsEvent(link_manager::LinkManagerStateMachine::LinkProberMetrics::LinkProberActiveStart);
} else if (state == link_prober::LinkProberState::Label::Standby) {
}

if (state == link_prober::LinkProberState::Label::Standby) {
mMuxPortPtr->postLinkProberMetricsEvent(link_manager::LinkManagerStateMachine::LinkProberMetrics::LinkProberStandbyStart);
}

Expand Down
2 changes: 1 addition & 1 deletion test/LinkManagerStateMachineTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1120,7 +1120,7 @@ TEST_F(LinkManagerStateMachineTest, PostPckLossMetricsEvent)
EXPECT_EQ(mDbInterfacePtr->mPostLinkProberMetricsInvokeCount, 3); // post link_prober_unknown_start, link_prober_wait_start
postLinkProberEvent(link_prober::LinkProberState::Active, 3);

EXPECT_EQ(mDbInterfacePtr->mPostLinkProberMetricsInvokeCount, 4); // post link_prober_active_start
EXPECT_EQ(mDbInterfacePtr->mPostLinkProberMetricsInvokeCount, 5); // post link_prober_unknown_start, post link_prober_active_start
}

TEST_F(LinkManagerStateMachineTest, PostPckLossUpdateAndResetEvent)
Expand Down

0 comments on commit 256b01b

Please sign in to comment.