Skip to content

Commit

Permalink
Enable PG drop counters by default, set default values only on the fi…
Browse files Browse the repository at this point in the history
…rst start (#10935)

Signed-off-by: Andriy Yurkiv <ayurkiv@nvidia.com>

Backport form master
Appropriate PR on master: #7735
Appropriate PR on master #6444

Why I did it
PG drop counters should be enabled by default (merge from master)
After "config reload" or "docker swss restart" all counters were enabled even if they were disabled before

How I did it
1)Add PG drop counter enable option to dockers/docker-orchagent/enable_counters.py
2) Check if entry already exist before set default values

How to verify it
- install image and run counterpoll show CLI command and then you will see PG_STAT_DROP enabled
- Disable few counters
    counterpoll pg-drop disable
    counterpoll port disable
- Save and reload
   config save
   config reload
- Check enable status
  • Loading branch information
ayurkiv-nvda committed Jun 22, 2022
1 parent 02e0aff commit 38eef91
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions dockers/docker-orchagent/enable_counters.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,12 @@
import time

def enable_counter_group(db, name):
info = {}
info['FLEX_COUNTER_STATUS'] = 'enable'
db.mod_entry("FLEX_COUNTER_TABLE", name, info)
entry_info = db.get_entry("FLEX_COUNTER_TABLE", name)

if not entry_info:
info = {}
info['FLEX_COUNTER_STATUS'] = 'enable'
db.mod_entry("FLEX_COUNTER_TABLE", name, info)

def enable_counters():
db = swsssdk.ConfigDBConnector()
Expand All @@ -15,6 +18,7 @@ def enable_counters():
enable_counter_group(db, 'QUEUE')
enable_counter_group(db, 'PFCWD')
enable_counter_group(db, 'PG_WATERMARK')
enable_counter_group(db, 'PG_DROP')
enable_counter_group(db, 'QUEUE_WATERMARK')
enable_counter_group(db, 'BUFFER_POOL_WATERMARK')
enable_counter_group(db, 'PORT_BUFFER_DROP')
Expand Down

0 comments on commit 38eef91

Please sign in to comment.