Skip to content

Fix issue: non default counters will be delayed forever #138

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

Closed
wants to merge 2 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 11 additions & 12 deletions dockers/docker-orchagent/enable_counters.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
DEFAULT_ALPHA = '0.18'


def enable_counter_group(db, name):
def enable_counter_group(db, name, enable_by_default=True):
entry_info = db.get_entry("FLEX_COUNTER_TABLE", name)

if not entry_info:
if (not entry_info) and enable_by_default:
Copy link
Collaborator

Choose a reason for hiding this comment

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

why need this judgment? will it be simple to remove it?

info = {}
info['FLEX_COUNTER_STATUS'] = 'enable'
db.mod_entry("FLEX_COUNTER_TABLE", name, info)
Expand All @@ -38,16 +38,15 @@ def enable_rates():
def enable_counters():
db = swsssdk.ConfigDBConnector()
db.connect()
enable_counter_group(db, 'PORT')
enable_counter_group(db, 'RIF')
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')
enable_counter_group(db, 'ACL')
default_enabled_counters = ['PORT', 'RIF', 'QUEUE', 'PFCWD', 'PG_WATERMARK', 'PG_DROP',
'QUEUE_WATERMARK', 'BUFFER_POOL_WATERMARK', 'PORT_BUFFER_DROP', 'ACL']

keys = db.get_keys('FLEX_COUNTER_TABLE')
for key in keys:
if key in default_enabled_counters:
enable_counter_group(db, key)
else:
enable_counter_group(db, key, enable_by_default=False)
enable_rates()


Expand Down