Created
March 17, 2025 12:31
-
-
Save shairyar/a588c6600795b85bcb7da342d5545a6c to your computer and use it in GitHub Desktop.
Using Ruby script to start AppSignal
This file contains hidden or 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
# Requirements: | |
# bundle install | |
# bundle exec ruby app.rb | |
# app.rb | |
require "appsignal" | |
# Configure appsignal if needed | |
Appsignal.configure do |config| | |
# config.<option> = value | |
end | |
Appsignal.start | |
at_exit { Appsignal.stop } | |
loop do | |
print "." | |
sleep 1 | |
end |
%w[INT TERM].each do |signal|
old_handler = Signal.trap(signal) do
Appsignal.stop
if old_handler.respond_to?(:call)
old_handler.call
else
exit
end
end
end
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I also have