Skip to content
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

Fix flex counters logic of converting poll interval to seconds from MS #878

Merged
merged 3 commits into from
Sep 2, 2021

Conversation

noaOrMlnx
Copy link
Contributor

@noaOrMlnx noaOrMlnx commented Aug 3, 2021

According to https://github.com/Azure/SONiC/blob/ec6d35dd2c28491bfade19cfee990fe612f1e5e9/doc/rates-and-utilization/Rates_and_utilization_HLD.md, counterpoll command gives polling interval in milliseconds.
So when converting them to seconds to be supplied to lua script this should be divide by 1000. However, syncd multiplies it by 1000.

Changed the multiplication to none, and did the converting in lua script - sonic-net/sonic-swss#1855
Fixed issue - sonic-net/sonic-buildimage#8392

@@ -1597,7 +1597,7 @@ void FlexCounter::runPlugins(
{
std::to_string(counters_db.getDbId()),
COUNTERS_TABLE,
std::to_string(m_pollInterval * 1000)
std::to_string(m_pollInterval / 1000)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

m_pollInterval is set via orchagent with values in milliseconds (MS), currently this value was extended to microseconds, and now you changing this to seconds, so if m_pollInterval will be equal to let say 60ms or 100ms or 900ms, then your value in db will be set to zero (0) because of integer division, is that what you want ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done - removed the multiplication and did the required multiplication in the lua script - sonic-net/sonic-swss#1855

@liat-grozovik
Copy link
Collaborator

@kcudnik could you please help review?

@kcudnik
Copy link
Collaborator

kcudnik commented Aug 16, 2021

@kcudnik could you please help review?

i already posted my concerns in comment above, and still this is not addressed nor responded how this will be handled

@noaOrMlnx
Copy link
Contributor Author

@kcudnik Hi Kamil,
the request was addressed and the code has been changed.
appreciate if you'll take a look.
Thanks

@kcudnik
Copy link
Collaborator

kcudnik commented Aug 16, 2021

i still don't see consistency here, what value is set in OA, what pooliterval value is stored in db and what value valie of pollinterval i passed to lua script

@dgsudharsan
Copy link
Collaborator

i still don't see consistency here, what value is set in OA, what pooliterval value is stored in db and what value valie of pollinterval i passed to lua script

Hi Kamil. The value set in CLI is in milliseconds which is again set as milliseconds in orchagent. This value is again passed to lua script in milliseconds. So end to end we are using milliseconds. The lua scripts are updated to treat the input arg in milliseconds which is here sonic-net/sonic-swss#1855
Your initial concern was correct and we avoided converting milliseconds to seconds (since lua script expected seconds in arg). Now we have changed end to end and we do not convert anywhere and lua script rate calculation logic is updated considering poll interval as milliseconds.

@kcudnik
Copy link
Collaborator

kcudnik commented Aug 17, 2021

thanks for deep answer on that, now i get the flow

kcudnik
kcudnik previously approved these changes Aug 17, 2021
@liat-grozovik
Copy link
Collaborator

@noaOrMlnx could you please review the failures?

@noaOrMlnx
Copy link
Contributor Author

@kcudnik could you please re-approve?

kcudnik
kcudnik previously approved these changes Aug 29, 2021
@qiluo-msft
Copy link
Contributor

The PR check "license/cla" seems have some issue. Could you commit an empty commit, to retrigger the check.
I checked https://cla.opensource.microsoft.com/Azure/sonic-sairedis?pullRequest=878, and it is not signed.

@noaOrMlnx
Copy link
Contributor Author

@qiluo-msft Done

@qiluo-msft
Copy link
Contributor

@kcudnik Could you review again, and merge after all checkers pass?

@qiluo-msft qiluo-msft merged commit 536af40 into sonic-net:master Sep 2, 2021
qiluo-msft pushed a commit that referenced this pull request Sep 2, 2021
#878)

According to https://github.com/Azure/SONiC/blob/ec6d35dd2c28491bfade19cfee990fe612f1e5e9/doc/rates-and-utilization/Rates_and_utilization_HLD.md, counterpoll command gives polling interval in milliseconds. 
So when converting them to seconds to be supplied to lua script this should be divide by 1000. However, syncd multiplies it by 1000.

Changed the multiplication to none, and did the converting in lua script - sonic-net/sonic-swss#1855
Fixed issue - sonic-net/sonic-buildimage#8392
qiluo-msft pushed a commit to sonic-net/sonic-swss that referenced this pull request Sep 3, 2021
… MS (#1855)

**What I did**
Update the rif_rates/lua script to multiply by 1000 instead of FlexCounter class.
related also to this PR - sonic-net/sonic-sairedis#878

Fix issue - sonic-net/sonic-buildimage#8392
**Why I did it**
times were not calculated properly.
**How I verified it**
check that the output of cli and redis is close enough:
qiluo-msft pushed a commit to sonic-net/sonic-swss that referenced this pull request Sep 3, 2021
… MS (#1855)

**What I did**
Update the rif_rates/lua script to multiply by 1000 instead of FlexCounter class.
related also to this PR - sonic-net/sonic-sairedis#878

Fix issue - sonic-net/sonic-buildimage#8392
**Why I did it**
times were not calculated properly.
**How I verified it**
check that the output of cli and redis is close enough:
volodymyrsamotiy added a commit to volodymyrsamotiy/sonic-swss that referenced this pull request Sep 14, 2021
PFCWD storm detection and restoration LUA scripts require values in microseconds.
Due to recent changes polling interval is now passed in milliseconds by "FlexCounter".
sonic-net/sonic-sairedis#878

Signed-off-by: Volodymyr Samotiy <volodymyrs@nvidia.com>
volodymyrsamotiy added a commit to volodymyrsamotiy/sonic-swss that referenced this pull request Sep 14, 2021
PFCWD storm detection and restoration LUA scripts require values in microseconds.
Due to recent changes polling interval is now passed in milliseconds by "FlexCounter".
* sonic-net/sonic-sairedis#878

Signed-off-by: Volodymyr Samotiy <volodymyrs@nvidia.com>
judyjoseph pushed a commit to sonic-net/sonic-swss that referenced this pull request Sep 14, 2021
… MS (#1855)

**What I did**
Update the rif_rates/lua script to multiply by 1000 instead of FlexCounter class.
related also to this PR - sonic-net/sonic-sairedis#878

Fix issue - sonic-net/sonic-buildimage#8392
**Why I did it**
times were not calculated properly.
**How I verified it**
check that the output of cli and redis is close enough:
volodymyrsamotiy added a commit to volodymyrsamotiy/sonic-swss that referenced this pull request Sep 15, 2021
PFCWD storm detection and restoration LUA scripts require values in microseconds.
Due to recent changes polling interval is now passed in milliseconds by "FlexCounter".
* sonic-net/sonic-sairedis#878

Signed-off-by: Volodymyr Samotiy <volodymyrs@nvidia.com>
volodymyrsamotiy added a commit to volodymyrsamotiy/sonic-swss that referenced this pull request Sep 15, 2021
PFCWD storm detection and restoration LUA scripts require values in microseconds.
Due to recent changes polling interval is now passed in milliseconds by "FlexCounter".
* sonic-net/sonic-sairedis#878

Signed-off-by: Volodymyr Samotiy <volodymyrs@nvidia.com>
qiluo-msft pushed a commit to sonic-net/sonic-swss that referenced this pull request Sep 16, 2021
…#1909)

**What I did**
Converted polling interval from milliseconds to microseconds in PFCWD LUA scripts.
Same as PR #1908 but created directly against ```202012``` release branch

**Why I did it**
PFCWD storm detection and restoration LUA scripts require values in microseconds.
Due to recent changes polling interval is now passed in milliseconds by "FlexCounter".
* sonic-net/sonic-sairedis#878

So need to convert values to microseconds (as it was before) in order to make PFCWD working,

**How I verified it**
Ran PFCWD tests from sonic-mgmt.
qiluo-msft pushed a commit to sonic-net/sonic-swss that referenced this pull request Sep 16, 2021
**What I did**
Converted polling interval from milliseconds to microseconds in PFCWD LUA scripts.

**Why I did it**
PFCWD storm detection and restoration LUA scripts require values in microseconds.
Due to recent changes polling interval is now passed in milliseconds by "FlexCounter".
* sonic-net/sonic-sairedis#878

So need to convert values to microseconds (as it was before) in order to make PFCWD working,

**How I verified it**
Ran PFCWD tests from sonic-mgmt.
qiluo-msft pushed a commit to sonic-net/sonic-swss that referenced this pull request Sep 18, 2021
Fixes sonic-net/sonic-buildimage#8773
Pfcwd regressions were observed due to the changes in the PR sonic-net/sonic-sairedis#878. Hence aligning the polling interval in lua script to use microseconds

**How I verified it**
Ran pfcwd tests that were failing prior to this change and they passed
qiluo-msft pushed a commit to sonic-net/sonic-swss that referenced this pull request Sep 18, 2021
Fixes sonic-net/sonic-buildimage#8773
Pfcwd regressions were observed due to the changes in the PR sonic-net/sonic-sairedis#878. Hence aligning the polling interval in lua script to use microseconds

**How I verified it**
Ran pfcwd tests that were failing prior to this change and they passed
judyjoseph pushed a commit to sonic-net/sonic-swss that referenced this pull request Sep 27, 2021
Fixes sonic-net/sonic-buildimage#8773
Pfcwd regressions were observed due to the changes in the PR sonic-net/sonic-sairedis#878. Hence aligning the polling interval in lua script to use microseconds

**How I verified it**
Ran pfcwd tests that were failing prior to this change and they passed
judyjoseph pushed a commit that referenced this pull request Oct 5, 2021
#878)

According to https://github.com/Azure/SONiC/blob/ec6d35dd2c28491bfade19cfee990fe612f1e5e9/doc/rates-and-utilization/Rates_and_utilization_HLD.md, counterpoll command gives polling interval in milliseconds. 
So when converting them to seconds to be supplied to lua script this should be divide by 1000. However, syncd multiplies it by 1000.

Changed the multiplication to none, and did the converting in lua script - sonic-net/sonic-swss#1855
Fixed issue - sonic-net/sonic-buildimage#8392
raphaelt-nvidia pushed a commit to raphaelt-nvidia/sonic-swss that referenced this pull request Oct 5, 2021
… MS (sonic-net#1855)

**What I did**
Update the rif_rates/lua script to multiply by 1000 instead of FlexCounter class.
related also to this PR - sonic-net/sonic-sairedis#878

Fix issue - sonic-net/sonic-buildimage#8392
**Why I did it**
times were not calculated properly.
**How I verified it**
check that the output of cli and redis is close enough:
raphaelt-nvidia pushed a commit to raphaelt-nvidia/sonic-swss that referenced this pull request Oct 5, 2021
…net#1908)

**What I did**
Converted polling interval from milliseconds to microseconds in PFCWD LUA scripts.

**Why I did it**
PFCWD storm detection and restoration LUA scripts require values in microseconds.
Due to recent changes polling interval is now passed in milliseconds by "FlexCounter".
* sonic-net/sonic-sairedis#878

So need to convert values to microseconds (as it was before) in order to make PFCWD working,

**How I verified it**
Ran PFCWD tests from sonic-mgmt.
raphaelt-nvidia pushed a commit to raphaelt-nvidia/sonic-swss that referenced this pull request Oct 5, 2021
Fixes sonic-net/sonic-buildimage#8773
Pfcwd regressions were observed due to the changes in the PR sonic-net/sonic-sairedis#878. Hence aligning the polling interval in lua script to use microseconds

**How I verified it**
Ran pfcwd tests that were failing prior to this change and they passed
judyjoseph pushed a commit to sonic-net/sonic-swss that referenced this pull request Oct 14, 2021
**What I did**
Converted polling interval from milliseconds to microseconds in PFCWD LUA scripts.

**Why I did it**
PFCWD storm detection and restoration LUA scripts require values in microseconds.
Due to recent changes polling interval is now passed in milliseconds by "FlexCounter".
* sonic-net/sonic-sairedis#878

So need to convert values to microseconds (as it was before) in order to make PFCWD working,

**How I verified it**
Ran PFCWD tests from sonic-mgmt.
volodymyrsamotiy added a commit to volodymyrsamotiy/sonic-swss that referenced this pull request Oct 15, 2021
PFCWD storm detection and restoration LUA scripts require values in microseconds.
Due to recent changes polling interval is now passed in milliseconds by "FlexCounter".
* sonic-net/sonic-sairedis#878

Signed-off-by: Volodymyr Samotiy <volodymyrs@nvidia.com>
pettershao-ragilenetworks pushed a commit to pettershao-ragilenetworks/sonic-sairedis that referenced this pull request Nov 18, 2022
sonic-net#878)

According to https://github.com/Azure/SONiC/blob/ec6d35dd2c28491bfade19cfee990fe612f1e5e9/doc/rates-and-utilization/Rates_and_utilization_HLD.md, counterpoll command gives polling interval in milliseconds. 
So when converting them to seconds to be supplied to lua script this should be divide by 1000. However, syncd multiplies it by 1000.

Changed the multiplication to none, and did the converting in lua script - sonic-net/sonic-swss#1855
Fixed issue - sonic-net/sonic-buildimage#8392
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants