site24x7_apminsight 1.9.2 → 1.9.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 61471f26922c97dccfc1294d9565f8be9009b4031c6b75a41f776628c3a6295e
4
- data.tar.gz: 0d34c97c8a0501b9c655fddd09decaf45c26c5be5e08c82a4046ac229a144fd4
3
+ metadata.gz: ef71f92d00c156ed7effd7fa726820409f00bab68076033c970d6ceec197c8d5
4
+ data.tar.gz: '095a029352700363cfdc03029946c7d76d1e529c5e9d421bb0526fe25f9ccd53'
5
5
  SHA512:
6
- metadata.gz: 99cf966c504848406f8d870eadaa1947eb91af4278b864073a4820a237038ba68606524188102110d2eaef7a395e2e0ebcaa1be97c746ceb23ad64037997a5b8
7
- data.tar.gz: 3ac8d504af5ed03b369ca08ff48158d6407e80f07153476647a0698f32fa90c01e05736cbf7811c9b78f11d4109c8fb2f470c5d8f5ad9ec7232f2667c611c875
6
+ metadata.gz: c187ad0e32c93c24e772b470c7b732285187bccf36687981ab28ae41935ad0bbfebe2ca04a60cafd4a3af2e08837ebb70e8e6ff8b269c8f4a8aa497284566cd5
7
+ data.tar.gz: 6b0233843a2a86cca28cdf2f29531c546eebbfafb59ff9909efa371d16250a1cd3f8f9738a8a68d6ac165c40b9e742b40235e78418136b2d7b724ac96af6bc71
@@ -3,11 +3,11 @@ require 'agent/metrics/exception_record'
3
3
  module APMInsight
4
4
  module Agent
5
5
  class SequenceBook
6
- attr_reader :openTracker, :closedTracker, :rootTracker, :trackerCount, :closedTrackerCount, :exceptionBag, :listenFlag
6
+ attr_reader :openTracker, :rootTracker, :trackerCount, :exceptionBag, :listenFlag
7
7
 
8
8
  def initialize
9
- @rootTracker = createDummyTracker()
10
- @closedTracker = @rootTracker
9
+ @rootTracker = nil
10
+ #@closedTracker = @rootTracker
11
11
  @openTracker = nil
12
12
 
13
13
  @trackerCount = 0
@@ -22,32 +22,34 @@ module APMInsight
22
22
  end
23
23
 
24
24
  # If RootTracker is not set, check type and set
25
- if @rootTracker == @closedTracker
25
+ if @rootTracker == nil
26
26
  if !tracker.is_a?(ManageEngine::Tracker::RootTracker)
27
27
  closeSequence()
28
28
  return nil
29
29
  end
30
30
  @rootTracker = tracker
31
-
32
31
  updateListenFlag()
33
32
  end
34
33
 
34
+ tracker.setParent(openTracker)
35
+ @openTracker = tracker
36
+
35
37
 
36
38
  # Attach tracker as Sibling or Child and set nominee
37
- if @closedTracker != nil
38
- tracker.sibling = @closedTracker
39
- @closedTracker.sibling = tracker # Nominee - if dropped/corrupted, defaults to this tracker
40
- @openTracker = tracker
41
- @closedTracker = nil
42
- else
43
- if tracker.equal?(@openTracker)
44
- return nil
45
- end
46
-
47
- @openTracker.child = tracker
48
- tracker.sibling = @openTracker
49
- @openTracker = tracker
50
- end
39
+ # if @closedTracker != nil
40
+ # tracker.sibling = @closedTracker
41
+ # @closedTracker.sibling = tracker # Nominee - if dropped/corrupted, defaults to this tracker
42
+ # @openTracker = tracker
43
+ # @closedTracker = nil
44
+ # else
45
+ # if tracker.equal?(@openTracker)
46
+ # return nil
47
+ # end
48
+ #
49
+ # @openTracker.child = tracker
50
+ # tracker.sibling = @openTracker
51
+ # @openTracker = tracker
52
+ # end
51
53
 
52
54
  checkAndArrestSequence()
53
55
 
@@ -55,24 +57,26 @@ module APMInsight
55
57
  end
56
58
 
57
59
  def closeTracker tracker
