site24x7_apminsight 1.8.7 → 1.9.0
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/agent/configuration/am_configuration.rb +19 -1
- data/lib/agent/handler/sequence_book.rb +1 -1
- data/lib/agent/metrics/am_metricsformatter.rb +152 -34
- data/lib/agent/metrics/am_metricsparser.rb +4 -4
- data/lib/agent/server/instrument/environment.rb +3 -1
- data/lib/agent/server/instrument/sidekiq_client.rb +38 -0
- data/lib/agent/server/instrument/sidekiq_server.rb +66 -0
- data/lib/agent/server/worker/am_worker.rb +33 -1
- data/lib/agent/trackers/database_tracker.rb +1 -1
- data/lib/agent/trackers/root_tracker.rb +33 -1
- data/lib/agent/util/am_constants.rb +11 -4
- data/lib/agent/version.rb +3 -3
- metadata +6 -4
@@ -24,7 +24,17 @@ module ManageEngine
|
|
24
24
|
@alreadyconnected = checkAgentInfo
|
25
25
|
@site24x7 = checkLicenseFile
|
26
26
|
if (@site24x7)
|
27
|
-
@site24x7url =
|
27
|
+
@site24x7url = @license_key.start_with?('eu_') ? @obj.constants.site24x7EUurl :
|
28
|
+
@license_key.start_with?('cn_') ? @obj.constants.site24x7CNurl :
|
29
|
+
@license_key.start_with?('au_') ? @obj.constants.site24x7AUurl :
|
30
|
+
@license_key.start_with?('in_') ? @obj.constants.site24x7INurl :
|
31
|
+
@license_key.start_with?('gd_') ? @obj.constants.site24x7GDurl :
|
32
|
+
@license_key.start_with?('jp_') ? @obj.constants.site24x7JPurl :
|
33
|
+
@license_key.start_with?('gd_') ? @obj.constants.site24x7GDurl :
|
34
|
+
@license_key.start_with?('ca_') ? @obj.constants.site24x7CAurl :
|
35
|
+
@license_key.start_with?('sa_') ? @obj.constants.site24x7SAurl :
|
36
|
+
@license_key.start_with?('uk_') ? @obj.constants.site24x7UKurl :
|
37
|
+
@license_key.start_with?('in_hd_') ? @obj.constants.site24x7HDFCurl : @obj.constants.site24x7USurl
|
28
38
|
end
|
29
39
|
@db_operations =["select","insert","update","delete"]
|
30
40
|
urlMergePattern
|
@@ -300,6 +310,14 @@ module ManageEngine
|
|
300
310
|
if (@hostType != nil)
|
301
311
|
agentdata["host.type"]=@hostType
|
302
312
|
end
|
313
|
+
begin
|
314
|
+
fqdn = Addrinfo.getaddrinfo(Socket.gethostname, nil).first.getnameinfo.first
|
315
|
+
if (fqdn != nil)
|
316
|
+
agentdata["fqdn"] = fqdn
|
317
|
+
end
|
318
|
+
rescue Exception=>e
|
319
|
+
@obj.log.warn("Unable to get fqdn value #{e.message}")
|
320
|
+
end
|
303
321
|
data["agent_info"]=agentdata
|
304
322
|
data["environment"]=getEnvData
|
305
323
|
data["custom_config_info"]=getAgentConfigData
|
@@ -62,7 +62,7 @@ module APMInsight
|
|
62
62
|
|
63
63
|
# Marks end of transaction
|
64
64
|
if @rootTracker == tracker
|
65
|
-
if @listenFlag < 1 || (@listenFlag >= 1 && @trackerCount >
|
65
|
+
if @listenFlag < 1 || (@listenFlag >= 1 && @trackerCount > 0)
|
66
66
|
# if some trackers are not closed, while processing the metrics, it may go into infinite loop
|
67
67
|
if (@closedTrackerCount - @trackerCount) == 0
|
68
68
|
sequenceBag = Hash.new
|
@@ -17,8 +17,10 @@ module ManageEngine
|
|
17
17
|
@apdex_threshold = @obj.config.apdex_t * 1000
|
18
18
|
#@obj.log.info "[FORMAT]"
|
19
19
|
@transaction = Hash.new
|
20
|
+
@bgTransaction = Hash.new
|
20
21
|
@db = Hash.new
|
21
22
|
@instance = Hash.new
|
23
|
+
@bginstance = Hash.new
|
22
24
|
@dbinstance = Hash.new
|
23
25
|
@dboperations = Hash.new
|
24
26
|
@keystoremove = Array.new
|
@@ -27,6 +29,7 @@ module ManageEngine
|
|
27
29
|
updatetransaction value
|
28
30
|
end
|
29
31
|
updateinstance
|
32
|
+
updatebginstance
|
30
33
|
updatedbinstance
|
31
34
|
|
32
35
|
@transaction.each do |key,value|
|
@@ -39,6 +42,16 @@ module ManageEngine
|
|
39
42
|
result.push(valArr)
|
40
43
|
end
|
41
44
|
|
45
|
+
@bgTransaction.each do |key,value|
|
46
|
+
res = Hash.new
|
47
|
+
res[@obj.constants.mf_namespace] = key
|
48
|
+
res[@obj.constants.mf_name] = @obj.constants.mf_bckgrnd
|
49
|
+
valArr= Array.new
|
50
|
+
valArr[0] =res
|
51
|
+
valArr[1] =value
|
52
|
+
result.push(valArr)
|
53
|
+
end
|
54
|
+
|
42
55
|
@db.each do |key,value|
|
43
56
|
#puts "#{key} == #{value}"
|
44
57
|
res = Hash.new
|
@@ -58,6 +71,15 @@ module ManageEngine
|
|
58
71
|
valArr[1] =value
|
59
72
|
result.push(valArr)
|
60
73
|
end
|
74
|
+
@bginstance.each do |key,value|
|
75
|
+
res = Hash.new
|
76
|
+
res[@obj.constants.mf_namespace] = ""
|
77
|
+
res[@obj.constants.mf_name] = @obj.constants.mf_bckgrnd
|
78
|
+
valArr= Array.new
|
79
|
+
valArr[0] =res
|
80
|
+
valArr[1] =value
|
81
|
+
result.push(valArr)
|
82
|
+
end
|
61
83
|
@dbinstance.each do |key,value|
|
62
84
|
res = Hash.new
|
63
85
|
res[@obj.constants.mf_namespace] = ""
|
@@ -95,8 +117,13 @@ module ManageEngine
|
|
95
117
|
end
|
96
118
|
|
97
119
|
def updateinstance
|
120
|
+
if (@transaction.size == 0)
|
121
|
+
return
|
122
|
+
end
|
123
|
+
|
98
124
|
ins_apdx = [0,-1,-1,0,0,0,0,0,0]
|
99
125
|
logmetric = Hash.new
|
126
|
+
error_rt = 0
|
100
127
|
@transaction.each do |key,value|
|
101
128
|
apdexValue = value[0]
|
102
129
|
ins_apdx[0] += apdexValue[0]
|
@@ -117,7 +144,10 @@ module ManageEngine
|
|
117
144
|
ins_apdx[6] += apdexValue[6]
|
118
145
|
ins_apdx[7] += apdexValue[7]
|
119
146
|
ins_apdx[8] += apdexValue[8]
|
120
|
-
|
147
|
+
ert = value[1][@obj.constants.error_rt]
|
148
|
+
if (ert != nil)
|
149
|
+
error_rt += ert
|
150
|
+
end
|
121
151
|
exceptions = value[1][@obj.constants.mf_logmetric]
|
122
152
|
if (exceptions != nil)
|
123
153
|
exceptions.each do |name, count|
|
@@ -129,9 +159,48 @@ module ManageEngine
|
|
129
159
|
ins_apdx[4] = (ins_apdx[5].to_f + (ins_apdx[6]/2).to_f).to_f/ins_apdx[3].to_f
|
130
160
|
ins_apdx[0] = ins_apdx[0].round(2)
|
131
161
|
end
|
132
|
-
@instance[":apdex"]=[ins_apdx, {@obj.constants.mf_logmetric=>logmetric}]
|
162
|
+
@instance[":apdex"]=[ins_apdx, {@obj.constants.mf_logmetric=>logmetric, @obj.constants.error_rt=>error_rt}]
|
133
163
|
end
|
134
164
|
|
165
|
+
def updatebginstance
|
166
|
+
if (@bgTransaction.size == 0)
|
167
|
+
return
|
168
|
+
end
|
169
|
+
|
170
|
+
stats = [0,-1,-1,0,0]
|
171
|
+
logmetric = Hash.new
|
172
|
+
error_rt = 0
|
173
|
+
@bgTransaction.each do |key,value|
|
174
|
+
txnValue = value[0]
|
175
|
+
stats[0] += txnValue[0]
|
176
|
+
if stats[1] == -1
|
177
|
+
stats[1] = txnValue[1]
|
178
|
+
stats[2] = txnValue[2]
|
179
|
+
else
|
180
|
+
if(txnValue[1]<stats[1])
|
181
|
+
stats[1] = txnValue[1]
|
182
|
+
end
|
183
|
+
if (txnValue[2]>stats[2])
|
184
|
+
stats[2] = txnValue[2]
|
185
|
+
end
|
186
|
+
end
|
187
|
+
stats[3] += txnValue[3]
|
188
|
+
stats[4] += txnValue[4]
|
189
|
+
|
190
|
+
ert = value[1][@obj.constants.error_rt]
|
191
|
+
if (ert != nil)
|
192
|
+
error_rt += ert
|
193
|
+
end
|
194
|
+
exceptions = value[1][@obj.constants.mf_logmetric]
|
195
|
+
if (exceptions != nil)
|
196
|
+
exceptions.each do |name, count|
|
197
|
+
logmetric[name] = logmetric[name].to_i + count
|
198
|
+
end
|
199
|
+
end
|
200
|
+
end
|
201
|
+
@bginstance[":bckgrnd"]=[stats, {@obj.constants.mf_logmetric=>logmetric, @obj.constants.error_rt=>error_rt}]
|
202
|
+
end
|
203
|
+
|
135
204
|
def updatedbinstance
|
136
205
|
cnt = 0;
|
137
206
|
rt = 0;
|
@@ -166,42 +235,91 @@ module ManageEngine
|
|
166
235
|
exc = d["exception"]
|
167
236
|
|
168
237
|
rt = pl["rt"].round(2)
|
169
|
-
path = @obj.constants.mf_transaction + @obj.constants.mf_separator + pl["path"]
|
170
|
-
|
171
|
-
|
172
|
-
apx_stat = nil
|
173
|
-
additionalInfo = nil
|
174
|
-
if(@transaction.has_key?(path))
|
175
|
-
apx_stat = @transaction[path][0]
|
176
|
-
additionalInfo = @transaction[path][1]
|
177
|
-
else
|
178
|
-
if @transaction.length == @obj.config.metric_overflow_t
|
179
|
-
@obj.log.debug "Metricstore overflow. Current Size: #{@obj.config.metric_overflow_t} #{path}"
|
180
|
-
return
|
181
|
-
end
|
182
|
-
apx_stat = Array.new
|
183
|
-
apx_stat = [0,0,0,0,0,0,0,0,0]
|
184
|
-
additionalInfo = Hash.new
|
185
|
-
end
|
238
|
+
# path = @obj.constants.mf_transaction + @obj.constants.mf_separator + pl["path"]
|
239
|
+
path = pl["path"]
|
186
240
|
|
187
|
-
if (pl
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
241
|
+
if (pl["type"] == @obj.constants.mf_http)
|
242
|
+
apx_stat = nil
|
243
|
+
additionalInfo = nil
|
244
|
+
if(@transaction.has_key?(path))
|
245
|
+
apx_stat = @transaction[path][0]
|
246
|
+
additionalInfo = @transaction[path][1]
|
247
|
+
else
|
248
|
+
if @transaction.length == @obj.config.metric_overflow_t
|
249
|
+
@obj.log.debug "Metricstore overflow. Current Size: #{@obj.config.metric_overflow_t} #{path}"
|
250
|
+
return
|
251
|
+
end
|
252
|
+
|
253
|
+
apx_stat = Array.new
|
254
|
+
apx_stat = [0,0,0,0,0,0,0,0,0]
|
255
|
+
additionalInfo = Hash.new
|
256
|
+
end
|
257
|
+
|
258
|
+
if (pl.has_key?("error"))
|
259
|
+
apx_stat[8] += 1
|
260
|
+
if (additionalInfo[@obj.constants.error_rt] == nil)
|
261
|
+
additionalInfo[@obj.constants.error_rt] = rt
|
262
|
+
else
|
263
|
+
additionalInfo[@obj.constants.error_rt] += rt
|
264
|
+
end
|
265
|
+
else
|
266
|
+
apx_stat = apxarray apx_stat,rt
|
267
|
+
end
|
192
268
|
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
269
|
+
if (exc != nil)
|
270
|
+
logmetric = additionalInfo[@obj.constants.mf_logmetric]
|
271
|
+
if (logmetric == nil)
|
272
|
+
additionalInfo[@obj.constants.mf_logmetric] = exc
|
273
|
+
else
|
274
|
+
exc.each do |name, count|
|
275
|
+
logmetric[name] = logmetric[name].to_i + count
|
276
|
+
end
|
277
|
+
end
|
278
|
+
end
|
279
|
+
|
280
|
+
@transaction[path] = [apx_stat, additionalInfo]
|
281
|
+
else
|
282
|
+
stat = nil
|
283
|
+
additionalInfo = nil
|
284
|
+
if(@bgTransaction.has_key?(path))
|
285
|
+
stat = @bgTransaction[path][0]
|
286
|
+
additionalInfo = @bgTransaction[path][1]
|
287
|
+
else
|
288
|
+
if @bgTransaction.length == @obj.config.metric_overflow_t
|
289
|
+
@obj.log.debug "Metricstore overflow. Current Size: #{@obj.config.metric_overflow_t} #{path}"
|
290
|
+
return
|
200
291
|
end
|
292
|
+
|
293
|
+
stat = Array.new
|
294
|
+
stat = [0,0,0,0,0]
|
295
|
+
additionalInfo = Hash.new
|
201
296
|
end
|
202
|
-
|
203
|
-
|
204
|
-
|
297
|
+
|
298
|
+
if (pl.has_key?("error"))
|
299
|
+
stat[4] += 1
|
300
|
+
if (additionalInfo[@obj.constants.error_rt] == nil)
|
301
|
+
additionalInfo[@obj.constants.error_rt] = rt
|
302
|
+
else
|
303
|
+
additionalInfo[@obj.constants.error_rt] += rt
|
304
|
+
end
|
305
|
+
else
|
306
|
+
stat = updatert stat,rt
|
307
|
+
end
|
308
|
+
|
309
|
+
if (exc != nil)
|
310
|
+
logmetric = additionalInfo[@obj.constants.mf_logmetric]
|
311
|
+
if (logmetric == nil)
|
312
|
+
additionalInfo[@obj.constants.mf_logmetric] = exc
|
313
|
+
else
|
314
|
+
exc.each do |name, count|
|
315
|
+
logmetric[name] = logmetric[name].to_i + count
|
316
|
+
end
|
317
|
+
end
|
318
|
+
end
|
319
|
+
|
320
|
+
@bgTransaction[path] = [stat, additionalInfo]
|
321
|
+
end
|
322
|
+
|
205
323
|
if(dbl!=nil)
|
206
324
|
if @db.length < @obj.config.dbmetric_overflow_t
|
207
325
|
updatedb dbl,path
|
@@ -95,7 +95,7 @@ module ManageEngine
|
|
95
95
|
end
|
96
96
|
begin
|
97
97
|
trdata = getTrace(rootTracker)
|
98
|
-
trac = updateTrace(rootTracker
|
98
|
+
trac = updateTrace(rootTracker, trdata, exceptionInfo)
|
99
99
|
if(parseddata.has_key?("trace-data"))
|
100
100
|
traceData = parseddata["trace-data"];
|
101
101
|
traceData.push(trac);
|
@@ -136,7 +136,7 @@ module ManageEngine
|
|
136
136
|
ret = tdata["td"]
|
137
137
|
ret["rt"] = ret["rt"] + rootTracker.duration
|
138
138
|
else
|
139
|
-
ret = {"rt"=> rootTracker.duration, "path"=>rootTracker.
|
139
|
+
ret = {"rt"=> rootTracker.duration, "path"=>rootTracker.getTxnName, "type"=>rootTracker.getTxnType}
|
140
140
|
if (rootTracker.error?)
|
141
141
|
ret["error"] = true
|
142
142
|
end
|
@@ -193,10 +193,10 @@ module ManageEngine
|
|
193
193
|
excData[@obj.constants.mf_logmetric_warning] = excData[@obj.constants.mf_logmetric_warning].to_i + 1
|
194
194
|
end
|
195
195
|
|
196
|
-
def updateTrace(
|
196
|
+
def updateTrace(roottracker, trans, exceptionInfo)
|
197
197
|
# {"thread_name":"http-8080-6","s_time":1326276180289,"t_name":"transaction\/http\/Test-App\/login","r_time":18,"thread_id":141}
|
198
198
|
top = Array.new
|
199
|
-
path =
|
199
|
+
path = roottracker.getTxnName
|
200
200
|
det = {"thread_name"=>"rorthread","s_time"=>trans[0],"t_name"=>path,"r_time"=>trans[3],"thread_id"=>141}
|
201
201
|
|
202
202
|
exception = trans[5] != nil ? trans[5][@obj.constants.mf_exception_st] : nil
|
@@ -2,6 +2,7 @@ require 'agent/server/instrument/rails'
|
|
2
2
|
require 'agent/server/instrument/sinatra'
|
3
3
|
require 'agent/server/instrument/active_record'
|
4
4
|
require 'agent/server/instrument/action_view'
|
5
|
+
require 'agent/server/instrument/sidekiq_server'
|
5
6
|
|
6
7
|
module ManageEngine
|
7
8
|
class Environment
|
@@ -16,7 +17,8 @@ module ManageEngine
|
|
16
17
|
]
|
17
18
|
|
18
19
|
OTHER_INTERCEPTORS = [
|
19
|
-
ManageEngine::Instrumentation::ActionView.new
|
20
|
+
ManageEngine::Instrumentation::ActionView.new,
|
21
|
+
ManageEngine::Instrumentation::SidekiqServer.new
|
20
22
|
]
|
21
23
|
|
22
24
|
def detect_and_instrument
|
@@ -0,0 +1,38 @@
|
|
1
|
+
require 'agent/am_objectholder'
|
2
|
+
require 'agent/trackers/default_tracker'
|
3
|
+
|
4
|
+
module ManageEngine
|
5
|
+
module Instrumentation
|
6
|
+
class SidekiqClient
|
7
|
+
include Sidekiq::ClientMiddleware if defined?(Sidekiq::ClientMiddleware)
|
8
|
+
|
9
|
+
def call(worker, msg, queue, *_)
|
10
|
+
tracker = nil
|
11
|
+
result = nil
|
12
|
+
begin
|
13
|
+
# https://github.com/sidekiq/sidekiq/blob/main/lib/sidekiq/middleware/chain.rb
|
14
|
+
# Check comment section
|
15
|
+
jobName = msg["class"]
|
16
|
+
tracker = ManageEngine::Tracker::DefaultTracker.new("Sidekiq - " + msg["class"] + " - Job Id: " + msg["jid"])
|
17
|
+
tracker = ManageEngine::Agent::TrackerHandler.invokeTracker(tracker)
|
18
|
+
rescue Exception=>e
|
19
|
+
ManageEngine::APMObjectHolder.instance.log.info "Exception while creating tracker for sidekiq_client #{e}"
|
20
|
+
end
|
21
|
+
begin
|
22
|
+
result = yield
|
23
|
+
rescue Exception=>e
|
24
|
+
if (tracker != nil)
|
25
|
+
tracker.setError(e)
|
26
|
+
end
|
27
|
+
raise e
|
28
|
+
ensure
|
29
|
+
if tracker != nil
|
30
|
+
tracker.finish
|
31
|
+
ManageEngine::Agent::TrackerHandler.exitTracker(tracker)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
result
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,66 @@
|
|
1
|
+
require 'agent/am_objectholder'
|
2
|
+
require 'agent/trackers/root_tracker'
|
3
|
+
require 'agent/server/instrument/sidekiq_client'
|
4
|
+
|
5
|
+
module ManageEngine
|
6
|
+
module Instrumentation
|
7
|
+
class SidekiqServer
|
8
|
+
include Sidekiq::ServerMiddleware if defined?(Sidekiq::ServerMiddleware)
|
9
|
+
|
10
|
+
def present?
|
11
|
+
defined?(::Sidekiq::ServerMiddleware)
|
12
|
+
end
|
13
|
+
|
14
|
+
def version
|
15
|
+
Sidekiq::VERSION
|
16
|
+
end
|
17
|
+
|
18
|
+
def name
|
19
|
+
'Sidekiq'
|
20
|
+
end
|
21
|
+
|
22
|
+
def instrument
|
23
|
+
::Sidekiq.configure_server do |config|
|
24
|
+
config.server_middleware do |chain|
|
25
|
+
chain.add(ManageEngine::Instrumentation::SidekiqServer)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
::Sidekiq.configure_client do |config|
|
29
|
+
config.client_middleware do |chain|
|
30
|
+
chain.add(ManageEngine::Instrumentation::SidekiqClient)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
ManageEngine::APMObjectHolder.instance.log.info "Instrumenting #{name} Version: #{version}"
|
34
|
+
end
|
35
|
+
|
36
|
+
def call(worker, msg, queue, *_)
|
37
|
+
tracker = nil
|
38
|
+
begin
|
39
|
+
# https://github.com/sidekiq/sidekiq/blob/main/lib/sidekiq/middleware/chain.rb
|
40
|
+
# Check comment section
|
41
|
+
jobName = msg["class"]+".perform"
|
42
|
+
tracker = ManageEngine::Tracker::RootTracker.new(jobName + " jid: " + msg["jid"])
|
43
|
+
tracker.url = jobName
|
44
|
+
tracker.setTxnType(ManageEngine::APMObjectHolder.instance.constants.mf_bckgrnd)
|
45
|
+
#tracker.addAdditionalInfo(msg)
|
46
|
+
tracker = ManageEngine::Agent::TrackerHandler.invokeTracker(tracker)
|
47
|
+
rescue Exception=>e
|
48
|
+
ManageEngine::APMObjectHolder.instance.log.info "Exception while creating tracker for sidekiq_server #{e}"
|
49
|
+
end
|
50
|
+
begin
|
51
|
+
yield
|
52
|
+
rescue Exception=>e
|
53
|
+
if (tracker != nil)
|
54
|
+
tracker.setError(e)
|
55
|
+
end
|
56
|
+
raise e
|
57
|
+
ensure
|
58
|
+
if tracker != nil
|
59
|
+
tracker.finish
|
60
|
+
ManageEngine::Agent::TrackerHandler.exitTracker(tracker)
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
@@ -231,6 +231,8 @@ class APMWorker
|
|
231
231
|
if tdata.has_key?(name)
|
232
232
|
if (sd[0]["name"]=="apdex")
|
233
233
|
tdata[name][1] = mapdx(tdata[name][1],sd[1])
|
234
|
+
elsif (sd[0]["name"]=="bckgrnd")
|
235
|
+
tdata[name][1] = mapbg(tdata[name][1],sd[1])
|
234
236
|
else
|
235
237
|
tdata[name][1] = mapdb(tdata[name][1],sd[1])
|
236
238
|
end
|
@@ -263,7 +265,7 @@ class APMWorker
|
|
263
265
|
rtData[7] = rtData[7]+dat[0][7]
|
264
266
|
rtData[4] = rtData[3] != 0 ? (rtData[5].to_f + (rtData[6].to_f/2).to_f).to_f/rtData[3].to_f : 0
|
265
267
|
res[0] = rtData
|
266
|
-
|
268
|
+
res[1][@obj.constants.error_rt] += dat[1][@obj.constants.error_rt]
|
267
269
|
resExcepData = res[1][@obj.constants.mf_logmetric]
|
268
270
|
excepData = dat[1][@obj.constants.mf_logmetric]
|
269
271
|
if (resExcepData == nil)
|
@@ -281,6 +283,36 @@ class APMWorker
|
|
281
283
|
res
|
282
284
|
end
|
283
285
|
|
286
|
+
def mapbg res,dat
|
287
|
+
begin
|
288
|
+
rtData = res[0];
|
289
|
+
rtData[0] = rtData[0]+dat[0][0];
|
290
|
+
if dat[0][1]<rtData[1]
|
291
|
+
rtData[1]=dat[0][1]
|
292
|
+
end
|
293
|
+
if dat[0][2]>rtData[2]
|
294
|
+
rtData[2]=dat[0][2]
|
295
|
+
end
|
296
|
+
rtData[3] = rtData[3]+dat[0][3]
|
297
|
+
rtData[4] = rtData[4]+dat[0][4]
|
298
|
+
res[0] = rtData
|
299
|
+
res[1][@obj.constants.error_rt] += dat[1][@obj.constants.error_rt]
|
300
|
+
resExcepData = res[1][@obj.constants.mf_logmetric]
|
301
|
+
excepData = dat[1][@obj.constants.mf_logmetric]
|
302
|
+
if (resExcepData == nil)
|
303
|
+
resExcepData = excepData
|
304
|
+
else
|
305
|
+
if (excepData != nil)
|
306
|
+
resExcepData = resExcepData.merge(excepData){|key, oldval, newval| newval + oldval}
|
307
|
+
end
|
308
|
+
end
|
309
|
+
|
310
|
+
res[1][@obj.constants.mf_logmetric] = resExcepData != nil ? resExcepData : Hash.new
|
311
|
+
rescue Exception=>e
|
312
|
+
@obj.log.logException "Exception while merging bg data",e
|
313
|
+
end
|
314
|
+
res
|
315
|
+
end
|
284
316
|
def mapdb res,dat
|
285
317
|
res[0] = res[0]+dat[0];
|
286
318
|
if dat[1]<res[1]
|
@@ -4,12 +4,27 @@ module ManageEngine
|
|
4
4
|
module Tracker
|
5
5
|
class RootTracker < DefaultTracker
|
6
6
|
|
7
|
-
attr_accessor :status, :url
|
7
|
+
attr_accessor :status, :url, :txnType
|
8
8
|
|
9
9
|
def url=(url = "unknown")
|
10
10
|
@url = ManageEngine::APMObjectHolder.instance.txn_util.normalizeName(url)
|
11
11
|
end
|
12
12
|
|
13
|
+
def getTxnName
|
14
|
+
ManageEngine::APMObjectHolder.instance.constants.mf_transaction + getTxnType() + ManageEngine::APMObjectHolder.instance.constants.mf_separator + @url
|
15
|
+
end
|
16
|
+
|
17
|
+
def setTxnType(type)
|
18
|
+
@txnType=type
|
19
|
+
end
|
20
|
+
|
21
|
+
def getTxnType
|
22
|
+
if (@txnType == nil)
|
23
|
+
@txnType = ManageEngine::APMObjectHolder.instance.constants.mf_http
|
24
|
+
end
|
25
|
+
@txnType
|
26
|
+
end
|
27
|
+
|
13
28
|
def http_method(method)
|
14
29
|
@http_method = method
|
15
30
|
end
|
@@ -26,6 +41,17 @@ module ManageEngine
|
|
26
41
|
@status = httpcode
|
27
42
|
end
|
28
43
|
|
44
|
+
def addCustomParam key, value
|
45
|
+
if (@params == nil)
|
46
|
+
@params = Hash.new
|
47
|
+
end
|
48
|
+
@params[key] = value
|
49
|
+
end
|
50
|
+
|
51
|
+
def addAdditionalInfo param
|
52
|
+
@params = param
|
53
|
+
end
|
54
|
+
|
29
55
|
def getAdditionalInfo
|
30
56
|
info = super
|
31
57
|
if (@http_method != nil && @queryString != nil && @status != nil)
|
@@ -36,6 +62,12 @@ module ManageEngine
|
|
36
62
|
info["http_query_str"] = @queryString
|
37
63
|
info["httpcode"] = @status
|
38
64
|
end
|
65
|
+
if (@params != nil)
|
66
|
+
if (info == nil)
|
67
|
+
info = Hash.new
|
68
|
+
end
|
69
|
+
info["custom_params"] = @params
|
70
|
+
end
|
39
71
|
info
|
40
72
|
end
|
41
73
|
end
|
@@ -3,10 +3,10 @@ module ManageEngine
|
|
3
3
|
class APMConstants
|
4
4
|
|
5
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
|
-
attr_reader :site24x7USurl, :site24x7EUurl, :site24x7CNurl, :site24x7INurl, :site24x7AUurl, :site24x7GDurl, :site24x7JPurl
|
6
|
+
attr_reader :site24x7USurl, :site24x7EUurl, :site24x7CNurl, :site24x7INurl, :site24x7AUurl, :site24x7GDurl, :site24x7JPurl, :site24x7CAurl, :site24x7SAurl, :site24x7UKurl, :site24x7HDFCurl
|
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
|
-
attr_reader :mf_transaction,:mf_separator,:mf_db,:mf_apdex,:mf_namespace,:mf_name,:mf_all,:agent_store,:agent_lock,:mf_overflow
|
9
|
-
attr_reader :mf_logmetric, :mf_logmetric_warning, :mf_exception_st, :mf_err_st, :mf_loginfo, :mf_loginfo_time, :mf_loginfo_level, :mf_loginfo_str, :mf_loginfo_err_clz, :mf_loginfo_st, :mf_loginfo_level_warn
|
8
|
+
attr_reader :mf_transaction,:mf_separator,:mf_db,:mf_apdex,:mf_http,:mf_bckgrnd,:mf_namespace,:mf_name,:mf_all,:agent_store,:agent_lock,:mf_overflow
|
9
|
+
attr_reader :error_rt, :mf_logmetric, :mf_logmetric_warning, :mf_exception_st, :mf_err_st, :mf_loginfo, :mf_loginfo_time, :mf_loginfo_level, :mf_loginfo_str, :mf_loginfo_err_clz, :mf_loginfo_st, :mf_loginfo_level_warn
|
10
10
|
attr_reader :en_alphabets, :en_numerals
|
11
11
|
|
12
12
|
def initialize
|
@@ -57,6 +57,10 @@ module ManageEngine
|
|
57
57
|
@site24x7INurl = "https://plusinsight.site24x7.in/"
|
58
58
|
@site24x7GDurl = "https://gdplusinsight.site24x7.com/"
|
59
59
|
@site24x7JPurl = "https://plusinsight.site24x7.jp/"
|
60
|
+
@site24x7CAurl = "https://plusinsight.site24x7.ca/"
|
61
|
+
@site24x7SAurl = "https://plusinsight.site24x7.sa/"
|
62
|
+
@site24x7UKurl = "https://plusinsight.site24x7.uk/"
|
63
|
+
@site24x7HDFCurl = "https://hdplusinsight.site24x7.in/"
|
60
64
|
|
61
65
|
#Response Codes
|
62
66
|
@licence_expired = 701
|
@@ -78,10 +82,13 @@ module ManageEngine
|
|
78
82
|
@mf_all = "all"
|
79
83
|
|
80
84
|
@mf_separator = "/"
|
81
|
-
@mf_transaction = "transaction" + @mf_separator
|
85
|
+
@mf_transaction = "transaction" + @mf_separator
|
82
86
|
@mf_db = "db"
|
83
87
|
@mf_overflow = "0verf10w"
|
88
|
+
@mf_http = "http"
|
89
|
+
@mf_bckgrnd = "bckgrnd"
|
84
90
|
|
91
|
+
@error_rt = "error_rt"
|
85
92
|
@mf_logmetric = "logmetric"
|
86
93
|
@mf_logmetric_warning = "warning"
|
87
94
|
@mf_err_st = "err_st"
|
data/lib/agent/version.rb
CHANGED
metadata
CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
|
|
4
4
|
prerelease: false
|
5
5
|
segments:
|
6
6
|
- 1
|
7
|
-
-
|
8
|
-
-
|
9
|
-
version: 1.
|
7
|
+
- 9
|
8
|
+
- 0
|
9
|
+
version: 1.9.0
|
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: 2024-03-22 00:00:00 +05:30
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
@@ -125,6 +125,8 @@ files:
|
|
125
125
|
- lib/agent/server/instrument/am_instrumenter.rb
|
126
126
|
- lib/agent/server/instrument/environment.rb
|
127
127
|
- lib/agent/server/instrument/rails.rb
|
128
|
+
- lib/agent/server/instrument/sidekiq_client.rb
|
129
|
+
- lib/agent/server/instrument/sidekiq_server.rb
|
128
130
|
- lib/agent/server/instrument/sinatra.rb
|
129
131
|
- lib/agent/server/worker/am_worker.rb
|
130
132
|
- lib/agent/trackers/database_tracker.rb
|