Sha256: c896d2124604718c4ce8f61d62f4dcfb784eb8fd9ddf77eb3794f5f47686859e

Contents?: true

Size: 793 Bytes

Versions: 1

Compression:

Stored size: 793 Bytes

Contents

DependencyDetection.defer do
  named :slack_ruby_bot

  depends_on do
    !::NewRelic::Agent.config[:disable_slack_ruby_bot]
  end

  depends_on do
    defined?(::SlackRubyBot::VERSION)
  end

  executes do
    NewRelic::Agent.logger.info 'Installing SlackRubyBot instrumentation'
    instrument_call
  end

  def instrument_call
    ::SlackRubyBot::Hooks::Message.class_eval do
      include ::NewRelic::Agent::Instrumentation::ControllerInstrumentation

      def message_with_new_relic(client, data)
        perform_action_with_newrelic_trace(name: 'call', category: 'OtherTransaction/Slack') do
          message_without_new_relic(client, data)
        end
      end

      alias_method :message_without_new_relic, :call
      alias_method :call, :message_with_new_relic
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
newrelic-slack-ruby-bot-0.2.0 lib/newrelic-slack-ruby-bot/instrumentation.rb