58
- @closedTrackerCount += 1
59
- @closedTracker = tracker
60
- tracker.sibling = nil
61
- @openTracker = nil
60
+ # @closedTrackerCount += 1
61
+ # @closedTracker = tracker
62
+ # tracker.sibling = nil
63
+ # @openTracker = nil
64
+ @openTracker = tracker.parent;
62
65
 
63
66
  # Marks end of transaction
64
- if @rootTracker == tracker
67
+ # if @rootTracker == tracker
68
+ if @openTracker == nil
65
69
  if @listenFlag < 1 || (@listenFlag >= 1 && @trackerCount > 0)
66
70
  # if some trackers are not closed, while processing the metrics, it may go into infinite loop
67
- if (@closedTrackerCount - @trackerCount) == 0
71
+ # if (@closedTrackerCount - @trackerCount) == 0
68
72
  sequenceBag = Hash.new
69
73
  sequenceBag["roottracker"] = @rootTracker
70
74
  sequenceBag["exceptions"] = @exceptionBag
71
75
 
72
76
  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
77
+ # else
78
+ # ManageEngine::APMObjectHolder.instance.log.warn "Some trackers are not closed, dropping the metrics for #{@rootTracker.url}"
79
+ # end
76
80
  end
77
81
  closeSequence()
78
82
  end
@@ -124,6 +124,8 @@ module ManageEngine
124
124
  ins_apdx = [0,-1,-1,0,0,0,0,0,0]
125
125
  logmetric = Hash.new
126
126
  error_rt = 0
127
+ httpstatus = Hash.new
128
+
127
129
  @transaction.each do |key,value|
128
130
  apdexValue = value[0]
129
131
  ins_apdx[0] += apdexValue[0]
@@ -150,16 +152,23 @@ module ManageEngine
150
152
  end
151
153
  exceptions = value[1][@obj.constants.mf_logmetric]
152
154
  if (exceptions != nil)
153
- exceptions.each do |name, count|
154
- logmetric[name] = logmetric[name].to_i + count
155
- end
155
+ logmetric = logmetric.merge(exceptions) { |key, oldval, newval| oldval + newval }
156
+ # exceptions.each do |name, count|
157
+ # logmetric[name] = logmetric[name].to_i + count
158
+ # end
156
159
  end
160
+
161
+ status = value[1][@obj.constants.httpstatus]
162
+ if (status != nil)
163
+ httpstatus = httpstatus.merge(status) { |key, oldval, newval| oldval + newval }
164
+ end
157
165
  end
158
166
  if (ins_apdx[3] > 0)
159
167
  ins_apdx[4] = (ins_apdx[5].to_f + (ins_apdx[6]/2).to_f).to_f/ins_apdx[3].to_f
160
168
  ins_apdx[0] = ins_apdx[0].round(2)
161
169
  end
162
- @instance[":apdex"]=[ins_apdx, {@obj.constants.mf_logmetric=>logmetric, @obj.constants.error_rt=>error_rt}]
170
+
171
+ @instance[":apdex"]=[ins_apdx, {@obj.constants.mf_logmetric=>logmetric, @obj.constants.error_rt=>error_rt, @obj.constants.httpstatus=>httpstatus}]
163
172
  end
164
173
 
165
174
  def updatebginstance
@@ -233,6 +242,7 @@ module ManageEngine
233
242
  pl = d["td"]
234
243
  dbl = d["db"]
235
244
  exc = d["exception"]
245
+ # comp = d["comp"]
236
246
 
237
247
  rt = pl["rt"].round(2)
238
248
  # path = @obj.constants.mf_transaction + @obj.constants.mf_separator + pl["path"]
@@ -266,6 +276,20 @@ module ManageEngine
266
276
  apx_stat = apxarray apx_stat,rt
267
277
  end
268
278
 
279
+ if (pl.has_key?("status"))
280
+ statusHash = additionalInfo[@obj.constants.httpstatus]
281
+ if (statusHash == nil)
282
+ statusHash = Hash.new
283
+ additionalInfo[@obj.constants.httpstatus] = statusHash
284
+ end
285
+
286
+ if (statusHash.has_key?(pl["status"]))
287
+ statusHash[pl["status"]] += 1
288
+ else
289
+ statusHash[pl["status"]] = 1
290
+ end
291
+ end
292
+
269
293
  if (exc != nil)
270
294
  logmetric = additionalInfo[@obj.constants.mf_logmetric]
271
295
  if (logmetric == nil)
@@ -277,6 +301,20 @@ module ManageEngine
277
301
  end
