-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add config option to suppress automatically starting the reporter (#185)
* Add config option to suppress automatically starting the reporter This can avoid issues in some applications where additional setup is needed before safely starting the reporter. Specifically, we had a customer who was configuring their Sidekiq Redis connection in `after_initialize`, and our reporter was starting (and attempting to fetch Sidekiq metrics from Redis) before Sidekiq was fully configured. * Create config_test.rb
- Loading branch information
Showing
4 changed files
with
32 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
require "judoscale/config" | ||
|
||
module Judoscale | ||
module Rails | ||
module Config | ||
attr_accessor :start_reporter_after_initialize | ||
|
||
def reset | ||
super | ||
@start_reporter_after_initialize = true | ||
end | ||
end | ||
|
||
::Judoscale::Config.prepend Config | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# frozen_string_literal: true | ||
|
||
require "test_helper" | ||
require "judoscale/rails/config" | ||
|
||
module Judoscale | ||
describe Judoscale::Rails::Config do | ||
it "adds the start_reporter_after_initialize config option" do | ||
_(::Judoscale::Config.instance.start_reporter_after_initialize).must_equal true | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters