apminsight 1.0.1 → 1.8.6
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/apm-agent.gemspec +64 -0
- data/conf/apminsight.conf +15 -24
- data/lib/agent/am_objectholder.rb +25 -19
- data/lib/agent/api/custom_tracker.rb +79 -0
- data/lib/agent/configuration/am_configuration.rb +284 -41
- data/lib/agent/handler/custom_api_handler.rb +40 -0
- data/lib/agent/handler/sequence_book.rb +125 -0
- data/lib/agent/handler/tracker_handler.rb +58 -0
- data/lib/agent/logging/am_logger.rb +20 -11
- data/lib/agent/metrics/am_metricsformatter.rb +117 -59
- data/lib/agent/metrics/am_metricsparser.rb +195 -468
- data/lib/agent/metrics/am_metricstore.rb +7 -6
- data/lib/agent/metrics/exception_record.rb +24 -0
- data/lib/agent/server/am_agent.rb +46 -17
- data/lib/agent/server/am_connector.rb +65 -21
- data/lib/agent/server/instrument/action_view.rb +64 -0
- data/lib/agent/server/instrument/active_record.rb +52 -0
- data/lib/agent/server/instrument/am_apm.rb +107 -97
- data/lib/agent/server/instrument/am_instrumenter.rb +54 -42
- data/lib/agent/server/instrument/environment.rb +42 -0
- data/lib/agent/server/instrument/rails.rb +56 -0
- data/lib/agent/server/instrument/sinatra.rb +97 -0
- data/lib/agent/server/worker/am_worker.rb +93 -49
- data/lib/agent/trackers/database_tracker.rb +107 -0
- data/lib/agent/trackers/default_tracker.rb +62 -0
- data/lib/agent/trackers/root_tracker.rb +43 -0
- data/lib/agent/util/am_constants.rb +53 -8
- data/lib/agent/util/am_util.rb +64 -1
- data/lib/agent/util/transaction_util.rb +35 -0
- data/lib/agent/version.rb +13 -0
- data/lib/apminsight.rb +4 -1
- metadata +114 -76
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.
|
1
|
+
1.8.2
|
data/apm-agent.gemspec
ADDED
@@ -0,0 +1,64 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
require './lib/agent/version'
|
7
|
+
require 'date'
|
8
|
+
|
9
|
+
Gem::Specification.new do |s|
|
10
|
+
s.name = "apminsight"
|
11
|
+
s.version = ManageEngine::APMInsight::VERSION
|
12
|
+
|
13
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
14
|
+
s.authors = ["Adithyan P"]
|
15
|
+
s.date = Date.today.to_s
|
16
|
+
s.description = "ManageEngine Applications Manager APM Insight gives you end-to-end web-transaction awareness of Rails applications enabling you to isolate performance issues and resolve them quickly. To monitor Rails application performance, download and deploy Applications Manager's Ruby agent(apminsight) in your Application Server. This agent allows you to send information about Ruby applications. You can install APM Insight Agent via Rubygems or download it from Applications Manager's website: http://www.manageengine.com/products/applications_manager/apm-insight-agent-installation.html"
|
17
|
+
|
18
|
+
s.email = "apm-insight@zohocorp.com"
|
19
|
+
s.extra_rdoc_files = [
|
20
|
+
"LICENSE.txt",
|
21
|
+
"README.rdoc"
|
22
|
+
]
|
23
|
+
|
24
|
+
s.files = Dir[
|
25
|
+
'LICENSE.txt',
|
26
|
+
'README.rdoc',
|
27
|
+
'Rakefile',
|
28
|
+
'VERSION',
|
29
|
+
'apm-agent.gemspec',
|
30
|
+
'conf/apminsight.conf',
|
31
|
+
'lib/apminsight.rb',
|
32
|
+
'lib/agent/**/*'
|
33
|
+
]
|
34
|
+
|
35
|
+
s.homepage = "http://www.manageengine.com/products/applications_manager/ruby-webtransaction-monitoring.html"
|
36
|
+
s.require_paths = ["lib"]
|
37
|
+
s.rubygems_version = "1.8.15"
|
38
|
+
s.summary = "ManageEngine Applications Manager APM Insight gives you end-to-end web-transaction awareness of Rails applications enabling you to isolate performance issues and resolve them quickly. To monitor Rails application performance, download and deploy Applications Manager's Ruby agent(apminsight) in your Application Server. This agent allows you to send information about Ruby applications. You can install APM Insight Agent via Rubygems or download it from Applications Manager's website : http://www.manageengine.com/products/applications_manager/apm-insight-agent-installation.html"
|
39
|
+
|
40
|
+
if s.respond_to? :specification_version then
|
41
|
+
s.specification_version = 3
|
42
|
+
|
43
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
44
|
+
s.add_development_dependency(%q<shoulda>, [">= 0"])
|
45
|
+
s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
|
46
|
+
s.add_development_dependency(%q<jeweler>, ["~> 1.6.4"])
|
47
|
+
s.add_development_dependency(%q<rcov>, [">= 0"])
|
48
|
+
s.add_development_dependency(%q<rails>, [">= 3.0.0"])
|
49
|
+
else
|
50
|
+
s.add_dependency(%q<shoulda>, [">= 0"])
|
51
|
+
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
52
|
+
s.add_dependency(%q<jeweler>, ["~> 1.6.4"])
|
53
|
+
s.add_dependency(%q<rcov>, [">= 0"])
|
54
|
+
s.add_dependency(%q<rails>, [">= 3.0.0"])
|
55
|
+
end
|
56
|
+
else
|
57
|
+
s.add_dependency(%q<shoulda>, [">= 0"])
|
58
|
+
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
59
|
+
s.add_dependency(%q<jeweler>, ["~> 1.6.4"])
|
60
|
+
s.add_dependency(%q<rcov>, [">= 0"])
|
61
|
+
s.add_dependency(%q<rails>, [">= 3.0.0"])
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
data/conf/apminsight.conf
CHANGED
@@ -9,6 +9,9 @@
|
|
9
9
|
#
|
10
10
|
#All the configuration options defaults to factory configuration if commented or not supported values
|
11
11
|
|
12
|
+
#License key of your Applications Manager.
|
13
|
+
license.key=
|
14
|
+
|
12
15
|
#Logical name of your application.Say for example you have "Order Processing" applications running in
|
13
16
|
#10 instances of Tomcat server. Specify the name as "Order Processing" for the name in all the 10
|
14
17
|
#instances while deploying the agent. Applications Manager will group the data from 10 instances of
|
@@ -16,16 +19,9 @@
|
|
16
19
|
application.name=My Application
|
17
20
|
|
18
21
|
#Name of the host or IPV4 address where the Applications Manager is installed and running.
|
22
|
+
#For Enterprise Edition of Applications Manager provide Managed Server's host or IPV4 address
|
19
23
|
#[Mandatory]
|
20
|
-
apm.host=localhost
|
21
|
-
|
22
|
-
#Whether the data to the Applications Manager should be sent through HTTPS protocol.
|
23
|
-
#default value: false
|
24
|
-
apm.protocol.https=false
|
25
|
-
|
26
|
-
#HTTP/HTTPS Port of the Applications Manager.(Specify HTTPS port if apm.protocol.https is true)
|
27
|
-
#[Mandatory]
|
28
|
-
apm.port=9090
|
24
|
+
apm.host=http://localhost:9090/
|
29
25
|
|
30
26
|
#APM Insight agent communicates to the Applications Manager through the HTTP/HTTPS protocol.
|
31
27
|
#Specify Proxy server configuration when there is a proxy server between APM Insight agent and
|
@@ -64,17 +60,19 @@ apdex.threshold=0.5
|
|
64
60
|
sql.capture.enabled=true
|
65
61
|
|
66
62
|
#Whether the transaction trace is enabled or not. Setting this value to true will send the trace of the
|
67
|
-
#slow transaction.
|
63
|
+
#slow web transaction.
|
68
64
|
#default value: true
|
69
65
|
transaction.trace.enabled=true
|
70
66
|
|
71
|
-
#Threshold to construct the trace for slow transactions. Transaction Traces violating this threshold will be
|
67
|
+
#Threshold to construct the trace for slow web transactions. Transaction Traces violating this threshold will be
|
72
68
|
#collected and sent to the server. Used to analyze and troubleshoot the Transaction by the user.
|
73
69
|
#default value: 2 (second)
|
74
70
|
transaction.trace.threshold=2
|
75
71
|
|
76
|
-
#
|
77
|
-
#
|
72
|
+
#Enabling this option will parametrize all SQL Queries in Slow Transaction Traces (if sql.capture.enabled
|
73
|
+
#set to true & transaction.trace.enabled set to true). Disabling this option will give you the real query
|
74
|
+
#with actual parameters. It is recommended to enable this option if there are queries getting executed
|
75
|
+
#using confidential parameters like credit card number, passwords, etc.
|
78
76
|
#default value: true
|
79
77
|
transaction.trace.sql.parametrize=true
|
80
78
|
|
@@ -83,23 +81,16 @@ transaction.trace.sql.parametrize=true
|
|
83
81
|
#default value: 3 (second)
|
84
82
|
transaction.trace.sql.stacktrace.threshold=3
|
85
83
|
|
86
|
-
#
|
87
|
-
|
88
|
-
#starts with com.test.customimpl. It is best if this is enabled only in the testing/staging environment.
|
89
|
-
#Use comma(,) to separate multiple entries.
|
90
|
-
#include.packages=
|
91
|
-
|
92
|
-
#Sampling counter.Say for example when you specify the value as 20, agent will track one in 20 transactions.
|
93
|
-
#default value: 1 (request)
|
94
|
-
transaction.tracking.request.interval=1
|
84
|
+
#Stop listening transactions with specified URL pattern.
|
85
|
+
transaction.skip.listening=*.css, *.js, *.gif, *.jpg, *.jpeg, *.bmp, *.png, *.ico
|
95
86
|
|
96
87
|
#Directory where agent logs information separately.
|
97
88
|
#Defaults to the directory where apminsight-javaagent.jar is installed.
|
98
|
-
#Use
|
89
|
+
#Use forward slash(/) as path separator.
|
99
90
|
#apminsight.log.dir=./apminsight/logs
|
100
91
|
|
101
92
|
#The log level at which the APM Insight agent should record logging
|
102
93
|
#information. The levels are SEVERE, WARNING, INFO, FINE in the order
|
103
94
|
#respectively. Defaults to the level INFO if commented or mentioned
|
104
95
|
#incorrectly.
|
105
|
-
apminsight.log.level=INFO
|
96
|
+
apminsight.log.level=INFO
|
@@ -9,32 +9,38 @@ require "agent/metrics/am_metricscollector"
|
|
9
9
|
require "agent/metrics/am_metricstore"
|
10
10
|
require "agent/metrics/am_metricsformatter"
|
11
11
|
require "agent/metrics/am_metricsparser"
|
12
|
-
require "agent/
|
12
|
+
require "agent/util/transaction_util"
|
13
13
|
|
14
14
|
module ManageEngine
|
15
15
|
|
16
16
|
class APMObjectHolder
|
17
|
-
attr_reader :config,:log,:util,:constants,:shutdown,:connector,:agent,:collector
|
18
|
-
attr_accessor :shutdown,:agent_initialized,:last_dispatch_time,:
|
17
|
+
attr_reader :config,:log,:util,:constants,:shutdown,:connector,:agent,:collector, :txn_util
|
18
|
+
attr_accessor :shutdown,:agent_initialized,:last_dispatch_time,:store,:formatter,:parser
|
19
19
|
@@objects = nil
|
20
20
|
#Don't Change the Order of Initialize
|
21
21
|
def initializeObjects
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
22
|
+
begin
|
23
|
+
@agent_initialized = false
|
24
|
+
@shutdown = false
|
25
|
+
@constants = ManageEngine::APMConstants.new
|
26
|
+
@log = ManageEngine::APMLogger.new
|
27
|
+
@util = ManageEngine::APMUtil.new
|
28
|
+
@util.setLogger @log
|
29
|
+
@config = ManageEngine::APMConfig.new
|
30
|
+
@connector = ManageEngine::APMConnector.new
|
31
|
+
@store = ManageEngine::APMMetricsStore.new
|
32
|
+
@collector = ManageEngine::APMMetricsCollector.new
|
33
|
+
@txn_util = ManageEngine::TransactionUtil.new
|
34
|
+
@formatter = ManageEngine::APMMetricsFormatter.new
|
35
|
+
@parser = ManageEngine::APMMetricsParser.new
|
36
|
+
@agent = ManageEngine::APMAgent.new
|
37
|
+
@last_dispatch_time = @@objects.util.currenttimemillis
|
38
|
+
@@objects.log.debug "[APMObjectHolder] [ All Objects Initialized ] "
|
39
|
+
rescue Exception => e
|
40
|
+
puts "Error initializing APM Insight Ruby agent. #{e.message}"
|
41
|
+
@shutdown = true
|
42
|
+
@agent_initialized = false
|
43
|
+
end
|
38
44
|
end
|
39
45
|
|
40
46
|
def self.instance
|
@@ -0,0 +1,79 @@
|
|
1
|
+
require 'agent/handler/custom_api_handler'
|
2
|
+
|
3
|
+
module APMInsight
|
4
|
+
module API
|
5
|
+
module CustomTracker
|
6
|
+
|
7
|
+
def self.included clazz
|
8
|
+
clazz.extend CustomMethodTracker
|
9
|
+
end
|
10
|
+
|
11
|
+
module CustomMethodTracker
|
12
|
+
# @api public
|
13
|
+
def track_method(method_name)
|
14
|
+
|
15
|
+
# Check whether the method exists
|
16
|
+
return unless method_defined?(method_name) || private_method_defined?(method_name)
|
17
|
+
|
18
|
+
# Check whether the method is already instrumented
|
19
|
+
return if is_instrumented?(method_name)
|
20
|
+
|
21
|
+
# Injecting code into the class
|
22
|
+
class_eval(get_instrumentation_code(method_name), __FILE__, __LINE__)
|
23
|
+
|
24
|
+
# Setting alias to invoke agent methods
|
25
|
+
alias_method "original_#{method_name}", "#{method_name}"
|
26
|
+
alias_method "#{method_name}", "apminsight_#{method_name}"
|
27
|
+
|
28
|
+
# TODO: set visibility
|
29
|
+
# visibility = instance_method_visibility(self, method_name)
|
30
|
+
# send visibility, method_name
|
31
|
+
# send visibility, "apminsight_#{method_name}"
|
32
|
+
end
|
33
|
+
|
34
|
+
|
35
|
+
def is_instrumented?(method_name)
|
36
|
+
method_name = "apminsight_#{method_name}"
|
37
|
+
return method_defined?(method_name)
|
38
|
+
end
|
39
|
+
|
40
|
+
# TODO: Capture exception, attach tracker
|
41
|
+
# TODO: Create agent handler and call respective methods like in java agent
|
42
|
+
def get_instrumentation_code(method_name)
|
43
|
+
"def apminsight_#{method_name}(*args, &block)
|
44
|
+
tracker = ::APMInsight::API::CustomAPIHandler.invokeTracker \"\#{self.class.name}.#{method_name}\"
|
45
|
+
begin
|
46
|
+
original_#{method_name}(*args, &block)
|
47
|
+
rescue Exception=>e
|
48
|
+
if tracker != nil
|
49
|
+
tracker.setError e
|
50
|
+
end
|
51
|
+
raise e
|
52
|
+
ensure
|
53
|
+
::APMInsight::API::CustomAPIHandler.exitTracker tracker
|
54
|
+
end
|
55
|
+
end"
|
56
|
+
end
|
57
|
+
|
58
|
+
# def instance_method_visibility(klass, method_name)
|
59
|
+
# if klass.private_instance_methods.map{|s|s.to_sym}.include? method_name.to_sym
|
60
|
+
# :private
|
61
|
+
# elsif klass.protected_instance_methods.map{|s|s.to_sym}.include? method_name.to_sym
|
62
|
+
# :protected
|
63
|
+
# else
|
64
|
+
# :public
|
65
|
+
# end
|
66
|
+
# end
|
67
|
+
end #CustomMethodTracker
|
68
|
+
|
69
|
+
def self.trackException(exception)
|
70
|
+
return unless exception != nil
|
71
|
+
|
72
|
+
# Check for active transaction
|
73
|
+
# Associate exception to current transaction
|
74
|
+
::APMInsight::API::CustomAPIHandler.track_exception(exception)
|
75
|
+
end
|
76
|
+
|
77
|
+
end #CustomTracker
|
78
|
+
end #API
|
79
|
+
end
|