Class: Datadog::Notifications::Plugins::ActiveRecord

Inherits:
Base
  • Object
show all
Defined in:
lib/datadog/notifications/plugins/active_record.rb

Instance Attribute Summary collapse

Attributes inherited from Base

#tags

Instance Method Summary collapse

Constructor Details

#initialize(opts = {}) ⇒ ActiveRecord

Options:

*:metric_name - the metric name, defaults to “activerecord.query” *:include_schema - record schema queries, off by default *:include_generic - record general (nameless) queries, off by default *:tags - additional tags



12
13
14
15
16
17
18
19
20
21
22
# File 'lib/datadog/notifications/plugins/active_record.rb', line 12

def initialize(opts={})
  super
  @metric_name     = opts[:metric_name] || "activerecord.sql"
  @include_schema  = opts[:include_schema] == true
  @include_generic = opts[:include_generic] == true
  @include_raw     = opts[:include_raw] == true

  Datadog::Notifications.subscribe 'sql.active_record' do |reporter, event|
    record reporter, event
  end
end

Instance Attribute Details

#metric_nameObject (readonly)

Returns the value of attribute metric_name.



4
5
6
# File 'lib/datadog/notifications/plugins/active_record.rb', line 4

def metric_name
  @metric_name
end