tcell_agent 0.2.7 → 0.2.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/bin/tcell_agent +22 -0
- data/lib/tcell_agent/agent/event_processor.rb +7 -0
- data/lib/tcell_agent/agent/fork_pipe_manager.rb +29 -29
- data/lib/tcell_agent/agent/policy_manager.rb +2 -1
- data/lib/tcell_agent/agent/route_manager.rb +35 -15
- data/lib/tcell_agent/configuration.rb +42 -2
- data/lib/tcell_agent/instrumentation.rb +4 -1
- data/lib/tcell_agent/logger.rb +1 -1
- data/lib/tcell_agent/rails.rb +12 -18
- data/lib/tcell_agent/rails/auth/authlogic.rb +2 -2
- data/lib/tcell_agent/rails/auth/devise.rb +1 -1
- data/lib/tcell_agent/rails/dlp.rb +133 -123
- data/lib/tcell_agent/rails/middleware/body_filter_middleware.rb +2 -1
- data/lib/tcell_agent/rails/on_start.rb +67 -69
- data/lib/tcell_agent/rails/routes.rb +91 -86
- data/lib/tcell_agent/rails/settings_reporter.rb +10 -0
- data/lib/tcell_agent/routes/table.rb +2 -0
- data/lib/tcell_agent/sensor_events/server_agent.rb +10 -0
- data/lib/tcell_agent/servers/thin.rb +1 -0
- data/lib/tcell_agent/servers/webrick.rb +0 -1
- data/lib/tcell_agent/start_background_thread.rb +44 -45
- data/lib/tcell_agent/system_info.rb +10 -0
- data/lib/tcell_agent/version.rb +1 -1
- data/spec/lib/tcell_agent/agent/fork_pipe_manager_spec.rb +99 -0
- data/spec/lib/tcell_agent/api/api_spec.rb +2 -2
- data/spec/lib/tcell_agent/instrumentation_spec.rb +176 -176
- data/spec/lib/tcell_agent/policies/appsensor_policy_spec.rb +32 -32
- data/spec/lib/tcell_agent/policies/clickjacking_policy_spec.rb +63 -63
- data/spec/lib/tcell_agent/policies/content_security_policy_spec.rb +93 -93
- data/spec/lib/tcell_agent/policies/dataloss_policy_spec.rb +222 -222
- data/spec/lib/tcell_agent/policies/honeytokens_policy_spec.rb +17 -17
- data/spec/lib/tcell_agent/policies/http_redirect_policy_spec.rb +57 -57
- data/spec/lib/tcell_agent/policies/http_tx_policy_spec.rb +17 -17
- data/spec/lib/tcell_agent/policies/login_policy_spec.rb +3 -3
- data/spec/lib/tcell_agent/policies/secure_headers_policy_spec.rb +59 -59
- data/spec/lib/tcell_agent/rails/logger_spec.rb +148 -0
- data/spec/lib/tcell_agent/rails/middleware/global_middleware_spec.rb +7 -7
- data/spec/lib/tcell_agent/rails_spec.rb +2 -2
- data/spec/lib/tcell_agent/sensor_events/dlp_spec.rb +9 -9
- data/spec/lib/tcell_agent/sensor_events/util/redirect_utils_spec.rb +20 -20
- data/spec/lib/tcell_agent/sensor_events/util/sanitizer_utilities_spec.rb +52 -52
- data/spec/lib/tcell_agent_spec.rb +17 -17
- data/spec/spec_helper.rb +1 -0
- data/spec/support/resources/normal_config.json +5 -5
- data/tcell_agent.gemspec +4 -4
- metadata +31 -26
@@ -74,7 +74,8 @@ module TCellAgent
|
|
74
74
|
script_tag_policy.js_agent_api_key)
|
75
75
|
newbody = []
|
76
76
|
rack_body.each { |str|
|
77
|
-
|
77
|
+
newbody_part = self.replace_in_body(script_tag_policy, str) || str
|
78
|
+
newbody << newbody_part
|
78
79
|
}
|
79
80
|
response = [status, headers, newbody]
|
80
81
|
end
|
@@ -1,101 +1,99 @@
|
|
1
1
|
# See the file "LICENSE" for the full license governing this code.
|
2
2
|
|
3
3
|
#require 'tcell_agent/authlogic' if defined?(Authlogic)
|
4
|
-
|
4
|
+
require 'tcell_agent/configuration'
|
5
5
|
|
6
6
|
require 'rails/all'
|
7
|
+
require 'rails'
|
7
8
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
9
|
+
TCellAgent::Instrumentation::Rails.send_language_info
|
10
|
+
TCellAgent::Instrumentation::Rails.send_framework_info
|
11
|
+
if TCellAgent.configuration.enabled && TCellAgent.configuration.should_instrument?
|
12
|
+
module TCellAgent
|
13
|
+
module Instrumentation
|
14
|
+
module Rails
|
15
|
+
METHODS = ['GET','POST','PUT','DELETE','HEAD',
|
16
|
+
'PATCH','TRACE','CONNECT','OPTIONS']
|
17
|
+
|
18
|
+
def self.instrument_route(route)
|
19
|
+
if (route.constraints.has_key? :request_method)
|
20
|
+
route_path = "#{route.path.spec}"
|
21
|
+
if (route_path.end_with?("(.:format)"))
|
22
|
+
route_path = route_path.chomp("(.:format)")
|
23
|
+
end
|
20
24
|
|
21
|
-
|
25
|
+
route_destination = route.defaults.to_json.to_s
|
22
26
|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
27
|
+
route_methods = METHODS.select { |x| route.verb.match(x) }
|
28
|
+
route_methods.each { |route_method|
|
29
|
+
route_id = TCellAgent::SensorEvents::Util.calculateRouteId(route_method.downcase, route.path.spec)
|
30
|
+
TCellAgent.send_event(
|
31
|
+
TCellAgent::SensorEvents::AppRoutesSensorEvent.new(
|
32
|
+
route_path, route_method, route_id, nil, route_destination
|
33
|
+
)
|
29
34
|
)
|
30
|
-
|
31
|
-
|
35
|
+
}
|
36
|
+
end
|
32
37
|
end
|
33
|
-
end
|
34
38
|
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
+
def self.instrument_routes
|
40
|
+
if ::Rails.application
|
41
|
+
::Rails.application.routes.routes.each do |route|
|
42
|
+
self.instrument_route(route)
|
43
|
+
end
|
39
44
|
end
|
40
45
|
end
|
41
|
-
end
|
42
46
|
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
47
|
+
if (::Rails::VERSION::MAJOR == 3)
|
48
|
+
ActionDispatch::Routing::RouteSet.class_eval do
|
49
|
+
alias_method :original_add_route, :add_route
|
50
|
+
def add_route(app, conditions = {}, requirements = {}, defaults = {}, name = nil, anchor = true)
|
51
|
+
route = original_add_route(app, conditions, requirements, defaults, name, anchor)
|
48
52
|
|
49
|
-
|
53
|
+
TCellAgent::Instrumentation::Rails.instrument_route(route)
|
50
54
|
|
51
|
-
|
52
|
-
|
55
|
+
route
|
56
|
+
end
|
57
|
+
end
|
53
58
|
end
|
54
|
-
end
|
55
59
|
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
60
|
+
if (::Rails::VERSION::MAJOR == 4)
|
61
|
+
ActionDispatch::Journey::Routes.class_eval do
|
62
|
+
alias_method :original_add_route, :add_route
|
63
|
+
def add_route(app, path, conditions, defaults, name = nil)
|
64
|
+
route = original_add_route(app, path, conditions, defaults, name)
|
61
65
|
|
62
|
-
|
66
|
+
TCellAgent::Instrumentation::Rails.instrument_route(route)
|
63
67
|
|
64
|
-
|
68
|
+
route
|
69
|
+
end
|
65
70
|
end
|
66
71
|
end
|
67
|
-
end
|
68
72
|
|
73
|
+
end
|
69
74
|
end
|
70
75
|
end
|
71
|
-
end
|
72
76
|
|
77
|
+
if (Rails.application)
|
78
|
+
TCellAgent::Instrumentation::Rails.send_settings(Rails.application)
|
79
|
+
else
|
80
|
+
module TCellAgent
|
81
|
+
class MyRailtie < Rails::Railtie
|
82
|
+
initializer 'activeservice.autoload', :after => :set_autoload_paths do |app|
|
83
|
+
if (TCellAgent.configuration.enabled)
|
84
|
+
Rails.application.config.to_prepare do
|
85
|
+
require 'tcell_agent/devise' if defined?(Devise)
|
86
|
+
require 'tcell_agent/rails/auth/devise' if defined?(Devise)
|
87
|
+
require 'tcell_agent/authlogic' if defined?(Authlogic)
|
88
|
+
require 'tcell_agent/rails/auth/authlogic' if defined?(Authlogic)
|
89
|
+
end
|
73
90
|
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
require 'tcell_agent/devise' if defined?(Devise)
|
78
|
-
require 'tcell_agent/rails/auth/devise' if defined?(Devise)
|
79
|
-
require 'tcell_agent/authlogic' if defined?(Authlogic)
|
80
|
-
require 'tcell_agent/rails/auth/authlogic' if defined?(Authlogic)
|
81
|
-
|
82
|
-
else
|
83
|
-
module TCellAgent
|
84
|
-
class MyRailtie < Rails::Railtie
|
85
|
-
initializer 'activeservice.autoload', :after => :set_autoload_paths do |app|
|
86
|
-
if (TCellAgent.configuration.enabled)
|
87
|
-
Rails.application.config.to_prepare do
|
88
|
-
require 'tcell_agent/devise' if defined?(Devise)
|
89
|
-
require 'tcell_agent/rails/auth/devise' if defined?(Devise)
|
90
|
-
require 'tcell_agent/authlogic' if defined?(Authlogic)
|
91
|
-
require 'tcell_agent/rails/auth/authlogic' if defined?(Authlogic)
|
92
|
-
end
|
93
|
-
|
94
|
-
Rails.application.config.after_initialize do
|
95
|
-
TCellAgent::Instrumentation::Rails.send_settings(Rails.application)
|
91
|
+
Rails.application.config.after_initialize do
|
92
|
+
TCellAgent::Instrumentation::Rails.send_settings(Rails.application)
|
93
|
+
end
|
96
94
|
end
|
97
95
|
end
|
98
96
|
end
|
99
97
|
end
|
100
98
|
end
|
101
|
-
end
|
99
|
+
end
|
@@ -1,99 +1,104 @@
|
|
1
|
-
|
2
|
-
ActiveSupport.on_load(:action_controller) do
|
3
|
-
ActionController::Base.class_eval do
|
1
|
+
require 'tcell_agent/configuration'
|
4
2
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
3
|
+
if TCellAgent.configuration.enabled && TCellAgent.configuration.should_instrument? && TCellAgent.configuration.should_intercept_requests?
|
4
|
+
|
5
|
+
module TCellAgent
|
6
|
+
ActiveSupport.on_load(:action_controller) do
|
7
|
+
ActionController::Base.class_eval do
|
8
|
+
|
9
|
+
prepend_around_filter :tell_around_filter_routes
|
10
|
+
def tell_around_filter_routes
|
11
|
+
begin
|
12
|
+
TCellAgent::Instrumentation.safe_block("Determining Rails Route ID") {
|
13
|
+
route = Rails.application.routes.router.recognize(request) { |r, _| r }.first
|
14
|
+
if route
|
15
|
+
route_path = route[2].path.spec
|
16
|
+
tcell_context = request.env[TCellAgent::Instrumentation::Rails::Middleware::TCELL_ID]
|
17
|
+
if tcell_context
|
18
|
+
tcell_context.route_id = TCellAgent::SensorEvents::Util.calculateRouteId(request.method.downcase, route_path)
|
19
|
+
end
|
15
20
|
end
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
21
|
+
}
|
22
|
+
def loop_params_hash(method, param_hash, prefix, &block)
|
23
|
+
param_hash.each do |param_name, param_value|
|
24
|
+
if param_value && param_value.is_a?(Hash)
|
25
|
+
loop_params_hash(method, param_value, 'hash', &block)
|
26
|
+
elsif !param_value || !param_value.instance_of?(String) || param_value == ""
|
27
|
+
next
|
28
|
+
else
|
29
|
+
block.call(method, param_name, param_value)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
def for_params(request, &block)
|
34
|
+
get_params = request.GET
|
35
|
+
if get_params
|
36
|
+
self.loop_params_hash('get', get_params, nil, &block)
|
37
|
+
end
|
38
|
+
post_params = request.POST
|
39
|
+
if post_params
|
40
|
+
self.loop_params_hash('post', post_params, nil, &block)
|
41
|
+
end
|
42
|
+
end
|
43
|
+
def _handle_dataexpsure_forms(request)
|
44
|
+
dataex_policy = TCellAgent.policy(TCellAgent::PolicyTypes::DataLoss)
|
45
|
+
tcell_context = request.env[TCellAgent::Instrumentation::Rails::Middleware::TCELL_ID]
|
46
|
+
if tcell_context && dataex_policy && dataex_policy.has_actions_for_form_parameter?
|
47
|
+
for_params(request) { |method, param_name, param_value|
|
48
|
+
actions = dataex_policy.get_actions_for_request("form",param_name)
|
49
|
+
if actions
|
50
|
+
actions.each { |action|
|
51
|
+
tcell_context.add_filter_for_request_parameter(param_value, action, param_name)
|
52
|
+
}
|
26
53
|
end
|
54
|
+
}
|
27
55
|
end
|
28
|
-
end
|
29
|
-
def for_params(request, &block)
|
30
|
-
get_params = request.GET
|
31
|
-
if get_params
|
32
|
-
self.loop_params_hash('get', get_params, nil, &block)
|
33
|
-
end
|
34
|
-
post_params = request.POST
|
35
|
-
if post_params
|
36
|
-
self.loop_params_hash('post', post_params, nil, &block)
|
37
|
-
end
|
38
|
-
end
|
39
|
-
def _handle_dataexpsure_forms(request)
|
40
|
-
dataex_policy = TCellAgent.policy(TCellAgent::PolicyTypes::DataLoss)
|
41
|
-
tcell_context = request.env[TCellAgent::Instrumentation::Rails::Middleware::TCELL_ID]
|
42
|
-
if tcell_context && dataex_policy && dataex_policy.has_actions_for_form_parameter?
|
43
|
-
for_params(request) { |method, param_name, param_value|
|
44
|
-
actions = dataex_policy.get_actions_for_request("form",param_name)
|
45
|
-
if actions
|
46
|
-
actions.each { |action|
|
47
|
-
tcell_context.add_filter_for_request_parameter(param_value, action, param_name)
|
48
|
-
}
|
49
|
-
end
|
50
|
-
}
|
51
56
|
end
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
}
|
57
|
+
TCellAgent::Instrumentation.safe_block("Handling Dataexposure (request forms)") {
|
58
|
+
_handle_dataexpsure_forms(request)
|
59
|
+
}
|
56
60
|
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
61
|
+
def _handle_dataexpsure_headers(request)
|
62
|
+
dataex_policy = TCellAgent.policy(TCellAgent::PolicyTypes::DataLoss)
|
63
|
+
tcell_context = request.env[TCellAgent::Instrumentation::Rails::Middleware::TCELL_ID]
|
64
|
+
if tcell_context && dataex_policy && dataex_policy.has_actions_for_headers?
|
65
|
+
headers = request.env.select {|k,v| k.start_with? 'HTTP_'}
|
66
|
+
headers.each { |header_name, header_value|
|
67
|
+
header_name = header_name.sub(/^HTTP_/, '').gsub('_','-')
|
68
|
+
actions = dataex_policy.get_actions_for_header(header_name)
|
69
|
+
if actions
|
70
|
+
actions.each { |action|
|
71
|
+
tcell_context.add_filter_for_header_value(header_value, action, header_name)
|
72
|
+
}
|
73
|
+
end
|
74
|
+
}
|
75
|
+
end
|
71
76
|
end
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
}
|
77
|
+
TCellAgent::Instrumentation.safe_block("Handling Dataexposure (request headers)") {
|
78
|
+
_handle_dataexpsure_headers(request)
|
79
|
+
}
|
76
80
|
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
81
|
+
def _handler_dataexposure_cookies(request)
|
82
|
+
dataex_policy = TCellAgent.policy(TCellAgent::PolicyTypes::DataLoss)
|
83
|
+
tcell_context = request.env[TCellAgent::Instrumentation::Rails::Middleware::TCELL_ID]
|
84
|
+
if tcell_context && dataex_policy && dataex_policy.has_actions_for_cookie?
|
85
|
+
request.cookies.each { |cookie_name, cookie_value|
|
86
|
+
actions = dataex_policy.get_actions_for_cookie(cookie_name)
|
87
|
+
if actions
|
88
|
+
actions.each { |action|
|
89
|
+
tcell_context.add_filter_for_cookie_value(cookie_value, action, cookie_name)
|
90
|
+
}
|
91
|
+
end
|
92
|
+
}
|
93
|
+
end
|
89
94
|
end
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
+
TCellAgent::Instrumentation.safe_block("Handling Dataexposure (request cookies)") {
|
96
|
+
_handler_dataexposure_cookies(request)
|
97
|
+
}
|
98
|
+
yield
|
99
|
+
end
|
95
100
|
end
|
96
101
|
end
|
97
102
|
end
|
98
103
|
end
|
99
|
-
end
|
104
|
+
end
|
@@ -2,6 +2,7 @@ require 'rails'
|
|
2
2
|
require 'tcell_agent'
|
3
3
|
require 'tcell_agent/sensor_events/app_config'
|
4
4
|
require 'tcell_agent/sensor_events/server_agent'
|
5
|
+
require 'tcell_agent/system_info'
|
5
6
|
|
6
7
|
module TCellAgent
|
7
8
|
module Instrumentation
|
@@ -14,6 +15,15 @@ module TCellAgent
|
|
14
15
|
))
|
15
16
|
end
|
16
17
|
end
|
18
|
+
def self.send_language_info
|
19
|
+
if (TCellAgent.configuration.exp_config_settings)
|
20
|
+
language = TCellAgent::SystemInfo.get_language
|
21
|
+
language_version = TCellAgent::SystemInfo.get_language_version
|
22
|
+
TCellAgent.send_event(TCellAgent::SensorEvents::ServerAgentDetailsLanguageEvent.new(
|
23
|
+
language, language_version
|
24
|
+
))
|
25
|
+
end
|
26
|
+
end
|
17
27
|
def self.send_settings(application)
|
18
28
|
if (TCellAgent.configuration.exp_config_settings)
|
19
29
|
# Defaults to true
|
@@ -10,7 +10,9 @@ module TCellAgent
|
|
10
10
|
|
11
11
|
class RouteEndpoint
|
12
12
|
attr_accessor :database
|
13
|
+
attr_accessor :database_queries_discovered
|
13
14
|
def initialize
|
15
|
+
@database_queries_discovered = {}
|
14
16
|
@database = Hash.new {|h,k| # Database
|
15
17
|
h[k] = Hash.new {|h,k| # Schema
|
16
18
|
h[k] = Hash.new {|h,k| # Table
|
@@ -41,6 +41,16 @@ module TCellAgent
|
|
41
41
|
end
|
42
42
|
end
|
43
43
|
end
|
44
|
+
class ServerAgentDetailsLanguageEvent < TCellSensorEvent
|
45
|
+
def initialize(language, language_version)
|
46
|
+
super("server_agent_details")
|
47
|
+
@flush = true
|
48
|
+
@ensure = true
|
49
|
+
self["language"] = language
|
50
|
+
self["language_version"] = language_version
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
44
54
|
class ServerAgentAppFrameworkEvent < TCellSensorEvent
|
45
55
|
def initialize(framework_name, framework_version)
|
46
56
|
super("server_agent_details")
|
@@ -5,74 +5,73 @@ require 'tcell_agent/agent'
|
|
5
5
|
require 'tcell_agent/configuration'
|
6
6
|
require 'thread'
|
7
7
|
|
8
|
-
|
9
|
-
module TCellAgent
|
10
|
-
|
11
|
-
if (TCellAgent.configuration.enabled && TCellAgent.configuration.instrument_for_events)
|
12
|
-
require 'tcell_agent/sinatra' if defined?(Sinatra)
|
8
|
+
if TCellAgent.configuration.enabled
|
9
|
+
module TCellAgent
|
10
|
+
#require 'tcell_agent/sinatra' if defined?(Sinatra)
|
13
11
|
require 'tcell_agent/rails' if defined?(Rails)
|
14
|
-
end
|
15
12
|
|
16
|
-
|
17
|
-
require 'tcell_agent/rails/on_start' if defined?(Rails)
|
13
|
+
def self.run_instrumentation(server_name)
|
18
14
|
|
19
|
-
|
20
|
-
TCellAgent.logger.debug("Instrumenting: #{server_name}")
|
21
|
-
TCellAgent.thread_agent.start
|
22
|
-
rescue Exception => e
|
23
|
-
TCellAgent.logger.error("Could not start thread agent. #{e.message}")
|
24
|
-
end
|
15
|
+
require 'tcell_agent/rails/on_start' if defined?(Rails)
|
25
16
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
TCellAgent.send_event(event)
|
17
|
+
begin
|
18
|
+
TCellAgent.logger.debug("Instrumenting: #{server_name}")
|
19
|
+
TCellAgent.thread_agent.start
|
20
|
+
rescue Exception => e
|
21
|
+
TCellAgent.logger.error("Could not start thread agent. #{e.message}")
|
32
22
|
end
|
33
23
|
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
24
|
+
Thread.abort_on_exception = TCellAgent.configuration.raise_exceptions
|
25
|
+
Thread.new do
|
26
|
+
|
27
|
+
TCellAgent::Instrumentation.safe_block("Instrumenting Agent Details") do
|
28
|
+
event = TCellAgent::SensorEvents::ServerAgentDetailsSensorEvent.new
|
29
|
+
TCellAgent.send_event(event)
|
30
|
+
end
|
31
|
+
|
32
|
+
TCellAgent::Instrumentation.safe_block("Instrumenting Server Packages") do
|
33
|
+
event = TCellAgent::SensorEvents::ServerAgentPackagesSensorEvent.new
|
34
|
+
TCellAgent.send_event(event)
|
35
|
+
end
|
38
36
|
|
39
|
-
|
40
|
-
|
41
|
-
|
37
|
+
if (TCellAgent.configuration.enabled && TCellAgent.configuration.should_instrument? && defined?(Rails))
|
38
|
+
TCellAgent::Instrumentation.safe_block("Instrumenting routes") do
|
39
|
+
TCellAgent::Instrumentation::Rails.instrument_routes
|
40
|
+
end
|
42
41
|
end
|
42
|
+
|
43
43
|
end
|
44
44
|
|
45
45
|
end
|
46
46
|
|
47
47
|
end
|
48
48
|
|
49
|
-
|
50
|
-
|
51
|
-
tcell_server = ENV["TCELL_AGENT_SERVER"]
|
49
|
+
tcell_server = ENV["TCELL_AGENT_SERVER"]
|
52
50
|
|
53
|
-
if (!(tcell_server && tcell_server == "mock"))
|
51
|
+
if (!(tcell_server && tcell_server == "mock"))
|
54
52
|
|
55
|
-
|
53
|
+
if (tcell_server && tcell_server == "webrick") || defined?(Rails::Server)
|
56
54
|
|
57
|
-
|
55
|
+
require("tcell_agent/servers/rails_server")
|
58
56
|
|
59
|
-
|
57
|
+
elsif (tcell_server && tcell_server == "thin") || defined?(Thin)
|
60
58
|
|
61
|
-
|
59
|
+
require("tcell_agent/servers/thin")
|
62
60
|
|
63
|
-
|
61
|
+
elsif (tcell_server && tcell_server == "puma") || defined?(Puma)
|
64
62
|
|
65
|
-
|
63
|
+
require("tcell_agent/servers/puma")
|
66
64
|
|
67
|
-
|
65
|
+
elsif (tcell_server && tcell_server == "unicorn") || defined?(Unicorn)
|
68
66
|
|
69
|
-
|
67
|
+
require("tcell_agent/servers/unicorn")
|
70
68
|
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
69
|
+
else
|
70
|
+
puts "[tCell.io] **********************************************************************"
|
71
|
+
puts "[tCell.io] Server used to launch rails not recognized."
|
72
|
+
puts "[tCell.io] You can override this with the env variable"
|
73
|
+
puts "[tCell.io] TCELL_AGENT_SERVER=thin|puma|unicorn"
|
74
|
+
puts "[tCell.io] **********************************************************************"
|
75
|
+
end
|
77
76
|
end
|
78
77
|
end
|