Class: Honeybadger::Breadcrumbs::ActiveSupport

Inherits:
Object
  • Object
show all
Defined in:
lib/honeybadger/breadcrumbs/active_support.rb

Class Method Summary collapse

Class Method Details

.default_notificationsObject



6
7
8
9
10
11
12
13
14
15
16
17
18
19
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
# File 'lib/honeybadger/breadcrumbs/active_support.rb', line 6

def self.default_notifications
  {
    # ActiveRecord Actions
    #
    "sql.active_record" => {
      message: lambda do |data|
        # Disregard empty string names
        name = data[:name] if data[:name] && !data[:name].strip.empty?

        ["Active Record", name].compact.join(" - ")
      end,
      category: "query",
      select_keys: [:sql, :name, :connection, :connection_id, :cached],
      transform: lambda do |data|
        if data[:sql]
          connection = data.delete(:connection)
          adapter = (connection && connection.adapter_name.downcase) || active_record_connection_db_config[:adapter]
          data[:sql] = Util::SQL.obfuscate(data[:sql], adapter)
        end
        data
      end,
      exclude_when: lambda do |data|
        # Ignore schema, begin, and commit transaction queries
        data[:name] == "SCHEMA" ||
          (data[:sql] && (Util::SQL.force_utf_8(data[:sql].dup) =~ /^(begin|commit)( transaction)?$/i))
      end
    },

    # ActionCable Actions
    #
    "perform_action.action_cable" => {
      message: "Action Cable Perform Action",
      select_keys: [:channel_class, :action],
      category: "render"
    },

    # ActiveJob Actions
    #
    "enqueue.active_job" => {
      message: "Active Job Enqueue",
      select_keys: [],
      category: "job"
    },
    "perform_start.active_job" => {
      message: "Active Job Perform Start",
      select_keys: [],
      category: "job",
    },

    # ActiveSupport Actions
    #
    "cache_read.active_support" => {
      message: "Active Support Cache Read",
      category: "query"
    },
    "cache_fetch_hit.active_support" => {
      message: "Active Support Cache Fetch Hit",
      category: "query"
    },

    # Controller Actions
    #
    "halted_callback.action_controller" => {
      message: "Action Controller Callback Halted",
      category: "request",
    },
    "process_action.action_controller" => {
      message: "Action Controller Action Process",
      select_keys: [:controller, :action, :format, :method, :path, :status, :view_runtime, :db_runtime],
      category: "request",
    },
    "start_processing.action_controller" => {
      message: "Action Controller Start Process",
      select_keys: [:controller, :action, :format, :method, :path],
      category: "request",
    },
    "redirect_to.action_controller" => {
      message: "Action Controller Redirect",
      category: "request",
    },

    # View Actions
    #
    "render_template.action_view" => {
      message: "Action View Template Render",
      category: "render",
    },
    "render_partial.action_view" => {
      message: "Action View Partial Render",
      category: "render",
    },

    # Mailer actions
    #
    "deliver.action_mailer" => {
      message: "Action Mailer Deliver",
      select_keys: [:mailer, :message_id, :from, :date],
      category: "render"
    }
  }
end