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(metric_name: 'activerecord.sql', **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

[View source]

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

def initialize(metric_name: 'activerecord.sql', **opts)
  super

  @metric_name     = metric_name
  @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.


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

def metric_name
  @metric_name
end