forked from newrelic/newrelic-ruby-agent
-
Notifications
You must be signed in to change notification settings - Fork 0
/
init.rb
27 lines (20 loc) · 833 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
require 'yaml'
require 'seldon/agent'
# Initializer for the Seldon Agent
seldon_config_file = File.read(RAILS_ROOT+"/config/seldon.yml")
seldon_agent_config = YAML.load(seldon_config_file)[RAILS_ENV]
seldon_agent_config.freeze
::SELDON_AGENT_ENABLED = seldon_agent_config['enabled']
::SELDON_DEVELOPER = seldon_agent_config['enabled'] && seldon_agent_config['developer']
if ::SELDON_AGENT_ENABLED
require 'seldon/agent/instrument_rails'
::SELDON_HOST = seldon_agent_config['host']
::SELDON_PORT = seldon_agent_config['port']
Seldon::Agent.instance.start(seldon_agent_config)
if ::SELDON_DEVELOPER
controller_path = File.join(File.dirname(__FILE__), 'ui', 'controllers')
$LOAD_PATH << controller_path
Dependencies.load_paths << controller_path
config.controller_paths << controller_path
end
end