278
302
  end
279
303
 
304
+ # if (comp != nil)
305
+ # begin
306
+ # compData = additionalInfo[@obj.constants.components]
307
+ # if (compData == nil)
308
+ # compData = Array.new
309
+ # additionalInfo[@obj.constants.components] = compData
310
+ # end
311
+ # comp.each do |name, info|
312
+ # if (compData.has)
313
+ # end
314
+ # rescue Exception=>e
315
+ # end
316
+ # end
317
+
280
318
  @transaction[path] = [apx_stat, additionalInfo]
281
319
  else
282
320
  stat = nil
@@ -417,7 +455,7 @@ module ManageEngine
417
455
  opstats = @dboperations[operation]
418
456
  else
419
457
  opstats = Array.new;
420
- opstats = [0.0,rt,rt,0,0]
458
+ opstats = [0,rt,rt,0,0]
421
459
  end
422
460
 
423
461
  if (isError)
@@ -25,6 +25,10 @@ module ManageEngine
25
25
  tdata["td"] = getTransData(rootTracker,tdata)
26
26
  tdata["db"] = getDBData(rootTracker, tdata, exceptionInfo)
27
27
 
28
+ if (rootTracker.error?) # root tracker will be left out in above flow
29
+ updateExceptionMetric(rootTracker.error, tdata) # <= previously it was 'ret'
30
+ updateExceptionInfo(exceptionInfo, rootTracker.endtime.to_i, rootTracker.error)
31
+ end
28
32
  exceptionBag = seqData["exceptions"]
29
33
  if exceptionBag != nil
30
34
  exceptionBag.each do |exceptionRecord|
@@ -87,14 +91,15 @@ module ManageEngine
87
91
  tData.push(trac)
88
92
  parseddata["trace-data"]=tData
89
93
  @obj.log.debug "dummy trace added"
94
+ @obj.log.debug "trace threshold exceeded. Current Size: #{@obj.config.trace_overflow_t}"
90
95
  return parseddata
91
96
  elsif tData.length > @obj.config.trace_overflow_t
92
- @obj.log.debug "trace threshold exceeded. Current Size: #{@obj.config.trace_overflow_t}"
93
97
  return parseddata
94
98
  end
95
99
  end
96
100
  begin
97
- trdata = getTrace(rootTracker)
101
+ #trdata = getTrace(rootTracker)
102
+ trdata = rootTracker.getTrace()
98
103
  trac = updateTrace(rootTracker, trdata, exceptionInfo)
99
104
  if(parseddata.has_key?("trace-data"))
100
105
  traceData = parseddata["trace-data"];
@@ -141,6 +146,10 @@ module ManageEngine
141
146
  ret["error"] = true
142
147
  end
143
148
  end
149
+ if (rootTracker.getStatus != nil && rootTracker.getStatus >= 400)
150
+ ret["status"] = rootTracker.getStatus
151
+ ret["error"] = true
152
+ end
144
153
  rescue Exception=>e
145
154
  #@obj.log.logException "Exception in getTranseData: #{e.message}",e
146
155
  raise e
@@ -150,38 +159,92 @@ module ManageEngine
150
159
 
151
160
  # Generates DB metric
152
161
  def getDBData(tracker, tdata, exceptionInfo)
