Extract new Reporter class from ReportsDaemon

What does this MR do and why?

This refactor will support upcoming changes in #370077 (closed).

We currently run a timer thread (ReportsDaemon) which regularly dumps diagnostic reports to disk, which then get uploaded elsewhere. Currently, this class combined two concerns that could be separated to better adhere to the SRP:

  • Running a background thread based on a timer signal
  • Observing and running reports

The latter I have now extracted into a new class Reporter to which the former delegates. This has two primary benefits:

  • The timer thread logic is easier to understand and test
  • The Reporter can be used with other signals that are not timer-based

I also fixed some test smells in the process, such as reports_daemon_spec stubbing methods on the test subject. I used Dependency Injection to fix this.

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #370077 (closed)

Edited by Matthias Käppler

Merge request reports

Loading