Skip to content
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

Change sai log level before discovery to prevent SAI ERR spam to the log #316

Merged
merged 14 commits into from
May 14, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
14 commits
Select commit Hold shift + click to select a range
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
15 changes: 15 additions & 0 deletions syncd/syncd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3054,6 +3054,21 @@ void set_sai_api_loglevel()
}
}

void set_sai_api_log_min_prio(const std::string &prioStr)
{
SWSS_LOG_ENTER();

/*
* We start from 1 since 0 is SAI_API_UNSPECIFIED.
*/

for (uint32_t idx = 1; idx < sai_metadata_enum_sai_api_t.valuescount; ++idx)
{
const auto& api_name = sai_metadata_enum_sai_api_t.valuesnames[idx];
saiLoglevelNotify(api_name, prioStr);
}
}

void performWarmRestart()
{
SWSS_LOG_ENTER();
Expand Down
3 changes: 3 additions & 0 deletions syncd/syncd.h
Original file line number Diff line number Diff line change
Expand Up @@ -113,4 +113,7 @@ sai_status_t processBulkEvent(
_In_ sai_common_api_t api,
_In_ const swss::KeyOpFieldsValuesTuple &kco);

void set_sai_api_log_min_prio(
_In_ const std::string &prio);

#endif // __SYNCD_H__
3 changes: 2 additions & 1 deletion syncd/syncd_saiswitch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -937,8 +937,9 @@ void SaiSwitch::helperDiscover()

{
SWSS_LOG_TIMER("discover");

set_sai_api_log_min_prio("SAI_LOG_LEVEL_CRITICAL");
Copy link
Collaborator

Choose a reason for hiding this comment

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

why this is critical ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

because otherwise sai will dump to syslog many thousands of the error messages "something not found" when syncd discover sai api". Output to syslog seriously hits cpu which increases fast-reboot time

Copy link
Collaborator

Choose a reason for hiding this comment

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

there is nothing that produces critical message, so nothing would be logged except maybe something from internal sai
i would propose to log SAI_STATUS_NOT_IMPLEMENTED (which is the most errors probably) as info message in discovery method, instead of disabling all messages in this way

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi Kamil,

Yes. I made that level CRITICAL because no messages are produced by SAI on syncd discovery.
I had a patch making SAI_STATUS_NOT_IMPLEMENTED as INFO in SAI. I'm not sure it's still there.

Copy link
Collaborator

Choose a reason for hiding this comment

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

yea that would be better approach, so other meaningfull errors if present they still would be logged

saiDiscover(m_switch_rid, m_discovered_rids);
set_sai_api_log_min_prio("SAI_LOG_LEVEL_NOTICE");
}

SWSS_LOG_NOTICE("discovered objects count: %zu", m_discovered_rids.size());
Expand Down