Skip to content
Snippets Groups Projects

Introduce multiple Monitor support for the Watchdog

Merged Nikola Milojevic requested to merge watchdog_monitors into master

What does this MR do and why?

This MR extracts Monitoring logic from Watchdog.

This allows us to introduce multiple monitors to run within the watchdog.

We can even enable experimental monitors directly in the initializer and have different ones for Puma and Sidekiq.

Configuration:

 watchdog = Gitlab::Memory::Watchdog.new
  watchdog.configure do |config|
    config.handler = Gitlab::Memory::Watchdog::NullHandler.instance
    config.sleep_time_seconds = 30

    # config.monitor.use MonitorClass, args**, &block
    config.monitor.use Gitlab::Memory::Watchdog::Monitors::HeapFragmentationMonitor
    config.monitor.use Gitlab::Memory::Watchdog::Monitors::MemoryGrowthMonitor
  end
  
Gitlab::BackgroundTask.new(watchdog).start

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: #379196 (closed)

Edited by Nikola Milojevic

Merge request reports

Merged results pipeline #668470304 passed with warnings

Pipeline: GitLab

#668476294

    Pipeline: GitLab

    #668477647

      Merged results pipeline passed with warnings for 809fbbf8

      Test coverage 98.04% from 1 job

      Merged by Bob Van LanduytBob Van Landuyt 2 years ago (Oct 17, 2022 9:52am UTC)

      Loading

      Pipeline #668527311 passed

      Pipeline passed for cc3e2210 on master

      Test coverage 71.65% from 1 job
      10 environments impacted.

      Activity

      Filter activity
      • Approvals
      • Assignees & reviewers
      • Comments (from bots)
      • Comments (from users)
      • Commits & branches
      • Edits
      • Labels
      • Lock status
      • Mentions
      • Merge request status
      • Tracking
      Please register or sign in to reply
      Loading