Last active
October 2, 2020 16:33
-
-
Save ngelx/5051f14633a565526d6be7adaa3a4a41 to your computer and use it in GitHub Desktop.
Setting Rollbar as notification for query_track gem
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
# config/initializer/query_track.rb | |
# query_track: https://github.com/kirillshevch/query_track | |
# rollbar: https://docs.rollbar.com/docs/rails | |
QueryTrack::Settings.configure do |config| | |
config.duration = 1 # in seconds | |
config.notifications.custom_handler = lambda do |sql, duration, trace| | |
e = Exception.new("Slow SQL Query - #{trace}") | |
e.set_backtrace(trace) | |
Rollbar.warn(e, duration: duration, sql: sql) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment