forked from newrelic/newrelic-ruby-agent
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinit.rb
31 lines (24 loc) · 1012 Bytes
/
init.rb
1
2
3
4
5
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
# This is the initialization for the New Relic Ruby Agent when used as
# a plugin
require 'new_relic/control'
# If you are having problems seeing data, be sure and check the
# newrelic_agent.log files in the log diretory of your application
#
# If you can't find any log files and you don't see anything in your
# application log files, try uncommenting the two lines at the
# bottom of this file to verify the plugin is being loaded,
# then send the output to [email protected] if you are unable to
# resolve the issue.
# Initializer for the NewRelic Ruby Agent
# After verison 2.0 of Rails we can access the configuration directly.
# We need it to add dev mode routes after initialization finished.
begin
current_config = if defined?(config)
config
elsif defined?(Rails.configuration)
Rails.configuration
end
NewRelic::Control.instance.init_plugin :config => current_config
rescue => e
::NewRelic::Agent.logger.error "Error initializing New Relic plugin. Agent is disabled.", e
end