Created
July 6, 2017 14:58
-
-
Save thijsc/2ea4125fddc06ec454b766637671d9ba to your computer and use it in GitHub Desktop.
Sequel standalone example
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
source 'https://rubygems.org' | |
gem 'sequel' | |
gem 'sqlite3' | |
gem 'appsignal' |
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
require 'sequel' | |
require 'appsignal' | |
require 'fileutils' | |
ENV['APPSIGNAL_ACTIVE'] = 'true' | |
ENV['APPSIGNAL_APP_NAME'] = 'Sequel standalone' | |
ENV['APPSIGNAL_APP_ENV'] = 'development' | |
ENV['APPSIGNAL_PUSH_API_KEY'] = 'key' | |
Appsignal.start_logger | |
Appsignal.start | |
FileUtils.rm_f('database.db') | |
DB = Sequel.connect('sqlite://database.db') | |
DB.run("create table t (a text, b text)") | |
DB.run("insert into t values ('a', 'b')") | |
Appsignal.monitor_single_transaction( | |
"perform_job.query", | |
:class => "App", | |
:method => "perform" | |
) do | |
sleep 4 | |
puts DB["select * from t"].to_a | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment