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

Documents: Debug Framework Design Spec #398

Merged
merged 4 commits into from
Dec 17, 2019

Conversation

anilsadineni
Copy link
Contributor

  • A framework that allows components to register and dump running snapshots of component internals using dump routines.
  • Handle assert conditions to collect more info.

Signed-off-by: Anil Sadineni anil.sadineni@broadcom.com

* A framework that allows components to register and dump running snapshots of component internals using dump routines.
* Handle assert conditions to collect more info.

Signed-off-by: Anil Sadineni anil.sadineni@broadcom.com
- Within the function, dump the information into a string buffer and use a macro `SWSS_DEBUG_PRINT`. Macro will further process the information based on intended framework action. Wrap the function that uses multiple invocations of `SWSS_DEBUG_PRINT` with `SWSS_DEBUG_PRINT_BEGIN` and `SWSS_DEBUG_PRINT_END`.
- Handle KeyOpFieldsValuesTuple as argument. Arguments like dumpType and pass thru arguments that instruct the level of info dump ( short summary/specific info/filtered output/full info) should be handled by components. These arguments are opaque to framework. Additional optional arguments like output location and post-actions are for the framework consumption.
- Interpreting arguments is at discretion of components. Components may choose to dump same info for all trigger types ignoring input arguments.
- Dump routines registered with framework should be thread safe. Necessary synchronization needs to be ensured.
Copy link
Contributor

Choose a reason for hiding this comment

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

orchagent is single thread application, it has no lock. how are you going to make the dump routine to be thread safe?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If any application is not thread safe we recommend to use option #2 to link with framework. In our pilot implementation for dump routines of we chose option #2 for orchagent



**Implementation brief**
Framework will be implemented in C++ as a class in SWSS namespace.
Copy link
Contributor

@lguohan lguohan Jul 23, 2019

Choose a reason for hiding this comment

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

how to open source project which are not written in C++, for example dhcp relay which is written in C, or go such as telemetry component, or python program?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good question. For python programs SWIG will help us. Check pyext folder for interface file definition.

For C, yes we need to write wrapper functions.

|-------------------------------|-------------------------------------------------------------------------------|
|show debug all | This command will invoke dump routines for all components with default action |
|show debug < component > | This command will invoke dump routine for specific component |
|show debug actions < options > | This command will display the configured framework actions |
Copy link
Contributor

Choose a reason for hiding this comment

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

how do we know all the component that has such debug capability? is there a command for that?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

component owner trying to debug his component will enter component name so that the trigger to dump will be specific to the component specified. If the admin is trying to collect debug information and has no knowledge of registered components he may consider show debug all.

If its an engineer but not component owner who is trying to figure out the registered components he can query Redis DB for the registered component list using redis-cli and then proceed with the trigger.

|show debug actions < options > | This command will display the configured framework actions |

### 3.3.2 Debug/Error Interface counters
show interfaces pktdrop is added to display debug/error counters for all interfaces.
Copy link
Contributor

Choose a reason for hiding this comment

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

how is this different from the portstat command line currently we have?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The initial thought was to fetch more errors and counters from the asic but this is not a framework item and very asic dependent hence dropped it. Shall remove in next version.

anilsadineni added a commit to anilsadineni/sonic-swss-common that referenced this pull request Aug 26, 2019
These changes along with changes in sonic-utilities are needed to test
the framework
The code is inline with design from:
sonic-net/SONiC#398
@xinliu-seattle xinliu-seattle merged commit e93610d into sonic-net:master Dec 17, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants