Class: HoneycombGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- HoneycombGenerator
- Defined in:
- lib/generators/honeycomb/honeycomb_generator.rb
Overview
Generates an intializer for configuring the Honeycomb beeline
Instance Method Summary collapse
Instance Method Details
#create_initializer_file ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/generators/honeycomb/honeycomb_generator.rb', line 20 def create_initializer_file initializer "honeycomb.rb" do " Honeycomb.configure do |config|\n config.write_key = \#{write_key.inspect}\n config.service_name = \#{options['service_name'].inspect}\n config.presend_hook do |fields|\n if fields[\"name\"] == \"redis\" && fields.has_key?(\"redis.command\")\n # remove potential PII from the redis command\n if fields[\"redis.command\"].respond_to? :split\n fields[\"redis.command\"] = fields[\"redis.command\"].split.first\n end\n end\n if fields[\"name\"] == \"sql.active_record\"\n # remove potential PII from the active record events\n fields.delete(\"sql.active_record.binds\")\n fields.delete(\"sql.active_record.type_casted_binds\")\n end\n end\n config.notification_events = %w[\n sql.active_record\n render_template.action_view\n render_partial.action_view\n render_collection.action_view\n process_action.action_controller\n send_file.action_controller\n send_data.action_controller\n deliver.action_mailer\n ].freeze\n end\n RUBY\n end\nend\n".strip_heredoc |