Created
July 12, 2024 19:32
-
-
Save stympy/b4e2eac9687d322c3d7886f7c9d92125 to your computer and use it in GitHub Desktop.
Filtering and truncating SQL before reporting to Insights
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/initializers/honeybadger.rb | |
Honeybadger.configure do |config| | |
config.before_event do |event| | |
# DB-backed job backends can generate a lot of useless queries | |
if event.event_type == "sql.active_record" && event[:query]&.match?(/good_job|solid_queue/) | |
event.halt! | |
end | |
# Truncate long queries | |
if event.event_type == "sql.active_record" && event[:query].present? | |
event[:query] = event[:query].first(256) | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment