-
Notifications
You must be signed in to change notification settings - Fork 672
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Clear fabric counters queue/port #2892
Clear fabric counters queue/port #2892
Conversation
This PR is a clone of sonic-net#2789. Added two clear commands for fabric counters queue and fabric counters port. sonic-clear fabriccountersport sonic-clear fabriccountersqueue
60468bc
to
fa00dd6
Compare
/azpw run Azure.sonic-utilities |
/AzurePipelines run Azure.sonic-utilities |
Azure Pipelines successfully started running 1 pipeline(s). |
The
|
/azpw run Azure.sonic-utilities |
/AzurePipelines run Azure.sonic-utilities |
Commenter does not have sufficient privileges for PR 2892 in repo sonic-net/sonic-utilities |
Restarted failed job |
@qiluo-msft , many PRs are all failing on this test: 2023-07-19T16:42:39.2354382Z tests/intfstat_test.py::TestIntfstat::test_clear_tag FAILED [ 40%] Is this something broken due to some recent change that went in? How do we unblock this PR where this failure is not related to the PR changes? Thanks! |
/easyCLA |
@kenneth-arista , can you update your branch to fix the outdated branch issue? |
Looks like @qiluo-msft already merged master into the branch. Thanks! |
@StormLiangMS this PR supersedes #2789 and should be backported to 202305 |
/Azp run Azure.sonic-utilities |
Azure Pipelines successfully started running 1 pipeline(s). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
@qiluo-msft , can you help review this PR? |
cnstat_fqn_file_port_name = cnstat_fqn_file_port + asic_name | ||
json.dump(cnstat_dict, open(cnstat_fqn_file_port_name, 'w'), default=json_serial) | ||
except IOError as e: | ||
print(e.errno, e) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can change it, just that I see other commands print the same IOError like this, so I was trying to get the same style as those. Please let me know if we still want to print to stderr or like this. thank you
try: | ||
cnstat_cached_dict = json.load(open(cnstat_fqn_file_port_name, 'r')) | ||
except IOError as e: | ||
print(e.errno, e) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can change it, just that I see other commands print the same IOError like this, so I was trying to get the same style as those. Please let me know if we still want to print to stderr or like this. thank you
if os.path.isfile(cnstat_fqn_file_port_name): | ||
try: | ||
cnstat_cached_dict = json.load(open(cnstat_fqn_file_port_name, 'r')) | ||
except IOError as e: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the file not exist, I think we can still print out the counters ( with no cleaned ) , instead of print out nothing .
I read the clean code for other counters ( not exactly the same code piece as what I wrote ), but when they don't have the cached file, it still print out the uncleared counters. Please suggest if this behavior is ok or you want to print out nothing in this case. thank you
def save_fresh_stats(self): | ||
# Get stat for each port and save | ||
counter_port_name_map = self.db.get_all(self.db.COUNTERS_DB, COUNTERS_FABRIC_PORT_NAME_MAP) | ||
if counter_port_name_map is None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
printed out a message before the return
if os.path.isfile(cnstat_fqn_file_queue_name): | ||
try: | ||
cnstat_cached_dict = json.load(open(cnstat_fqn_file_queue_name, 'r')) | ||
except IOError as e: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the file not exist, I think we can still print out the counters ( with no cleaned ) , instead of print out nothing .
I read the clean code for other counters ( not exactly the same code piece as what I wrote ), but when they don't have the cached file, it still print out the uncleared counters. Please suggest if this behavior is ok or you want to print out nothing in this case. thank you
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Please also check with other active reviewers.
The change looks good to me |
@arlakshm please help create a msft ado if it helps to speed up cherry-pick, thx |
@kenneth-arista , This PR when cherry-picked to the msft repo it is causing build issue as described by @mlok-nokia I have reverted this PR from the msft repo and removing the "included in chassis for 202205 branch". |
@arlakshm , please help follow up with Arista team (@kenneth-arista) on the issue that this PR is causing on the azure/sonic-buildimage-msft 202205 branch. I have reverted this Change from the sonic-utilities.msft 202205 repo so the most current snapshot on "azure/sonic-buildimage-msft 202205 branch" no longer has this problem PR. BUt we need this be investigated and fix so we can bring back this fix to "azure/spmoc-utilities.msft 202205" and "azure/sonic-buildimage-msft 202205" repos. |
I can work on this and create a PR of clear fabric counters in 202205 branch. Please let me know which branches should I work on . thank you |
Can you raise a PR in this repo: And make sure you test it (build it) under this repo: If it addresses the build PR test failure issues, then it is ready. |
got it . thank you ! |
Adding back the label to indicate it got merged in MSFT repo. |
What I did
This PR is a clone of #2789.
Added two clear commands for fabric counters queue and fabric counters port.
Fabric counters are cleared and saved with these two commands. For example,