Skip to content

Update lua script to convert poll_interval to MS#1855

Merged
qiluo-msft merged 2 commits intosonic-net:masterfrom
noaOrMlnx:rif_lua_delta_fix
Sep 3, 2021
Merged

Update lua script to convert poll_interval to MS#1855
qiluo-msft merged 2 commits intosonic-net:masterfrom
noaOrMlnx:rif_lua_delta_fix

Conversation

@noaOrMlnx
Copy link
Collaborator

@noaOrMlnx noaOrMlnx commented Aug 5, 2021

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:

admin@sonic:~$ show interfaces counters rif -p 5
The rates are calculated within 5 seconds period
    IFACE    RX_OK     RX_BPS    RX_PPS    RX_ERR    TX_OK    TX_BPS    TX_PPS    TX_ERR
---------  -------  ---------  --------  --------  -------  --------  --------  --------
Ethernet0        5  83.90 B/s    1.00/s         1        0  0.00 B/s    0.00/s         0
127.0.0.1:6379[2]> hgetall RATES:oid:0x6000000000d9d
 1) "SAI_ROUTER_INTERFACE_STAT_IN_OCTETS_last"
 2) "3948"
 3) "SAI_ROUTER_INTERFACE_STAT_IN_PACKETS_last"
 4) "47"
 5) "SAI_ROUTER_INTERFACE_STAT_OUT_OCTETS_last"
 6) "0"
 7) "SAI_ROUTER_INTERFACE_STAT_OUT_PACKETS_last"
 8) "0"
 9) "RX_BPS"
10) "77.634107320096575"
11) "RX_PPS"
12) "0.92421556333448329"
13) "TX_BPS"
14) "0"
15) "TX_PPS"
16) "0"

before the change:

admin@sonic:~$ show interfaces  counters rif -p 5
The rates are calculated within 5 seconds period
     IFACE    RX_OK       RX_BPS     RX_PPS    RX_ERR    TX_OK    TX_BPS    TX_PPS    TX_ERR
----------  -------  -----------  ---------  --------  -------  --------  --------  --------
Ethernet0        0     0.00 B/s     0.00/s         0        0  0.00 B/s    0.00/s         0
Ethernet28   29,894  501.05 KB/s  5964.85/s         1        0  0.00 B/s    0.00/s         0
127.0.0.1:6379[2]> hgetall "RATES:oid:0x6000000000517"
1) "SAI_ROUTER_INTERFACE_STAT_IN_OCTETS_last"
2) "17856552"
3) "SAI_ROUTER_INTERFACE_STAT_IN_PACKETS_last"
4) "212578"
5) "SAI_ROUTER_INTERFACE_STAT_OUT_OCTETS_last"
6) "0"
7) "SAI_ROUTER_INTERFACE_STAT_OUT_PACKETS_last"
8) "0"
9) "RX_BPS"
10) "67.774654124880783"
11) "RX_PPS"
12) "0.80684145386762807"
13) "TX_BPS"
14) "0"
15) "TX_PPS"
16) "0"

Details if related

@liat-grozovik
Copy link
Collaborator

@dgsudharsan and @prsunny could you please review?

Copy link
Collaborator

@dgsudharsan dgsudharsan left a comment

Choose a reason for hiding this comment

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

Can you please modify port_rates.lua?

@noaOrMlnx
Copy link
Collaborator Author

@dgsudharsan Done

dgsudharsan
dgsudharsan previously approved these changes Aug 16, 2021
@liat-grozovik
Copy link
Collaborator

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@liat-grozovik
Copy link
Collaborator

@dgsudharsan and @prsunny can you please help to review and approve?
we would like to have the fix in 202012

qiluo-msft pushed a commit to sonic-net/sonic-sairedis 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-sairedis 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
@liat-grozovik
Copy link
Collaborator

@prsunny kindly reminder.

@prsunny prsunny requested a review from qiluo-msft September 2, 2021 21:16
@qiluo-msft qiluo-msft merged commit 62f7200 into sonic-net:master Sep 3, 2021
qiluo-msft pushed a commit 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:
judyjoseph pushed a commit 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:
judyjoseph pushed a commit to sonic-net/sonic-sairedis 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:
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
Janetxxx pushed a commit to Janetxxx/sonic-swss that referenced this pull request Nov 10, 2025
… 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:
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