Skip to content

[system/process] add support for mutlierr #172

Merged
VihasMakwana merged 1 commit intomainfrom
revert-169-revert-non-fatal
Aug 1, 2024
Merged

[system/process] add support for mutlierr #172
VihasMakwana merged 1 commit intomainfrom
revert-169-revert-non-fatal

Conversation

@VihasMakwana
Copy link
Copy Markdown
Contributor

@VihasMakwana VihasMakwana commented Aug 1, 2024

What does this PR do?

  • Previously, we weren't passing errors to the caller while monitoring set of processes.
    • With the recent introduction of the status reporter for metricsets, it is impossible to change the status to degraded if such errors are not passed to the caller.
  • Fix this by passing errors to the caller. We also populate the process related information to our best-effort.

Checklist

  • My code follows the style guidelines of this project
  • I have commented my code, particularly in hard-to-understand areas
  • I have added tests that prove my fix is effective or that my feature works
  • I have added an entry in CHANGELOG.md

Manual testing and general information

Steps:

  • While receiving any error, test for nature of error
  • call errors.Is(err, NonFatalErr{})) on received error
    • If true, error is non-fatal and you can proceed further (metrics will be partially available, most probably insufficient privileges).
    • Else, log the error and stop execution (metrics will be empty)

Genreal info related to the changes in this PR:

  • While getting process related information, you might also receive a non-nil error.

  • Such errors come in two flavours:

    • Fatal errors:
      • This indicates that the error was fatal (for eg. no process found,)
      • Caller should stop further execution if they receive fatal errors
    • Non-fatal errors:
      • This indicates that the error was non-fatal (for eg. not enough privileges).
      • It means that metrics are partially filled.
      • Further execution can be continued if non-fatal errors are encountered
  • Closes [metric/system/process] - return errors encountered while monitoring set of processes #164

@VihasMakwana VihasMakwana added enhancement New feature or request Team:Elastic-Agent-Data-Plane Label for the Agent Data Plane team breaking-change labels Aug 1, 2024
@VihasMakwana VihasMakwana requested a review from a team as a code owner August 1, 2024 11:44
@VihasMakwana VihasMakwana requested review from AndersonQ, leehinman and rdner and removed request for a team and leehinman August 1, 2024 11:44
Copy link
Copy Markdown
Member

@rdner rdner left a comment

Choose a reason for hiding this comment

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

Due to the nature of the change, we need to perform manual tests in order to ensure the change works. Please add instructions for manual testing to ensure updating to the new version of this library would not break Beats.

@VihasMakwana
Copy link
Copy Markdown
Contributor Author

@rdner I've added the beats PR link in description

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking-change enhancement New feature or request Team:Elastic-Agent-Data-Plane Label for the Agent Data Plane team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[metric/system/process] - return errors encountered while monitoring set of processes

2 participants