Skip to content

Commit

Permalink
[counter]: add support to enable/disable counter query (sonic-net#511)
Browse files Browse the repository at this point in the history
Signed-off-by: Sihui Han <sihan@microsoft.com>
  • Loading branch information
sihuihan88 authored and pavel-shirshov committed Jun 19, 2018
1 parent 6189eaa commit 98ad0bd
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions orchagent/flexcounterorch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ unordered_map<string, string> flexCounterGroupMap =
{"QUEUE", QUEUE_STAT_COUNTER_FLEX_COUNTER_GROUP},
};


FlexCounterOrch::FlexCounterOrch(DBConnector *db, vector<string> &tableNames):
Orch(db, tableNames),
m_flexCounterDb(new DBConnector(FLEX_COUNTER_DB, DBConnector::DEFAULT_UNIXSOCKET, 0)),
Expand Down Expand Up @@ -61,13 +62,22 @@ void FlexCounterOrch::doTask(Consumer &consumer)
const auto &field = fvField(valuePair);
const auto &value = fvValue(valuePair);

if (field == POLL_INTERVAL_FIELD)
if (field == POLL_INTERVAL_FIELD)
{
vector<FieldValueTuple> fieldValues;
fieldValues.emplace_back(POLL_INTERVAL_FIELD, value);
m_flexCounterGroupTable->set(flexCounterGroupMap[key], fieldValues);
}
/* In future add the support to disable/enable counter query here.*/
else if(field == FLEX_COUNTER_STATUS_FIELD)
{
vector<FieldValueTuple> fieldValues;
fieldValues.emplace_back(FLEX_COUNTER_STATUS_FIELD, value);
m_flexCounterGroupTable->set(flexCounterGroupMap[key], fieldValues);
}
else
{
SWSS_LOG_NOTICE("Unsupported field %s", field.c_str());
}
}
}

Expand Down

0 comments on commit 98ad0bd

Please sign in to comment.