class Object

Public Class Methods

call_command(client, data, match, block)
call_command_with_new_relic(client, data, match, block) click to toggle source
# File lib/newrelic-slack-ruby-bot/instrumentation.rb, line 55
def call_command_with_new_relic(client, data, match, block)
  ::NewRelic::Agent.set_transaction_name("#{self}/#{command_name(match)}")
  if match.respond_to?(:names) && match.respond_to?(:captures)
    ::NewRelic::Agent
      .add_custom_attributes(
        Hash[match.names.map(&:to_sym).zip(match.captures)]
      )
  end
  call_command_without_new_relic(client, data, match, block)
end
Also aliased as: call_command
call_command_without_new_relic(client, data, match, block)
Alias for: call_command
command_name(match) click to toggle source
# File lib/newrelic-slack-ruby-bot/instrumentation.rb, line 41
def command_name(match)
  if match.respond_to?(:names) && match.respond_to?(:[])
    if match.names.include? 'command'
      match[:command].downcase
    elsif match.names.include? 'operator'
      match[:operator].downcase
    else
      'match'
    end
  else
    'scan'
  end
end

Public Instance Methods

message_with_new_relic(client, data) click to toggle source
# File lib/newrelic-slack-ruby-bot/instrumentation.rb, line 22
def message_with_new_relic(client, data)
  perform_action_with_newrelic_trace(name: 'call', category: 'OtherTransaction/Slack') do
    ::NewRelic::Agent.add_custom_attributes(
      team: data.team,
      channel: data.channel,
      user: data.user
    )
    message_without_new_relic(client, data)
  end
end