Skip to content

Commit

Permalink
Fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
jrothrock committed Apr 26, 2024
1 parent 1e7143a commit d143461
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 8 deletions.
4 changes: 2 additions & 2 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
AllCops:
Exclude:
- "bin/*"
- "tmp/**/*"
- "vendor/**/*"
- "spec/spec_helper.rb"
- "gems/*"
NewCops: disable
TargetRubyVersion: 2.6

Expand Down
3 changes: 2 additions & 1 deletion lib/scout_apm/logging/monitor/monitor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,14 @@

module ScoutApm
module Logging
# Entry point for the monitor daemon process.
class Monitor
def run
add_exit_handler

loop do
sleep 1
puts "Running..."
puts 'Running...'
end
end

Expand Down
4 changes: 2 additions & 2 deletions lib/scout_apm/logging/monitor_manager.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

module ScoutApm
module Logging
# Manages the creation of the daemon monitor process.
class MonitorManager
PID_FILE = '/tmp/scout_apm_log_monitor.pid'

Expand All @@ -13,7 +14,6 @@ def self.create_process
return if File.exist? PID_FILE

gem_directory = File.expand_path('../../..', __dir__)

Process.spawn("ruby #{gem_directory}/bin/scout_apm_logging_monitor &")
daemon_process = `pgrep -f scout_apm_logging_monitor`.to_i

Expand All @@ -23,4 +23,4 @@ def self.create_process
end
end
end
end
end
4 changes: 3 additions & 1 deletion lib/scout_apm_logging.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@
require 'scout_apm/logging/monitor_manager'

module ScoutApm
## This module is responsible for setting up monitoring of the application's logs.
module Logging
if defined?(Rails) && defined?(Rails::Railtie)
# If we are in a Rails environment, setup the monitor daemon manager.
class RailTie < ::Rails::Railtie
initializer "scout_apm_logging.monitor" do
initializer 'scout_apm_logging.monitor' do
ScoutApm::Logging::MonitorManager.setup!
end
end
Expand Down
2 changes: 1 addition & 1 deletion spec/scout_apm_logging_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
make_basic_app
end

it "checks lifecycle of the daemon process" do
it 'checks lifecycle of the daemon process' do
# Check if the PID file exists
expect(File.exist?(ScoutApm::Logging::MonitorManager::PID_FILE)).to be_truthy

Expand Down
2 changes: 1 addition & 1 deletion spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@ def self.name; "RailtiesTestApp"; end

require "rack/test"
extend ::Rack::Test::Methods
end
end

0 comments on commit d143461

Please sign in to comment.