Skip to content

Commit

Permalink
add descriptive comment
Browse files Browse the repository at this point in the history
Signed-off-by: Mykola Faryma <[email protected]>
  • Loading branch information
Mykola Faryma committed Aug 12, 2020
1 parent cfb5cca commit b5eafea
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion dockers/docker-orchagent/enable_counters.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
import swsssdk
import time

# ALPHA defines the size of the window over which we calculate the average value. ALPHA is 2/(N+1) where N is the interval(window size)
# In this case we configure the window to be 10s. This way if we have a huge 1s spike in traffic,
# the average rate value will show a curve descending from the spike to the usual rate over approximately 10s.
DEFAULT_SMOOTH_INTERVAL = '10'
DEFAULT_ALPHA = '0.18'

Expand All @@ -12,7 +15,7 @@ def enable_counter_group(db, name):
db.mod_entry("FLEX_COUNTER_TABLE", name, info)

def enable_rates():
# set the default interval for rates (N) as 10s, alpha is 2/(N+1)
# set the default interval for rates
counters_db = swsssdk.SonicV2Connector()
counters_db.connect('COUNTERS_DB')
counters_db.set('COUNTERS_DB', 'RATES:PORT', 'PORT_SMOOTH_INTERVAL', DEFAULT_SMOOTH_INTERVAL)
Expand Down

0 comments on commit b5eafea

Please sign in to comment.