site24x7_apminsight 1.8.2 → 1.8.3
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/agent/configuration/am_configuration.rb +8 -8
- data/lib/agent/handler/sequence_book.rb +14 -7
- data/lib/agent/logging/am_logger.rb +9 -4
- data/lib/agent/server/am_agent.rb +2 -1
- data/lib/agent/server/am_connector.rb +3 -3
- data/lib/agent/trackers/default_tracker.rb +6 -1
- data/lib/agent/util/am_constants.rb +9 -9
- data/lib/agent/version.rb +2 -2
- metadata +3 -3
@@ -246,10 +246,10 @@ module ManageEngine
|
|
246
246
|
def getHostType
|
247
247
|
begin
|
248
248
|
# Check for AWS environment
|
249
|
-
response = Net::HTTP.get_response(URI('http://169.254.169.254/latest/meta-data/'))
|
250
|
-
|
251
|
-
|
252
|
-
|
249
|
+
# response = Net::HTTP.get_response(URI('http://169.254.169.254/latest/meta-data/'))
|
250
|
+
url = URI.parse('http://169.254.169.254/latest/meta-data/')
|
251
|
+
request = Net::HTTP::Get.new(url.path)
|
252
|
+
response = Net::HTTP.start(url.host, url.port, :read_timeout => 2) {|http| http.request(request)}
|
253
253
|
if (response.kind_of? Net::HTTPOK)
|
254
254
|
@hostType = "AWS"
|
255
255
|
return @hostType
|
@@ -259,10 +259,10 @@ module ManageEngine
|
|
259
259
|
|
260
260
|
begin
|
261
261
|
#Check for Azure environment
|
262
|
-
response = Net::HTTP.get_response(URI('http://169.254.169.254/metadata/v1/maintenance'))
|
263
|
-
|
264
|
-
|
265
|
-
|
262
|
+
# response = Net::HTTP.get_response(URI('http://169.254.169.254/metadata/v1/maintenance'))
|
263
|
+
url = URI.parse('http://169.254.169.254/metadata/v1/maintenance')
|
264
|
+
request = Net::HTTP::Get.new(url.path)
|
265
|
+
response = Net::HTTP.start(url.host, url.port, :read_timeout => 2) {|http| http.request(request)}
|
266
266
|
if (response.kind_of? Net::HTTPOK)
|
267
267
|
@hostType = "AZURE"
|
268
268
|
return @hostType
|
@@ -3,7 +3,7 @@ require 'agent/metrics/exception_record'
|
|
3
3
|
module APMInsight
|
4
4
|
module Agent
|
5
5
|
class SequenceBook
|
6
|
-
attr_reader :openTracker, :closedTracker, :rootTracker, :trackerCount, :exceptionBag, :listenFlag
|
6
|
+
attr_reader :openTracker, :closedTracker, :rootTracker, :trackerCount, :closedTrackerCount, :exceptionBag, :listenFlag
|
7
7
|
|
8
8
|
def initialize
|
9
9
|
@rootTracker = createDummyTracker()
|
@@ -11,6 +11,7 @@ module APMInsight
|
|
11
11
|
@openTracker = nil
|
12
12
|
|
13
13
|
@trackerCount = 0
|
14
|
+
@closedTrackerCount = 0
|
14
15
|
@listenFlag = -1
|
15
16
|
# @exceptionBag = Array.new
|
16
17
|
end
|
@@ -54,6 +55,7 @@ module APMInsight
|
|
54
55
|
end
|
55
56
|
|
56
57
|
def closeTracker tracker
|
58
|
+
@closedTrackerCount += 1
|
57
59
|
@closedTracker = tracker
|
58
60
|
tracker.sibling = nil
|
59
61
|
@openTracker = nil
|
@@ -61,12 +63,16 @@ module APMInsight
|
|
61
63
|
# Marks end of transaction
|
62
64
|
if @rootTracker == tracker
|
63
65
|
if @listenFlag < 1 || (@listenFlag >= 1 && @trackerCount > 1)
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
66
|
+
# if some trackers are not closed, while processing the metrics, it may go into infinite loop
|
67
|
+
if (@closedTrackerCount - @trackerCount) == 0
|
68
|
+
sequenceBag = Hash.new
|
69
|
+
sequenceBag["roottracker"] = @rootTracker
|
70
|
+
sequenceBag["exceptions"] = @exceptionBag
|
71
|
+
|
72
|
+
ManageEngine::APMObjectHolder.instance.collector.updateTransaction(@rootTracker.url, sequenceBag)
|
73
|
+
else
|
74
|
+
ManageEngine::APMObjectHolder.instance.log.warn "Some trackers are not closed, dropping the metrics for #{@rootTracker.url}"
|
75
|
+
end
|
70
76
|
end
|
71
77
|
closeSequence()
|
72
78
|
end
|
@@ -76,6 +82,7 @@ module APMInsight
|
|
76
82
|
@rootTracker = nil
|
77
83
|
@openTracker = @closedTracker = nil
|
78
84
|
@trackerCount = 0
|
85
|
+
@closedTrackerCount = 0
|
79
86
|
Thread.current[:apminsight] = nil
|
80
87
|
end
|
81
88
|
|
@@ -4,6 +4,8 @@ require "logger"
|
|
4
4
|
module ManageEngine
|
5
5
|
class APMLogger
|
6
6
|
@apmlog=nil;
|
7
|
+
@apmLogPath=nil;
|
8
|
+
|
7
9
|
def initialize
|
8
10
|
@obj=ManageEngine::APMObjectHolder.instance
|
9
11
|
path = getLogsPath
|
@@ -11,14 +13,14 @@ module ManageEngine
|
|
11
13
|
if Dir[path] == []
|
12
14
|
Dir.mkdir(path)
|
13
15
|
end
|
14
|
-
|
16
|
+
@apmLogPath= path + '/apm.log'
|
15
17
|
#puts "#{path}"
|
16
18
|
# file = open(path, File::WRONLY | File::APPEND | File::CREAT)
|
17
19
|
begin
|
18
|
-
@apmlog = Logger.new(
|
20
|
+
@apmlog = Logger.new(@apmLogPath, 10, 5 * 1024 * 1024)
|
19
21
|
@apmlog.level = Logger::INFO
|
20
22
|
rescue Exception => e
|
21
|
-
puts "Unable to create/edit the log file #{
|
23
|
+
puts "Unable to create/edit the log file #{@apmLogPath}. Writing agent logs to STDOUT.\nError: #{e.message}"
|
22
24
|
@apmlog = Logger.new(STDOUT)
|
23
25
|
@apmlog.level = Logger::WARN
|
24
26
|
end
|
@@ -31,6 +33,9 @@ module ManageEngine
|
|
31
33
|
|
32
34
|
end
|
33
35
|
|
36
|
+
def getLogFilePath
|
37
|
+
return @apmLogPath
|
38
|
+
end
|
34
39
|
|
35
40
|
def getLogsPath
|
36
41
|
props = {}
|
@@ -59,7 +64,7 @@ module ManageEngine
|
|
59
64
|
if props["apminsight.log.dir"]!=nil
|
60
65
|
return props["apminsight.log.dir"]
|
61
66
|
else
|
62
|
-
return "
|
67
|
+
return @obj.constants.conf_location+"log"
|
63
68
|
end
|
64
69
|
|
65
70
|
end
|
@@ -17,7 +17,8 @@ module ManageEngine
|
|
17
17
|
|
18
18
|
doDispatcherActions
|
19
19
|
doCollect
|
20
|
-
puts "APM Insight Ruby Agent Started"
|
20
|
+
puts "APM Insight Ruby Agent Started. Agent files are located at #{@obj.constants.conf_location}"
|
21
|
+
puts "Agent log file apm.log is generated at #{@obj.log.getLogFilePath}"
|
21
22
|
else
|
22
23
|
@obj.log.info "Agent Initialization Failed - Going to shutdown"
|
23
24
|
#While parsing the response from /arh/connect we set instrumenter to nil on delete request
|
@@ -109,14 +109,14 @@ module ManageEngine
|
|
109
109
|
#con.verify_mode=OpenSSL::SSL::VERIFY_NONE
|
110
110
|
#@obj.log.info "connection = #{con}"
|
111
111
|
end
|
112
|
-
con=getScheme(con)
|
112
|
+
con=getScheme(con, url)
|
113
113
|
con.open_timeout = @obj.constants.connection_open_timeout
|
114
114
|
con.read_timeout = @obj.constants.connection_read_timeout
|
115
115
|
con
|
116
116
|
end
|
117
117
|
|
118
|
-
def getScheme(con)
|
119
|
-
if(
|
118
|
+
def getScheme(con, url)
|
119
|
+
if(url.to_s.start_with?("https"))
|
120
120
|
#@obj.log.info "[connect] Secured"
|
121
121
|
#con = Net::HTTP::Proxy(@obj.config.proxy_host, @obj.config.proxy_port,@obj.config.proxy_user,@obj.config.proxy_pass).new(url.host, url.port)
|
122
122
|
con.use_ssl=true
|
@@ -28,7 +28,12 @@ module ManageEngine
|
|
28
28
|
end
|
29
29
|
|
30
30
|
def duration
|
31
|
-
|
31
|
+
begin
|
32
|
+
(@endtime - @starttime).to_i
|
33
|
+
rescue Exception=>e
|
34
|
+
@logger.warn "Name: #{name} Starttime: #{starttime} Endtime: #{endtime}"
|
35
|
+
raise e
|
36
|
+
end
|
32
37
|
end
|
33
38
|
|
34
39
|
def ==(obj)
|
@@ -2,7 +2,7 @@
|
|
2
2
|
module ManageEngine
|
3
3
|
class APMConstants
|
4
4
|
|
5
|
-
attr_reader :apm_gem,:s247_apm_gem,:apm_conf,:agent_conf,:connection_open_timeout,:connection_read_timeout,:connect_uri,:connect_data_uri,:connect_trace_uri,:connect_config_update_uri,:mergepattern_conf
|
5
|
+
attr_reader :conf_location, :apm_gem,:s247_apm_gem,:apm_conf,:agent_conf,:connection_open_timeout,:connection_read_timeout,:connect_uri,:connect_data_uri,:connect_trace_uri,:connect_config_update_uri,:mergepattern_conf
|
6
6
|
attr_reader :site24x7USurl, :site24x7EUurl, :site24x7CNurl, :site24x7INurl, :site24x7AUurl
|
7
7
|
attr_reader :licence_exceeds,:licence_expired,:unmanage_agent,:manage_agent,:agent_config_updated,:error_notfound,:error_server,:delete_agent,:response_code,:custom_config_info, :agent_specific_info
|
8
8
|
attr_reader :mf_transaction,:mf_separator,:mf_db,:mf_apdex,:mf_namespace,:mf_name,:mf_all,:agent_store,:agent_lock,:mf_overflow
|
@@ -10,25 +10,25 @@ module ManageEngine
|
|
10
10
|
attr_reader :en_alphabets, :en_numerals
|
11
11
|
|
12
12
|
def initialize
|
13
|
-
|
13
|
+
@conf_location=ENV.has_key?('APMINSIGHT_HOME') ? ENV['APMINSIGHT_HOME']+"/" : "./"
|
14
14
|
#File path for APM Conf file
|
15
|
-
@apm_gem
|
16
|
-
@s247_apm_gem
|
15
|
+
@apm_gem=@conf_location + "apminsight"
|
16
|
+
@s247_apm_gem=@conf_location + "site24x7_apminsight"
|
17
17
|
|
18
18
|
#File path for APM Conf file
|
19
|
-
@apm_conf
|
19
|
+
@apm_conf=@conf_location + "apminsight.conf"
|
20
20
|
|
21
21
|
#file path for agent id, enable details
|
22
|
-
@agent_conf
|
22
|
+
@agent_conf=@conf_location + "apminsight.info"
|
23
23
|
|
24
24
|
#file path for agent data store lock
|
25
|
-
@agent_lock
|
25
|
+
@agent_lock=@conf_location + "apminsight.lock"
|
26
26
|
|
27
27
|
#file path for agent data store lock
|
28
|
-
@agent_store
|
28
|
+
@agent_store=@conf_location + "apminsight.store"
|
29
29
|
|
30
30
|
#file name for url merge patterns
|
31
|
-
@mergepattern_conf
|
31
|
+
@mergepattern_conf=@conf_location + "transaction_merge_patterns.conf"
|
32
32
|
|
33
33
|
|
34
34
|
#Timeout for opening Connections
|
data/lib/agent/version.rb
CHANGED
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 1
|
7
7
|
- 8
|
8
|
-
-
|
9
|
-
version: 1.8.
|
8
|
+
- 3
|
9
|
+
version: 1.8.3
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Adithyan P
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date:
|
17
|
+
date: 2021-03-23 00:00:00 +05:30
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|