[clear] Add 'sonic-clear pfcwdstats' to clear PFC watchdog counters#4634
Open
pinky-nexthop wants to merge 1 commit into
Open
[clear] Add 'sonic-clear pfcwdstats' to clear PFC watchdog counters#4634pinky-nexthop wants to merge 1 commit into
pinky-nexthop wants to merge 1 commit into
Conversation
There is currently no CLI to clear PFC watchdog statistics. Clearing them is needed when troubleshooting PFC storms, where stale counts from a prior event make it hard to tell whether a storm is ongoing. This adds: - scripts/pfcwdstat: a new tool that zeroes the PFC_WD_QUEUE_STATS_* fields in COUNTERS_DB, following the standard counter-clear pattern (pfcstat -c, queuestat -c, ...). It enumerates queues via COUNTERS_QUEUE_NAME_MAP -- the same source 'show pfcwd stats' uses -- so stale stats from queues that are no longer actively monitored (STATUS=N/A) are also cleared. - Queues with an active storm (PFC_WD_STATUS == 'stormed') are skipped, so the in-flight DEADLOCK_DETECTED/RESTORED pair is not split (which would otherwise leave RESTORED > DETECTED once the storm ends). - clear/main.py: 'sonic-clear pfcwdstats', invoking 'pfcwdstat -c'. - setup.py: install scripts/pfcwdstat. - tests for the clear command and the pfcwdstat clear logic. Signed-off-by: Pinky Agrawal <pinky@nexthop.ai>
Collaborator
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Collaborator
|
Hi, there are workflow run(s) waiting for approval, you may be first-time contributor. I will notify maintainers to help approve once PR is approved. Thanks! ---Powered by SONiC BuildBot
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why I did it
There is currently no CLI to clear PFC watchdog statistics. Clearing them is needed when troubleshooting PFC storms — stale counts from a prior event make it hard to tell whether a storm is currently ongoing.
show pfcwd statsdisplays the counters, but there is no corresponding clear command.Addresses the PFC-watchdog-counter-clear item in #4595.
How I did it
scripts/pfcwdstat: new tool that zeroes thePFC_WD_QUEUE_STATS_*fields inCOUNTERS_DB, following the standard counter-clear pattern (pfcstat -c,queuestat -c, …). It enumerates queues viaCOUNTERS_QUEUE_NAME_MAP— the same sourceshow pfcwd statsuses — so stale stats from queues that are no longer actively monitored (STATUS=N/A) are also cleared.PFC_WD_STATUS == 'stormed') are skipped, so the in-flightDEADLOCK_DETECTED/DEADLOCK_RESTOREDpair is not split (which would otherwise leaveRESTORED > DETECTEDonce the storm ends).clear/main.py: addssonic-clear pfcwdstats, invokingpfcwdstat -c.setup.py: installsscripts/pfcwdstat.pfcwdstatclear logic (including the stale-stats and active-storm cases).How to verify it
Manually:
show pfcwd statsto see counts,sonic-clear pfcwdstatsto clear them; an actively storming queue is left untouched (and reported as skipped) until the storm ends.Which release branch to backport (provide reason below if selected)
Description for the changelog
Add
sonic-clear pfcwdstatsto clear PFC watchdog counters.