153
- while (tracker != nil)
154
- tdata["db"] = getDBData(tracker.child, tdata, exceptionInfo)
155
-
156
- if tracker.kind_of?(ManageEngine::Tracker::DatabaseTracker)
157
- if tdata["db"] == nil
158
- tdata["db"] = Array.new
159
- end
160
-
161
- queryInfo = tracker.getQueryInfo
162
- sqlStrip = queryInfo[0] + "/" + queryInfo[1] + "/dummydb"
163
-
164
- ret ={"rt"=>tracker.duration, "sql"=>tracker.getRawQuery,
165
- "sql-strip"=>sqlStrip, "name"=>tracker.name, "operation"=>queryInfo[0]}
166
-
167
- if (tracker.error?)
168
- ret["error"] = true
169
- end
170
-
171
- tdata["db"].push(ret)
172
- end ## DBTracker check
173
-
174
- if (tracker.error?)
175
- updateExceptionMetric(tracker.error, tdata) # <= previously it was 'ret'
176
- updateExceptionInfo(exceptionInfo, tracker.endtime.to_i, tracker.error)
177
- end
178
-
179
- tracker = tracker.sibling
180
- end ## while loop
162
+ if (tracker != nil)
163
+ children = tracker.children
164
+ children.each do |child|
165
+ tdata["db"] = getDBData(child, tdata, exceptionInfo)
166
+ if child.kind_of?(ManageEngine::Tracker::DatabaseTracker)
167
+ if tdata["db"] == nil
168
+ tdata["db"] = Array.new
169
+ end
170
+ queryInfo = child.getQueryInfo
171
+ sqlStrip = queryInfo[0] + "/" + queryInfo[1] + "/dummydb"
172
+ ret ={"rt"=>child.duration, "sql"=>child.getRawQuery,
173
+ "sql-strip"=>sqlStrip, "name"=>child.name, "operation"=>queryInfo[0]}
174
+
175
+ if (child.error?)
176
+ ret["error"] = true
177
+ end
178
+
179
+ tdata["db"].push(ret)
180
+ end ## DBTracker check
181
+
182
+ # updateComponentData(child, tdata)
183
+ if (child.error?)
184
+ updateExceptionMetric(child.error, tdata) # <= previously it was 'ret'
185
+ updateExceptionInfo(exceptionInfo, child.endtime.to_i, child.error)
186
+ end
187
+ end #end of children iteration
188
+
189
+ # tdata["db"] = getDBData(tracker.child, tdata, exceptionInfo)
190
+ #
191
+ # if tracker.kind_of?(ManageEngine::Tracker::DatabaseTracker)
192
+ # if tdata["db"] == nil
193
+ # tdata["db"] = Array.new
194
+ # end
195
+ #
196
+ # queryInfo = tracker.getQueryInfo
197
+ # sqlStrip = queryInfo[0] + "/" + queryInfo[1] + "/dummydb"
198
+ #
199
+ # ret ={"rt"=>tracker.duration, "sql"=>tracker.getRawQuery,
200
+ # "sql-strip"=>sqlStrip, "name"=>tracker.name, "operation"=>queryInfo[0]}
201
+ #
202
+ # if (tracker.error?)
203
+ # ret["error"] = true
204
+ # end
205
+ #
206
+ # tdata["db"].push(ret)
207
+ # end ## DBTracker check
208
+ #
209
+ # if (tracker.error?)
210
+ # updateExceptionMetric(tracker.error, tdata) # <= previously it was 'ret'
211
+ # updateExceptionInfo(exceptionInfo, tracker.endtime.to_i, tracker.error)
212
+ # end
213
+ #
214
+ # tracker = tracker.sibling
215
+ end ## if tracker nil
181
216
 
182
217
  tdata["db"]
183
218
  end
184
219
 
220
+ def updateComponentData (tracker, tdata)
221
+ begin
222
+ compData = tdata["comp"]
223
+ if (compData == nil)
224
+ compData = Hash.new
225
+ tdata["comp"] = compData
226
+ end
227
+ info = compData[tracker.component]
228
+ if (info == nil)
229
+ info = Hash.new
230
+ compData[tracker.component] = info
231
+ info[@obj.constants.component_name] = tracker.component
232
+ info[@obj.constants.component_time] = tracker.duration
233
+ info[@obj.constants.component_count] = 1
234
+ if (tracker.error?)
235
+ info[@obj.constants.component_error_count] = 1
236
+ end
237
+ else
238
+ info[@obj.constants.component_time] += tracker.duration
239
+ info[@obj.constants.component_count] += 1
240
+ if (tracker.error?)
241
+ info[@obj.constants.component_error_count] += 1
242
+ end
243
+ end
244
+ rescue Exception=>e
245
+ end
246
+ end
247
+
185
248
  def updateExceptionMetric (exception, tdata)
186
249
  excData = tdata["exception"]
187
250
  if (excData == nil)
@@ -197,7 +260,8 @@ module ManageEngine
197
260
  # {"thread_name":"http-8080-6","s_time":1326276180289,"t_name":"transaction\/http\/Test-App\/login","r_time":18,"thread_id":141}
198
261
  top = Array.new
199
262
  path = roottracker.getTxnName
200
- det = {"thread_name"=>"rorthread","s_time"=>trans[0],"t_name"=>path,"r_time"=>trans[3],"thread_id"=>141}
263
+ det = {"s_time"=>trans[0],"t_name"=>path,"r_time"=>trans[3]}
264
+ det = det.merge(roottracker.getTraceInfo)
201
265
 
202
266
  exception = trans[5] != nil ? trans[5][@obj.constants.mf_exception_st] : nil
203
267
  if (exception != nil)
@@ -213,54 +277,54 @@ module ManageEngine
213
277
  top
214
278
  end
215
279
 
216
- def getTrace(rootTracker)
217
- trace = Array.new
218
- traceDetails(rootTracker, trace)
219
-
220
- return trace[0]
221
- end
222
-
223
- def traceDetails tracker, traceArr
224
-
225
- siblingDuration = 0
226
-
227
- while tracker != nil
228
-
229
- childTrace = Array.new
230
- childDuration = traceDetails tracker.child, childTrace
231
-
232
- traceItem = Array.new
233
- traceItem[0] = tracker.starttime
234
- if tracker.kind_of?(ManageEngine::Tracker::DatabaseTracker)
235
- queryInfo = tracker.getQueryInfo
236
- traceItem[1] = queryInfo[0] + " - " + queryInfo[1]
237
- else
238
- traceItem[1] = tracker.name
239
- end
240
- traceItem[2] = ""
241
- traceItem[3] = tracker.duration
242
- traceItem[4] = tracker.duration - childDuration
243
- traceItem[5] = tracker.getAdditionalInfo
244
- traceItem[6] = childTrace.empty? ? nil : childTrace
245
-
246
- traceArr.push(traceItem)
247
-
248
- siblingDuration += tracker.duration
249
-
250
- tracker = tracker.sibling
251
- end
252
-
253
- return siblingDuration
254
- end
255
-
256
-
257
- def updateExclusiveTrace data
258
- childs = data[6]
259
- childs.each do |arr|
260
- data[4] = data[4] - (updateExclusiveTrace arr)[3]
261
- end
262
- data
263
- end
280
+ # def getTrace(rootTracker)
281
+ # trace = Array.new
282
+ # traceDetails(rootTracker, trace)
283
+ #
284
+ # return trace[0]
285
+ # end
286
+ #
287
+ # def traceDetails tracker, traceArr
288
+ #
289
+ # siblingDuration = 0
290
+ #
291
+ # while tracker != nil
292
+ #
293
+ # childTrace = Array.new
294
+ # childDuration = traceDetails tracker.child, childTrace
295
+ #
296
+ # traceItem = Array.new
297
+ # traceItem[0] = tracker.starttime
298
+ # if tracker.kind_of?(ManageEngine::Tracker::DatabaseTracker)
299
+ # queryInfo = tracker.getQueryInfo
300
+ # traceItem[1] = queryInfo[0] + " - " + queryInfo[1]
301
+ # else
302
+ # traceItem[1] = tracker.name
303
+ # end
304
+ # traceItem[2] = ""
305
+ # traceItem[3] = tracker.duration
306
+ # traceItem[4] = tracker.duration - childDuration
307
+ # traceItem[5] = tracker.getAdditionalInfo
308
+ # traceItem[6] = childTrace.empty? ? nil : childTrace
309
+ #
310
+ # traceArr.push(traceItem)
311
+ #
312
+ # siblingDuration += tracker.duration
313
+ #
314
+ # tracker = tracker.sibling
315
+ # end
316
+ #
317
+ # return siblingDuration
318
+ # end
319
+ #
320
+ #
321
+ # def updateExclusiveTrace data
322
+ # childs = data[6]
323
+ # childs.each do |arr|
324
+ # data[4] = data[4] - (updateExclusiveTrace arr)[3]
325
+ # end
326
+ # data
327
+ # end
264
328
 
265
329
 
266
330
  end
@@ -27,25 +27,34 @@ module ManageEngine
27
27
  def instrument
28
28
  @obj = ManageEngine::APMObjectHolder.instance
29
29
  @obj.log.info "Instrumenting ActionController.. Rails Version: #{version}"
30
- @railsTracker = nil
31
30
 
32
31
  ActiveSupport::Notifications.subscribe('start_processing.action_controller') do |name, start, finish, id, payload|
33
- path = payload[:path].partition("?")[0]
34
- @railsTracker = ManageEngine::Tracker::RootTracker.new("#{payload[:controller]}.#{payload[:action]}", start.to_f * 1000)
35
- @railsTracker.url=(path)
36
- @railsTracker = ManageEngine::Agent::TrackerHandler.invokeTracker(@railsTracker)
32
+ result = payload[:path].partition("?")
33
+ railsTracker = ManageEngine::Tracker::RootTracker.new("#{payload[:controller]}.#{payload[:action]}", start.to_f * 1000)
34
+ railsTracker.url=(result[0])
35
+ railsTracker.queryString(result[2]) # even if value not available empty string will be returned
36
+ railsTracker.http_method(payload[:method])
37
+ railsTracker.http_params(payload[:params])
38
+
39
+ railsTracker = ManageEngine::Agent::TrackerHandler.invokeTracker(railsTracker)
40
+ Thread.current[:railsTracker] = railsTracker
37
41
  end # subscribe
38
42
 
39
43
 
40
44
  ActiveSupport::Notifications.subscribe('process_action.action_controller') do |name, start, finish, id, payload|
41
- if @railsTracker != nil
42
- @railsTracker.finish(finish.to_f * 1000)
43
- exception = payload[:exception_object]
44
- if exception != nil
45
- @railsTracker.setError(exception)
46
- @railsTracker.setStatus(500) # By default, set 500 as status for error txns
45
+ begin
46
+ railsTracker = Thread.current[:railsTracker]
47
+ if (railsTracker != nil)
48
+ railsTracker.finish(finish.to_f * 1000)
49
+ railsTracker.setStatus(payload[:status])
50
+ exception = payload[:exception_object]
51
+ if exception != nil
52
+ railsTracker.setError(exception)
53
+ end
54
+ ManageEngine::Agent::TrackerHandler.exitTracker(railsTracker)
47
55
  end
48
- ManageEngine::Agent::TrackerHandler.exitTracker(@railsTracker)
56
+ rescue Exception=>e
57
+ @obj.log.logException("Unable to process controller event #{name}. Exception: " ,e)
49
58
  end
50
59
  end
51
60
 
@@ -2,6 +2,11 @@ module ManageEngine
2
2
  module Tracker
3
3
  class DatabaseTracker < DefaultTracker
4
4
 
5
+ def initialize(name = "unknown", time = ManageEngine::APMObjectHolder.instance.util.currenttimemillis)
6
+ super(name, time)
7
+ @component = "DATABASE"
8
+ end
9
+
5
10
  def sql(query)
6
11
  @query = format(query.dup)
7
12
  end
@@ -77,11 +82,12 @@ module ManageEngine
77
82
  when "describe" then sqlArr[1]
78
83
  else "-"
79
84
  end
80
-
85
+ @signature = sqlArr[0] + " - " + tableName
81
86
  return [sqlArr[0], tableName]
82
87
 
83
88
  rescue Exception=>e
84
89
  @logger.logException "Error processing query #{sql} Exception: #{e.message}",e
90
+ @signature = sqlArr[0] + " - "
85
91
  return [sqlArr[0], '-']
86
92
  end
87
93
  end
@@ -120,6 +126,13 @@ module ManageEngine
120
126
  "#{@name} - #{@query}"
121
127
  end
122
128
 
129
+ def getTrace
130
+ trace = super
131
+ if (@signature != nil)
132
+ trace[1] = @signature
133
+ end
134
+ trace
135
+ end
123
136
  end
124
137
  end
125
138
  end
@@ -3,11 +3,13 @@ module ManageEngine
3
3
 
4
4
  class DefaultTracker
5
5
 
6
- attr_accessor :name, :error, :endtime, :starttime, :child, :sibling
6
+ attr_accessor :name, :error, :endtime, :starttime, :component, :children, :parent
7
7
 
8
- def initialize(name = "unknonwn", time = ManageEngine::APMObjectHolder.instance.util.currenttimemillis)
8
+ def initialize(name = "unknown", time = ManageEngine::APMObjectHolder.instance.util.currenttimemillis)
9
9
  @starttime = time.to_i
10
10
  @name = name
11
+ @component = "APP CODE"
12
+ @children = Array.new
11
13
  @logger = ManageEngine::APMObjectHolder.instance.log
12
14
  end
13
15
 
@@ -15,6 +17,17 @@ module ManageEngine
15
17
  @endtime = time.to_i
16
18
  end
17
19
 
20
+ def setParent(parentTracker)
21
+ @parent = parentTracker
22
+ if parentTracker != nil
23
+ parentTracker.children[parentTracker.children.length]=self
24
+ end
25
+ end
26
+
27
+ def component
28
+ @component
29
+ end
30
+
18
31
  def error?
19
32
  @error != nil
20
33
  end
@@ -56,6 +69,24 @@ module ManageEngine
56
69
  end
57
70
  end
58
71
 
72
+ def getTrace
73
+ trace = Array.new(7)
74
+ trace[0] = @starttime
75
+ trace[1] = @name
76
+ trace[2] = @component
77
+ trace[3] = duration()
78
+ trace[4] = trace[3] #exclusive time
79
+ trace[5] = getAdditionalInfo()
80
+ if (children.length > 0)
81
+ trace[6] = Array.new
82
+ children.each do |child|
83
+ trace[4] -= child.duration() #computing exclusive time of parent
84
+ trace[6].push(child.getTrace())
85
+ end
86
+ end # children exists check
87
+ trace
88
+ end # getTrace
89
+
59
90
  end
60
91
 
61
92
  end
@@ -34,13 +34,19 @@ module ManageEngine
34
34
  end
35
35
 
36
36
  def queryString(querystring)
37
- @queryString = querystring
37
+ if (!querystring.empty?)
38
+ @queryString = querystring
39
+ end
38
40
  end
39
41
 
40
42
  def setStatus(httpcode)
41
43
  @status = httpcode
42
44
  end
43
45
 
46
+ def getStatus
47
+ @status
48
+ end
49
+
44
50
  def addCustomParam key, value
45
51
  if (@params == nil)
46
52
  @params = Hash.new
@@ -52,20 +58,19 @@ module ManageEngine
52
58
  @params = param
53
59
  end
54
60
 
55
- def getAdditionalInfo
56
- info = super
57
- if (@http_method != nil && @queryString != nil && @status != nil)
58
- if (info == nil)
59
- info = Hash.new
60
- end
61
+ def getTraceInfo
62
+ info = Hash.new
63
+ if (@http_method != nil) #&& @queryString != nil && @status != nil
61
64
  info["http_method_name"] = @http_method
65
+ end
66
+ if (@queryString != nil)
62
67
  info["http_query_str"] = @queryString
68
+ info["http_input_params"] = nil
69
+ end
70
+ if (@status != nil)
63
71
  info["httpcode"] = @status
64
72
  end
65
73
  if (@params != nil)
66
- if (info == nil)
67
- info = Hash.new
68
- end
69
74
  info["custom_params"] = @params
70
75
  end
71
76
  info
@@ -7,6 +7,7 @@ module ManageEngine
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_http,:mf_bckgrnd,:mf_namespace,:mf_name,:mf_all,:agent_store,:agent_lock,:mf_overflow
9
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
+ attr_reader :components,:component_name,:component_time,:component_count,:component_error_count,:component_isExternal,:component_ext_host,:component_ext_port,:component_ext_ip,:httpstatus
10
11
  attr_reader :en_alphabets, :en_numerals
11
12
 
12
13
  def initialize
@@ -88,6 +89,17 @@ module ManageEngine
88
89
  @mf_http = "http"
89
90
  @mf_bckgrnd = "bckgrnd"
90
91
 
92
+ @components = "components"
93
+ @component_name = "name"
94
+ @component_time = "rt"
95
+ @component_count = "ct"
96
+ @component_error_count = "error"
97
+ @component_isExternal = "isExt"
98
+ @component_ext_host = "host"
99
+ @component_ext_port = "port"
100
+ @component_ext_ip = "ip"
101
+
102
+ @httpstatus = "httpcode"
91
103
  @error_rt = "error_rt"
92
104
  @mf_logmetric = "logmetric"
93
105
  @mf_logmetric_warning = "warning"
data/lib/agent/version.rb CHANGED
@@ -6,8 +6,8 @@
6
6
 
7
7
  module ManageEngine
8
8
  class APMInsight
9
- VERSION = '1.9.2'
9
+ VERSION = '1.9.3'
10
10
  MAJOR_VERSION = '1.9'
11
- MINOR_VERSION = '2'
11
+ MINOR_VERSION = '3'
12
12
  end
13
13
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: site24x7_apminsight
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.9.2
4
+ version: 1.9.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adithyan P
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-09-04 00:00:00.000000000 Z
11
+ date: 2024-09-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: shoulda