Skip to content

Instantly share code, notes, and snippets.

@thbar
Created February 26, 2010 16:53
Show Gist options
  • Save thbar/315893 to your computer and use it in GitHub Desktop.
Save thbar/315893 to your computer and use it in GitHub Desktop.
# White-list based approach to only log what's relevant
# in Resque Hoptoad notifications.
#
# Disclaimer: this is provided as-is. Write your own tests.
# I can't be held responsible if this code still logs sensitive
# information into HopToad or contains bugs or whatever.
#
# This assume a single Hash arg for the Job. Example of use:
Resque::Failure::SensitiveHoptoad.configure do |config|
config.enabled_args = ['unsensitive-information']
end
Resque.enqueue(self, { 'unsensitive-information' => filename, 'sensitive-info' => data })
module Resque
module Failure
class SensitiveHoptoad < Hoptoad
class << self
attr_accessor :enabled_args
end
def payload
hash_arg = super['args'].first
args = self.class.enabled_args.inject({}) { |result,arg| result[arg] = hash_arg[arg]; result }
super.dup.merge('args' => [args])
end
end
end
end
@defunkt
Copy link

defunkt commented May 17, 2011

This gist is probably outdated due to the new hoptoad changes in Resque. I've removed it from the wiki — please feel free to re-add if I'm mistaken or once it's updated. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment