site24x7_apminsight 1.2 → 1.3
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.
- data/VERSION +1 -1
- data/lib/agent/configuration/am_configuration.rb +3 -1
- data/lib/agent/metrics/am_metricsformatter.rb +86 -53
- data/lib/agent/metrics/am_metricsparser.rb +87 -24
- data/lib/agent/server/am_agent.rb +1 -1
- data/lib/agent/server/worker/am_worker.rb +2 -0
- data/lib/agent/util/am_constants.rb +12 -0
- data/lib/version.rb +13 -0
- data/site24x7-agent.gemspec +5 -2
- metadata +13 -12
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
1.
|
|
1
|
+
1.3.0
|
|
@@ -3,6 +3,7 @@ require 'json'
|
|
|
3
3
|
require 'socket'
|
|
4
4
|
require 'rails'
|
|
5
5
|
require 'agent/am_objectholder'
|
|
6
|
+
require 'version'
|
|
6
7
|
|
|
7
8
|
module ManageEngine
|
|
8
9
|
class APMConfig
|
|
@@ -27,6 +28,7 @@ module ManageEngine
|
|
|
27
28
|
@obj.log.debug "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@"
|
|
28
29
|
@obj.log.debug "APP HOME #{File.absolute_path(".")} "
|
|
29
30
|
@obj.log.debug "APP HOME #{Dir.pwd} "
|
|
31
|
+
@obj.log.debug "Agent Version : #{ManageEngine::APMInsight::VERSION}"
|
|
30
32
|
@obj.log.debug "Configuration : "
|
|
31
33
|
@obj.log.debug "Agent Name : #{@agenthost}"
|
|
32
34
|
@obj.log.debug "Agent Already Connected : #{@alreadyconnected}"
|
|
@@ -202,7 +204,7 @@ module ManageEngine
|
|
|
202
204
|
def getAgentInfo
|
|
203
205
|
data = Hash.new
|
|
204
206
|
agentdata = Hash.new
|
|
205
|
-
agentdata = {"application.type"=>"RUBY","application.name"=>@appname,"hostname"=>@agenthost,"port"=>@agentport,"agent.version"=>
|
|
207
|
+
agentdata = {"application.type"=>"RUBY","application.name"=>@appname,"hostname"=>@agenthost,"port"=>@agentport,"agent.version"=>ManageEngine::APMInsight::MAJOR_VERSION}
|
|
206
208
|
data["agent_info"]=agentdata
|
|
207
209
|
data["environment"]=getEnvData
|
|
208
210
|
data["custom_config_info"]=getAgentConfigData
|
|
@@ -6,8 +6,8 @@ module ManageEngine
|
|
|
6
6
|
@obj = ManageEngine::APMObjectHolder.instance
|
|
7
7
|
@apdex_threshold = 0
|
|
8
8
|
end
|
|
9
|
-
#trans Vs #[0-rspTime,1-min rt,2-max rt,3-cnt,4-apdx,5-stat,6-toler,7-frustating]
|
|
10
|
-
#DBtrans Vs #[rspTime,min rt,max rt,cnt]
|
|
9
|
+
#trans Vs #[0-rspTime,1-min rt,2-max rt,3-cnt,4-apdx,5-stat,6-toler,7-frustating,8-error_count]
|
|
10
|
+
#DBtrans Vs #[rspTime,min rt,max rt,cnt,error_count]
|
|
11
11
|
#trace
|
|
12
12
|
|
|
13
13
|
def format d
|
|
@@ -95,34 +95,41 @@ module ManageEngine
|
|
|
95
95
|
end
|
|
96
96
|
|
|
97
97
|
def updateinstance
|
|
98
|
-
ins_apdx =
|
|
99
|
-
|
|
100
|
-
rt = 0;
|
|
101
|
-
s=0;
|
|
102
|
-
t=0;
|
|
103
|
-
f=0;
|
|
104
|
-
min = -1;
|
|
105
|
-
max = 0;
|
|
98
|
+
ins_apdx = [0,-1,-1,0,0,0,0,0,0]
|
|
99
|
+
logmetric = Hash.new
|
|
106
100
|
@transaction.each do |key,value|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
101
|
+
apdexValue = value[0]
|
|
102
|
+
ins_apdx[0] += apdexValue[0]
|
|
103
|
+
if ins_apdx[1] == -1
|
|
104
|
+
ins_apdx[1] = apdexValue[1]
|
|
105
|
+
ins_apdx[2] = apdexValue[2]
|
|
106
|
+
else
|
|
107
|
+
if(apdexValue[1]<ins_apdx[1])
|
|
108
|
+
ins_apdx[1] = apdexValue[1]
|
|
109
|
+
end
|
|
110
|
+
if (apdexValue[2]>ins_apdx[2])
|
|
111
|
+
ins_apdx[2] = apdexValue[2]
|
|
112
|
+
end
|
|
117
113
|
end
|
|
118
|
-
|
|
114
|
+
ins_apdx[3] += apdexValue[3]
|
|
119
115
|
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
116
|
+
ins_apdx[5] += apdexValue[5]
|
|
117
|
+
ins_apdx[6] += apdexValue[6]
|
|
118
|
+
ins_apdx[7] += apdexValue[7]
|
|
119
|
+
ins_apdx[8] += apdexValue[8]
|
|
120
|
+
|
|
121
|
+
exceptions = value[1][@obj.constants.mf_logmetric]
|
|
122
|
+
if (exceptions != nil)
|
|
123
|
+
exceptions.each do |name, count|
|
|
124
|
+
logmetric[name] = logmetric[name].to_i + count
|
|
125
|
+
end
|
|
126
|
+
end
|
|
127
|
+
end
|
|
128
|
+
if (ins_apdx[3] > 0)
|
|
129
|
+
ins_apdx[4] = (ins_apdx[5].to_f + (ins_apdx[6]/2).to_f).to_f/ins_apdx[3].to_f
|
|
130
|
+
ins_apdx[0] = ins_apdx[0].round(2)
|
|
123
131
|
end
|
|
124
|
-
|
|
125
|
-
@instance[":apdex"]=[rt.round(2),min,max,cnt,apx,s,t,f]
|
|
132
|
+
@instance[":apdex"]=[ins_apdx, {@obj.constants.mf_logmetric=>logmetric}]
|
|
126
133
|
end
|
|
127
134
|
|
|
128
135
|
def updatedbinstance
|
|
@@ -130,6 +137,7 @@ module ManageEngine
|
|
|
130
137
|
rt = 0;
|
|
131
138
|
min = -1;
|
|
132
139
|
max = 0;
|
|
140
|
+
error_count = 0;
|
|
133
141
|
if(@db.length>0)
|
|
134
142
|
@db.each do |key,val|
|
|
135
143
|
value = val["metrics"]
|
|
@@ -145,8 +153,9 @@ module ManageEngine
|
|
|
145
153
|
max = value[2]
|
|
146
154
|
end
|
|
147
155
|
cnt = cnt + value[3]
|
|
156
|
+
error_count += value[4]
|
|
148
157
|
end
|
|
149
|
-
@dbinstance[":apdex"]=[rt.round(2),min,max,cnt]
|
|
158
|
+
@dbinstance[":apdex"]=[rt.round(2),min,max,cnt,error_count]
|
|
150
159
|
end
|
|
151
160
|
end
|
|
152
161
|
|
|
@@ -167,10 +176,21 @@ module ManageEngine
|
|
|
167
176
|
apx_stat = @transaction[path]
|
|
168
177
|
else
|
|
169
178
|
apx_stat = Array.new
|
|
170
|
-
apx_stat = [0,
|
|
179
|
+
apx_stat = [0,0,0,0,0,0,0,0,0]
|
|
171
180
|
end
|
|
172
|
-
|
|
173
|
-
|
|
181
|
+
|
|
182
|
+
if (pl.has_key?("error"))
|
|
183
|
+
apx_stat[8] += 1
|
|
184
|
+
else
|
|
185
|
+
apx_stat = apxarray apx_stat,rt
|
|
186
|
+
end
|
|
187
|
+
|
|
188
|
+
additionalInfo = Hash.new
|
|
189
|
+
if (pl.has_key?("exception"))
|
|
190
|
+
additionalInfo[@obj.constants.mf_logmetric] = pl["exception"]
|
|
191
|
+
end
|
|
192
|
+
|
|
193
|
+
@transaction[path] = [apx_stat, additionalInfo]
|
|
174
194
|
if(dbl!=nil)
|
|
175
195
|
if @db.length < @obj.config.metric_overflow_t
|
|
176
196
|
updatedb dbl,path
|
|
@@ -179,7 +199,7 @@ module ManageEngine
|
|
|
179
199
|
#@obj.log.info "data = #{@db}"
|
|
180
200
|
of = Hash.new
|
|
181
201
|
stats = Array.new
|
|
182
|
-
stats = [0,0,0,0]
|
|
202
|
+
stats = [0,0,0,0,0]
|
|
183
203
|
of["tpath"] = @obj.constants.mf_overflow
|
|
184
204
|
#of["tpath"] = @obj.constants.mf_transaction + @obj.constants.mf_separator + @obj.constants.mf_overflow #using this for testing purpose
|
|
185
205
|
of["path"] = @obj.constants.mf_db + @obj.constants.mf_separator + @obj.constants.mf_overflow + @obj.constants.mf_separator + "-" + @obj.constants.mf_separator
|
|
@@ -195,6 +215,7 @@ module ManageEngine
|
|
|
195
215
|
# Apmagent::ApmLogger.instance.info "update transaction end"
|
|
196
216
|
end
|
|
197
217
|
|
|
218
|
+
# Updates apdex score and increases statisfied, tolerating, frustrated count accordingly
|
|
198
219
|
def apxarray apx_stat,rt
|
|
199
220
|
|
|
200
221
|
# Apmagent::ApmLogger.instance.info "apxarray : start #{apx_stat}"
|
|
@@ -207,16 +228,19 @@ module ManageEngine
|
|
|
207
228
|
apx_stat[6] = apx_stat[6] + 1
|
|
208
229
|
end
|
|
209
230
|
|
|
210
|
-
|
|
231
|
+
if (apx_stat[3] > 0)
|
|
232
|
+
apx_stat[4] = (apx_stat[5].to_f + (apx_stat[6].to_f/2).to_f)/apx_stat[3].to_f
|
|
233
|
+
end
|
|
211
234
|
# Apmagent::ApmLogger.instance.info "apxarray : end #{apx_stat}"
|
|
212
235
|
apx_stat
|
|
213
236
|
end
|
|
214
237
|
|
|
238
|
+
# Updates resp time, min rt and max rt in apdex metric
|
|
215
239
|
def updatert apx_stat,rt
|
|
216
240
|
# Apmagent::ApmLogger.instance.info "updatert : start"
|
|
217
241
|
apx_stat[3] = apx_stat[3] +1
|
|
218
242
|
apx_stat[0] = apx_stat[0] + rt
|
|
219
|
-
if(rt < apx_stat[1])
|
|
243
|
+
if(apx_stat[1] == 0 || rt < apx_stat[1])
|
|
220
244
|
apx_stat[1] = rt
|
|
221
245
|
end
|
|
222
246
|
if(rt > apx_stat[2])
|
|
@@ -225,7 +249,8 @@ module ManageEngine
|
|
|
225
249
|
#Apmagent::ApmLogger.instance.info "updatert : end"
|
|
226
250
|
apx_stat
|
|
227
251
|
end
|
|
228
|
-
|
|
252
|
+
|
|
253
|
+
#DBtrans Vs #[rspTime,min rt,max rt,cnt,error_count]
|
|
229
254
|
def updatedb dpl,tpath
|
|
230
255
|
# Apmagent::ApmLogger.instance.info "updatedb : start"
|
|
231
256
|
dpl.each do |pl|
|
|
@@ -241,37 +266,45 @@ module ManageEngine
|
|
|
241
266
|
stat = val["metrics"]
|
|
242
267
|
else
|
|
243
268
|
val=Hash.new
|
|
269
|
+
val["tpath"] = tpath
|
|
270
|
+
val["path"] = dpath
|
|
244
271
|
stat = Array.new
|
|
245
|
-
stat = [
|
|
272
|
+
stat = [0,rt,rt,0,0]
|
|
273
|
+
end
|
|
274
|
+
if (pl["error"] != nil)
|
|
275
|
+
stat[4] += 1
|
|
276
|
+
else
|
|
277
|
+
stat = updatert stat,rt
|
|
246
278
|
end
|
|
247
|
-
stat = updatert stat,rt
|
|
248
|
-
val["tpath"] = tpath
|
|
249
|
-
val["path"] = dpath
|
|
250
279
|
val["metrics"] = stat
|
|
251
280
|
@db[path] = val
|
|
252
|
-
updatedboperations rt, pl["operation"]
|
|
281
|
+
updatedboperations rt, pl["operation"], pl["error"]
|
|
253
282
|
end
|
|
254
283
|
#Apmagent::ApmLogger.instance.info "updatedb : end"
|
|
255
284
|
end
|
|
256
285
|
|
|
257
|
-
def updatedboperations rt,operation
|
|
258
|
-
opstats = Array.new;
|
|
259
|
-
#puts "#{operation} "
|
|
286
|
+
def updatedboperations rt, operation, isError
|
|
260
287
|
if(@dboperations.has_key?(operation))
|
|
261
288
|
opstats = @dboperations[operation]
|
|
262
289
|
else
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
opstats[0] = opstats[0] + rt
|
|
266
|
-
if(rt<opstats[1])
|
|
267
|
-
opstats[1] = rt
|
|
290
|
+
opstats = Array.new;
|
|
291
|
+
opstats = [0.0,rt,rt,0,0]
|
|
268
292
|
end
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
293
|
+
|
|
294
|
+
if (isError)
|
|
295
|
+
opstats[4] += 1
|
|
296
|
+
else
|
|
297
|
+
opstats[0] = opstats[0] + rt
|
|
298
|
+
if(rt<opstats[1])
|
|
299
|
+
opstats[1] = rt
|
|
300
|
+
end
|
|
301
|
+
if (rt>opstats[2])
|
|
302
|
+
opstats[2] = rt
|
|
303
|
+
end
|
|
304
|
+
opstats[3] = opstats[3] +1
|
|
305
|
+
end
|
|
273
306
|
@dboperations[operation]=opstats
|
|
274
307
|
end
|
|
275
308
|
|
|
276
|
-
end
|
|
277
|
-
end
|
|
309
|
+
end#class
|
|
310
|
+
end#module
|
|
@@ -2,9 +2,12 @@ require 'agent/am_objectholder'
|
|
|
2
2
|
|
|
3
3
|
module ManageEngine
|
|
4
4
|
class APMMetricsParser
|
|
5
|
-
|
|
5
|
+
|
|
6
|
+
def initialize
|
|
6
7
|
@obj = ManageEngine::APMObjectHolder.instance
|
|
7
8
|
end
|
|
9
|
+
|
|
10
|
+
# Invoked by APMWorker in dc
|
|
8
11
|
def parse(data)
|
|
9
12
|
@obj = ManageEngine::APMObjectHolder.instance
|
|
10
13
|
parseddata = Hash.new
|
|
@@ -16,9 +19,11 @@ module ManageEngine
|
|
|
16
19
|
keyForTrans = key
|
|
17
20
|
# if(name=="process_action.action_controller")
|
|
18
21
|
#Transaction completed
|
|
19
|
-
tdata = Hash.new
|
|
20
|
-
trdbdata = Array.new
|
|
21
|
-
|
|
22
|
+
tdata = Hash.new #transaction data -> rt, path,..
|
|
23
|
+
trdbdata = Array.new #db data -> sql, operation, rt,..
|
|
24
|
+
exceptionData = Hash.new #exception data -> clz name, count
|
|
25
|
+
exceptionInfo = Array.new # data to be sent in trace as 'loginfo'
|
|
26
|
+
trdata = Array.new #trace data
|
|
22
27
|
started = false
|
|
23
28
|
redirect=false
|
|
24
29
|
ended =false;
|
|
@@ -27,6 +32,18 @@ module ManageEngine
|
|
|
27
32
|
#@obj.log.debug "Processing : #{arr["name"]}"
|
|
28
33
|
if(started || arr["name"]==("start_processing.action_controller") )
|
|
29
34
|
|
|
35
|
+
exception = arr["payload"][:exception] #[0-exception clz, 1-exception msg]
|
|
36
|
+
if (exception != nil)
|
|
37
|
+
exceptionData[exception[0]] = exceptionData[exception[0]].to_i + 1
|
|
38
|
+
exceptionData[@obj.constants.mf_logmetric_warning] = exceptionData[@obj.constants.mf_logmetric_warning].to_i + 1
|
|
39
|
+
logInfo = {@obj.constants.mf_loginfo_time=>arr["end"].to_i,
|
|
40
|
+
@obj.constants.mf_loginfo_level=>@obj.constants.mf_loginfo_level_warn,
|
|
41
|
+
@obj.constants.mf_loginfo_str=>exception[1],
|
|
42
|
+
@obj.constants.mf_loginfo_err_clz=>exception[0],
|
|
43
|
+
@obj.constants.mf_loginfo_st=>formatStacktrace(arr["payload"][:exception_object].backtrace)}
|
|
44
|
+
exceptionInfo.push(logInfo)
|
|
45
|
+
end
|
|
46
|
+
|
|
30
47
|
if(arr["name"]=="sql.active_record" && @obj.config.sql_capture)
|
|
31
48
|
dbd = getDBData(arr)
|
|
32
49
|
if tdata.has_key?("db")
|
|
@@ -41,6 +58,11 @@ module ManageEngine
|
|
|
41
58
|
elsif (arr["name"]=="process_action.action_controller")
|
|
42
59
|
|
|
43
60
|
tdata["td"]=getTransData(arr,tdata)
|
|
61
|
+
|
|
62
|
+
if (exception != nil)
|
|
63
|
+
tdata["td"]["error"] = true
|
|
64
|
+
end
|
|
65
|
+
tdata["td"]["exception"]=exceptionData
|
|
44
66
|
#if redirect
|
|
45
67
|
# started = false
|
|
46
68
|
# redirect=false
|
|
@@ -57,7 +79,7 @@ module ManageEngine
|
|
|
57
79
|
if (ret["rt"]).to_i > (@obj.config.trans_trace_t.to_f* 1000).to_i
|
|
58
80
|
tval = val[(start_index)..val.index(arr)]
|
|
59
81
|
#@obj.log.debug "Gng To Trace : #{start_index} to #{val.index(arr)}"
|
|
60
|
-
parseddata =updateTraceData tval,parseddata
|
|
82
|
+
parseddata =updateTraceData tval,parseddata,exceptionInfo
|
|
61
83
|
end
|
|
62
84
|
end
|
|
63
85
|
key = key + start_index.to_s
|
|
@@ -80,7 +102,7 @@ module ManageEngine
|
|
|
80
102
|
end
|
|
81
103
|
end
|
|
82
104
|
|
|
83
|
-
end
|
|
105
|
+
end # events - do-loop
|
|
84
106
|
|
|
85
107
|
if !ended
|
|
86
108
|
@obj.log.debug "Transactions in Thread Continues - so drop data in mem-store #{keyForTrans} -- #{start_index}"
|
|
@@ -97,12 +119,13 @@ module ManageEngine
|
|
|
97
119
|
#@obj.log.info "AFTER METRICS - #{@obj.store.metrics}"
|
|
98
120
|
@obj.log.debug "[Processing END for - #{key} ]"
|
|
99
121
|
#end
|
|
100
|
-
end
|
|
122
|
+
end # do-loop
|
|
101
123
|
rescue Exception=>e
|
|
102
124
|
@obj.log.info "Exception : #{e}"
|
|
103
125
|
@obj.log.logException "#{e.message}",e
|
|
104
126
|
end
|
|
105
127
|
# @obj.log.debug "[PARSER] End"
|
|
128
|
+
|
|
106
129
|
parseddata
|
|
107
130
|
end
|
|
108
131
|
|
|
@@ -119,7 +142,9 @@ module ManageEngine
|
|
|
119
142
|
end
|
|
120
143
|
parseddata
|
|
121
144
|
end
|
|
122
|
-
|
|
145
|
+
|
|
146
|
+
# Generates Trace for the transaction and updates it in 'parseddata' hash
|
|
147
|
+
def updateTraceData val,parseddata,exceptionInfo
|
|
123
148
|
if(parseddata.has_key?("trace-data"))
|
|
124
149
|
tData = parseddata["trace-data"];
|
|
125
150
|
if(tData.length == @obj.config.trace_overflow_t)
|
|
@@ -135,7 +160,7 @@ module ManageEngine
|
|
|
135
160
|
end
|
|
136
161
|
begin
|
|
137
162
|
trdata = getTrace val
|
|
138
|
-
trac = updateTrace(trdata)
|
|
163
|
+
trac = updateTrace(trdata, exceptionInfo)
|
|
139
164
|
if(parseddata.has_key?("trace-data"))
|
|
140
165
|
traceData = parseddata["trace-data"];
|
|
141
166
|
traceData.push(trac);
|
|
@@ -201,7 +226,7 @@ module ManageEngine
|
|
|
201
226
|
ret
|
|
202
227
|
end
|
|
203
228
|
|
|
204
|
-
|
|
229
|
+
# Generates DB metric
|
|
205
230
|
def getDBData(d)
|
|
206
231
|
pl = d["payload"]
|
|
207
232
|
rt = (d["end"] - d["start"])
|
|
@@ -222,6 +247,10 @@ module ManageEngine
|
|
|
222
247
|
name=pl[:name]
|
|
223
248
|
#name=pl["name"]
|
|
224
249
|
ret ={"rt"=>rt,"sql"=>format(sql),"sql-strip"=>sqlStrip,"name"=>name,"operation"=>sqlArr[0]}
|
|
250
|
+
|
|
251
|
+
if (pl[:exception] != nil)
|
|
252
|
+
ret["error"] = true
|
|
253
|
+
end
|
|
225
254
|
ret
|
|
226
255
|
end
|
|
227
256
|
|
|
@@ -283,27 +312,24 @@ module ManageEngine
|
|
|
283
312
|
sql = @obj.util.parametrizeQuery sql
|
|
284
313
|
trData[5] = {"query"=>sql}
|
|
285
314
|
end
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
315
|
trData
|
|
290
316
|
end
|
|
291
317
|
|
|
292
318
|
def updateQueryParams d,sql,binds,rt
|
|
293
319
|
ret = {"query"=>sql}
|
|
294
320
|
begin
|
|
295
|
-
args = "";
|
|
321
|
+
#args = "";
|
|
296
322
|
if binds!=nil && binds.size()>0
|
|
297
323
|
binds.each do |ar|
|
|
298
324
|
#args = args + ar.last + ","
|
|
299
325
|
if sql!=nil && sql.index("?")!=nil
|
|
300
|
-
sql["?"]=ar.
|
|
326
|
+
sql["?"]=ar.value.to_s
|
|
301
327
|
end
|
|
302
328
|
end
|
|
303
329
|
end
|
|
304
|
-
if args.length>0
|
|
305
|
-
|
|
306
|
-
end
|
|
330
|
+
#if args.length>0
|
|
331
|
+
# sql = sql + "\\nPARAMS - ["+args+ "]"
|
|
332
|
+
#end
|
|
307
333
|
ret = {"query"=>sql}
|
|
308
334
|
rescue Exception=>exe
|
|
309
335
|
@obj.log.logException "Not severe -#{exe.message}",exe
|
|
@@ -322,6 +348,28 @@ module ManageEngine
|
|
|
322
348
|
ret
|
|
323
349
|
end
|
|
324
350
|
|
|
351
|
+
def formatStacktrace(stacktrace)
|
|
352
|
+
strace = Array.new;
|
|
353
|
+
begin
|
|
354
|
+
stacktrace = Rails.backtrace_cleaner.clean(stacktrace)
|
|
355
|
+
stacktrace.each do |stackelement|
|
|
356
|
+
temp = Array.new
|
|
357
|
+
temp[0] = stackelement
|
|
358
|
+
temp[1] = ""
|
|
359
|
+
temp[2] = ""
|
|
360
|
+
temp[3] = ""
|
|
361
|
+
strace.push(temp)
|
|
362
|
+
if (strace.size == 20)
|
|
363
|
+
break;
|
|
364
|
+
end
|
|
365
|
+
end
|
|
366
|
+
rescue Exception=>e
|
|
367
|
+
@obj.log.logException "Error while formatting stack trace. #{e.message}", e
|
|
368
|
+
end
|
|
369
|
+
|
|
370
|
+
strace
|
|
371
|
+
end
|
|
372
|
+
|
|
325
373
|
def updateSQLStackTrace(d)
|
|
326
374
|
trace = Array.new;
|
|
327
375
|
started = false;
|
|
@@ -411,7 +459,13 @@ module ManageEngine
|
|
|
411
459
|
trData[2] = ""
|
|
412
460
|
trData[3] = (d["end"] - trData[0]).to_i
|
|
413
461
|
trData[4] = (d["end"] - trData[0]).to_i
|
|
414
|
-
trData[5] = nil
|
|
462
|
+
# trData[5] = nil
|
|
463
|
+
exception = pl[:exception_object]
|
|
464
|
+
if (exception != nil)
|
|
465
|
+
trData[5] = {@obj.constants.mf_exception_st=>formatStacktrace(exception.backtrace)}
|
|
466
|
+
else
|
|
467
|
+
trData[5] = nil
|
|
468
|
+
end
|
|
415
469
|
#trData[6] = Array.new
|
|
416
470
|
#dbTime = 0
|
|
417
471
|
#trdbdata.each do |dbData|
|
|
@@ -461,15 +515,24 @@ module ManageEngine
|
|
|
461
515
|
trData
|
|
462
516
|
end
|
|
463
517
|
|
|
464
|
-
def updateTrace(trans)
|
|
518
|
+
def updateTrace(trans, exceptionInfo)
|
|
465
519
|
# {"thread_name":"http-8080-6","s_time":1326276180289,"t_name":"transaction\/http\/Test-App\/login","r_time":18,"thread_id":141}
|
|
466
520
|
top = Array.new
|
|
467
521
|
path = @obj.constants.mf_transaction + @obj.constants.mf_separator + trans[1]
|
|
468
522
|
det = {"thread_name"=>"rorthread","s_time"=>trans[0],"t_name"=>path,"r_time"=>trans[3],"thread_id"=>141}
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
523
|
+
|
|
524
|
+
exception = trans[5] != nil ? trans[5][@obj.constants.mf_exception_st] : nil
|
|
525
|
+
if (exception != nil)
|
|
526
|
+
det[@obj.constants.mf_err_st] = exception
|
|
527
|
+
end
|
|
528
|
+
|
|
529
|
+
if (exceptionInfo.length > 0)
|
|
530
|
+
det[@obj.constants.mf_loginfo] = exceptionInfo
|
|
531
|
+
end
|
|
532
|
+
|
|
533
|
+
top[0] = det
|
|
534
|
+
top[1] = trans
|
|
535
|
+
top
|
|
473
536
|
end
|
|
474
537
|
|
|
475
538
|
def format s
|
|
@@ -58,7 +58,7 @@ module ManageEngine
|
|
|
58
58
|
aData["agent.id"]=aData.delete("instanceid")
|
|
59
59
|
aData["agent.enabled"]=true
|
|
60
60
|
@obj.config.updateAgentInfoFile(aData)
|
|
61
|
-
@obj.log.
|
|
61
|
+
@obj.log.info "[doConnect] Agent successfully connected - InstanceID : #{@obj.config.instance_id}"
|
|
62
62
|
end
|
|
63
63
|
|
|
64
64
|
if(!@obj.shutdown)
|
|
@@ -148,9 +148,11 @@ class APMWorker
|
|
|
148
148
|
end
|
|
149
149
|
result.push(merge(tdata))
|
|
150
150
|
resp = @obj.connector.post @obj.constants.connect_data_uri+@obj.config.instance_id,result
|
|
151
|
+
@obj.log.info "#{tdata.size} metric(s) dispatched."
|
|
151
152
|
if trdata.size>0
|
|
152
153
|
result[2]=trdata;
|
|
153
154
|
resp = @obj.connector.post @obj.constants.connect_trace_uri+@obj.config.instance_id,result
|
|
155
|
+
@obj.log.info "#{trdata.size} trace(s) dispatched."
|
|
154
156
|
end
|
|
155
157
|
end
|
|
156
158
|
|
|
@@ -5,6 +5,7 @@ module ManageEngine
|
|
|
5
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,:site24x7url, :mergepattern_conf
|
|
6
6
|
attr_reader :licence_exceeds,:licence_expired,:unmanage_agent,:manage_agent,:agent_config_updated,:error_notfound,:error_server,:delete_agent,:response_code,:custom_config_info
|
|
7
7
|
attr_reader :mf_transaction,:mf_separator,:mf_db,:mf_apdex,:mf_namespace,:mf_name,:mf_all,:agent_store,:agent_lock,:mf_overflow
|
|
8
|
+
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
9
|
|
|
9
10
|
def initialize
|
|
10
11
|
|
|
@@ -72,6 +73,17 @@ module ManageEngine
|
|
|
72
73
|
@mf_db = "db"
|
|
73
74
|
@mf_overflow = "0verf10w"
|
|
74
75
|
|
|
76
|
+
@mf_logmetric = "logmetric"
|
|
77
|
+
@mf_logmetric_warning = "warning"
|
|
78
|
+
@mf_err_st = "err_st"
|
|
79
|
+
@mf_exception_st = "exception_st"
|
|
80
|
+
@mf_loginfo = "loginfo"
|
|
81
|
+
@mf_loginfo_time = "time"
|
|
82
|
+
@mf_loginfo_level = "level"
|
|
83
|
+
@mf_loginfo_str = "str"
|
|
84
|
+
@mf_loginfo_err_clz = "err_clz"
|
|
85
|
+
@mf_loginfo_st = "st"
|
|
86
|
+
@mf_loginfo_level_warn = "WARN"
|
|
75
87
|
|
|
76
88
|
end
|
|
77
89
|
|
data/lib/version.rb
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# Holds the major and minor versions of the agent
|
|
2
|
+
# These values are used in gemspec and in agent communication
|
|
3
|
+
# This is one point change, no need to update version numbers at multiple places
|
|
4
|
+
#
|
|
5
|
+
# NOTE: Changing version in 'VERSION' file is optional.
|
|
6
|
+
|
|
7
|
+
module ManageEngine
|
|
8
|
+
class APMInsight
|
|
9
|
+
VERSION = '1.3'
|
|
10
|
+
MAJOR_VERSION = '1.3'
|
|
11
|
+
MINOR_VERSION = '0'
|
|
12
|
+
end
|
|
13
|
+
end
|
data/site24x7-agent.gemspec
CHANGED
|
@@ -3,13 +3,15 @@
|
|
|
3
3
|
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
|
4
4
|
# -*- encoding: utf-8 -*-
|
|
5
5
|
|
|
6
|
+
require './lib/version'
|
|
7
|
+
|
|
6
8
|
Gem::Specification.new do |s|
|
|
7
9
|
s.name = "site24x7_apminsight"
|
|
8
|
-
s.version =
|
|
10
|
+
s.version = ManageEngine::APMInsight::VERSION
|
|
9
11
|
|
|
10
12
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
|
11
13
|
s.authors = ["Adithyan P"]
|
|
12
|
-
s.date =
|
|
14
|
+
s.date = Date.today.to_s
|
|
13
15
|
s.description = "Site24x7 APMInsight 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 Ruby agent(site24x7_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 your user account in Site24x7"
|
|
14
16
|
|
|
15
17
|
s.email = "apm-insight@zohocorp.com"
|
|
@@ -24,6 +26,7 @@ Gem::Specification.new do |s|
|
|
|
24
26
|
"VERSION",
|
|
25
27
|
"site24x7-agent.gemspec",
|
|
26
28
|
"conf/apminsight.conf",
|
|
29
|
+
"lib/version.rb",
|
|
27
30
|
"lib/site24x7_apminsight.rb",
|
|
28
31
|
"lib/agent/am_objectholder.rb",
|
|
29
32
|
"lib/agent/logging/am_logger.rb",
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: site24x7_apminsight
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: '1.
|
|
4
|
+
version: '1.3'
|
|
5
5
|
prerelease:
|
|
6
6
|
platform: ruby
|
|
7
7
|
authors:
|
|
@@ -9,11 +9,11 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date:
|
|
12
|
+
date: 2017-01-25 00:00:00.000000000Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: shoulda
|
|
16
|
-
requirement: &
|
|
16
|
+
requirement: &27221448 !ruby/object:Gem::Requirement
|
|
17
17
|
none: false
|
|
18
18
|
requirements:
|
|
19
19
|
- - ! '>='
|
|
@@ -21,10 +21,10 @@ dependencies:
|
|
|
21
21
|
version: '0'
|
|
22
22
|
type: :development
|
|
23
23
|
prerelease: false
|
|
24
|
-
version_requirements: *
|
|
24
|
+
version_requirements: *27221448
|
|
25
25
|
- !ruby/object:Gem::Dependency
|
|
26
26
|
name: bundler
|
|
27
|
-
requirement: &
|
|
27
|
+
requirement: &27221160 !ruby/object:Gem::Requirement
|
|
28
28
|
none: false
|
|
29
29
|
requirements:
|
|
30
30
|
- - ~>
|
|
@@ -32,10 +32,10 @@ dependencies:
|
|
|
32
32
|
version: 1.0.0
|
|
33
33
|
type: :development
|
|
34
34
|
prerelease: false
|
|
35
|
-
version_requirements: *
|
|
35
|
+
version_requirements: *27221160
|
|
36
36
|
- !ruby/object:Gem::Dependency
|
|
37
37
|
name: jeweler
|
|
38
|
-
requirement: &
|
|
38
|
+
requirement: &27220872 !ruby/object:Gem::Requirement
|
|
39
39
|
none: false
|
|
40
40
|
requirements:
|
|
41
41
|
- - ~>
|
|
@@ -43,10 +43,10 @@ dependencies:
|
|
|
43
43
|
version: 1.6.4
|
|
44
44
|
type: :development
|
|
45
45
|
prerelease: false
|
|
46
|
-
version_requirements: *
|
|
46
|
+
version_requirements: *27220872
|
|
47
47
|
- !ruby/object:Gem::Dependency
|
|
48
48
|
name: rcov
|
|
49
|
-
requirement: &
|
|
49
|
+
requirement: &27220584 !ruby/object:Gem::Requirement
|
|
50
50
|
none: false
|
|
51
51
|
requirements:
|
|
52
52
|
- - ! '>='
|
|
@@ -54,10 +54,10 @@ dependencies:
|
|
|
54
54
|
version: '0'
|
|
55
55
|
type: :development
|
|
56
56
|
prerelease: false
|
|
57
|
-
version_requirements: *
|
|
57
|
+
version_requirements: *27220584
|
|
58
58
|
- !ruby/object:Gem::Dependency
|
|
59
59
|
name: rails
|
|
60
|
-
requirement: &
|
|
60
|
+
requirement: &27220296 !ruby/object:Gem::Requirement
|
|
61
61
|
none: false
|
|
62
62
|
requirements:
|
|
63
63
|
- - ! '>='
|
|
@@ -65,7 +65,7 @@ dependencies:
|
|
|
65
65
|
version: 3.0.0
|
|
66
66
|
type: :development
|
|
67
67
|
prerelease: false
|
|
68
|
-
version_requirements: *
|
|
68
|
+
version_requirements: *27220296
|
|
69
69
|
description: Site24x7 APMInsight gives you end-to-end web-transaction awareness of
|
|
70
70
|
Rails applications enabling you to isolate performance issues and resolve them quickly.
|
|
71
71
|
To monitor Rails application performance, download and deploy Ruby agent(site24x7_apminsight)
|
|
@@ -85,6 +85,7 @@ files:
|
|
|
85
85
|
- VERSION
|
|
86
86
|
- site24x7-agent.gemspec
|
|
87
87
|
- conf/apminsight.conf
|
|
88
|
+
- lib/version.rb
|
|
88
89
|
- lib/site24x7_apminsight.rb
|
|
89
90
|
- lib/agent/am_objectholder.rb
|
|
90
91
|
- lib/agent/logging/am_logger.rb
|