site24x7_apminsight 1.2.0 → 1.3

Sign up to get free protection for your applications and to get access to all the features.
data/LICENSE.txt CHANGED
@@ -1,4 +1,4 @@
1
- This License Agreement details the policy for license of ManageEngine APM Insight Ruby Agent ("Licensed Software")
1
+ This License Agreement details the policy for license of Site24x7 APM Insight Ruby Agent ("Licensed Software")
2
2
  Please read the following license carefully, before either (i) downloading the Licensed Software from an authorized website, or (ii) installing the Licensed Software. You acknowledge that you have read this License Agreement, have understood it, and agree to be bound by its terms. If you do not agree to the terms and conditions of this Agreement, do not download or install the Licensed Software.
3
3
 
4
4
  1. LICENSE GRANT
data/README.rdoc CHANGED
@@ -1,5 +1,5 @@
1
1
  APM Insight Ruby Agent
2
- Applications Manager's Ruby agent gives you end-to-end web-transaction awareness enabling you to isolate performance issues and resolve them quickly.Applications Manager requires a monitoring agent (ruby gem) to be deployed in your application server to monitor Ruby application performance. Download the latest Ruby Agent(apminsight.gem) and deploy it in your application server. The agent collects application performance metrics and sends it to the central Applications Manager server at fixed intervals i.e. every 60 seconds.
2
+ Site24x7 APM Insight Ruby agent gives you end-to-end web-transaction awareness enabling you to isolate performance issues and resolve them quickly. Site24x7 APM Insight requires a monitoring agent (ruby gem) to be deployed in your application server to monitor Ruby application performance. Download the latest Ruby Agent(site24x7_apminsight.gem) and deploy it in your application server. The agent collects application performance metrics and sends it to the central Site24x7 server at fixed intervals i.e. every 60 seconds. You can view them at https://site24x7.com in your accounts page.
3
3
 
4
4
  Installing APM Insight Agent
5
5
 
@@ -7,13 +7,13 @@ Installing APM Insight Agent
7
7
 
8
8
  * Install from RubyGems by using the following command in the system where Ruby is installed :
9
9
 
10
- gem install apminsight
10
+ gem install site24x7_apminsight
11
11
 
12
12
  OR
13
13
 
14
- * Download the apminsight.gem file directly from our website or the RubyGems website and run the command
14
+ * Download the site24x7_apminsight.gem file from your accounts page in https://site24x7.com (after sign in) or the RubyGems website and run the command
15
15
 
16
- gem install apminsight.gem
16
+ gem install site24x7_apminsight.gem
17
17
 
18
18
  Configuration
19
19
 
@@ -21,30 +21,28 @@ Configuration
21
21
 
22
22
  For each of your applications, add the following line to the application gemfile:
23
23
 
24
- gem 'apminsight'
24
+ gem 'site24x7_apminsight'
25
25
 
26
26
  OR
27
27
 
28
28
  For each of your applications, add the following line to the application initializer block:
29
29
 
30
- require 'apminsight'
30
+ require 'site24x7_apminsight'
31
31
 
32
- A copy of the configuration file apminsight.conf will be available in the <Gem Installed folder> /apminsight/conf/. Configure the class name in the configuration file(include.packages), so that all the methods in that class can be instrumented and details will be reported in tracedata.
32
+ A copy of the configuration file apminsight.conf will be available in the <Gem Installed folder> /site24x7_apminsight/conf/. Configure the class name in the configuration file(include.packages), so that all the methods in that class can be instrumented and details will be reported in tracedata.
33
33
 
34
34
 
35
35
  The following configuration options are mandatory and should be provided for the agent to be initialized:
36
36
 
37
- application.name - The application's name to be displayed in Applications Manager.
37
+ application.name - The application's name to be displayed in Site24x7 server.
38
38
 
39
- apm.host - The host where Applications Manager is running.
40
-
41
- apm.port - The HTTP port of Applications Manager.
39
+ license.key - The license api key from your account page after sign in (https://site24x7.com)
42
40
 
43
41
  behind.proxy - The proxy network under which the agent is installed
44
42
 
45
43
  agent.server.port - The HTTP listening port of the Application Server.
46
44
 
47
- More configuration options of APM Insight Ruby Agent can be found here.
45
+ More configuration options of APM Insight Ruby Agent can be found here. https://www.site24x7.com/help/apm/apm-insight-configuration.html
48
46
 
49
47
  Supported Environments :
50
48
 
@@ -54,16 +52,16 @@ Supported Environments :
54
52
 
55
53
  References
56
54
 
57
- * Download link for Applications Manager
58
-
59
- http://www.manageengine.com/products/applications_manager/
55
+ * Create an apminsight account in Site24x7 server (https://www.site24x7.com)
60
56
 
61
- * Download link for apminsight
57
+ * Download link for site24x7_apminsight gem
62
58
 
63
- http://www.manageengine.com/products/applications_manager/
64
- http://rubygems.org/gems/apminsight
59
+ From your account page after valid sign in
60
+ or
61
+ http://rubygems.org/gems/site24x7_apminsight
65
62
 
66
63
  * Help Documentation for apminsight
67
64
 
68
- http://www.manageengine.com/products/applications_manager/help/APMInsight/installing-transaction-agent.html
69
-
65
+ https://www.site24x7.com/help/apm/ruby-agent.html
66
+ https://support.site24x7.com/portal/helpcenter/site24x7/apm-insight/ruby-monitoring
67
+
data/Rakefile CHANGED
@@ -14,13 +14,13 @@ require 'rake'
14
14
  require 'jeweler'
15
15
  Jeweler::Tasks.new do |gem|
16
16
  # gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
17
- gem.name = "apminsight"
18
- gem.homepage = "http://www.manageengine.com/products/applications_manager/ruby-webtransaction-monitoring.html"
17
+ gem.name = "site24x7_apminsight"
18
+ gem.homepage = "https://www.site24x7.com/help/apm/ruby-agent.html"
19
19
  gem.license = "MIT"
20
20
  gem.summary = %Q{Application Performace Monitor}
21
21
  gem.description = %Q{Application Performace Monitor : Monitor the web tranasactions}
22
22
  gem.email = "apm-insight@zohocorp.com"
23
- gem.authors = ["Sabarinathan P"]
23
+ gem.authors = ["Rajalakshmi Ezhilan"]
24
24
  gem.files=Dir.glob('lib/**/*.*')
25
25
  # dependencies defined in Gemfile
26
26
  end
@@ -48,7 +48,7 @@ Rake::RDocTask.new do |rdoc|
48
48
  version = File.exist?('VERSION') ? File.read('VERSION') : ""
49
49
 
50
50
  rdoc.rdoc_dir = 'rdoc'
51
- rdoc.title = "apminsight #{version}"
51
+ rdoc.title = "site24x7_apminsight #{version}"
52
52
  rdoc.rdoc_files.include('README*')
53
53
  rdoc.rdoc_files.include('lib/**/*.*')
54
54
  rdoc.rdoc_files.include('lib/agent/**/*.*')
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.2
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"=>"1.2"}
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 = Array.new
99
- cnt = 0;
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
- rt = rt + value[0]
108
- if min == -1
109
- min = value[1]
110
- max = value[2]
111
- end
112
- if(value[1]<min)
113
- min = value[1]
114
- end
115
- if (value[2]>max)
116
- max = value[2]
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
- cnt = cnt + value[3]
114
+ ins_apdx[3] += apdexValue[3]
119
115
 
120
- s = s + value[5]
121
- t = t + value[6]
122
- f = f + value[7]
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
- apx = (s.to_f + (t/2).to_f).to_f/cnt.to_f
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,rt,rt,0,0,0,0,0]
179
+ apx_stat = [0,0,0,0,0,0,0,0,0]
171
180
  end
172
- apx_stat = apxarray apx_stat,rt
173
- @transaction[path] = apx_stat
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
- apx_stat[4] = (apx_stat[5].to_f + (apx_stat[6].to_f/2).to_f)/apx_stat[3].to_f
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
- #DBtrans Vs #[rspTime,min rt,max rt,cnt]
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 = [rt,rt,rt,0]
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
- opstats = [0.0,rt,rt,0]
264
- end
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
- if (rt>opstats[2])
270
- opstats[2] = rt
271
- end
272
- opstats[3] = opstats[3] +1
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
- def initialize
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
- trdata = Array.new
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
- def updateTraceData val,parseddata
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.last
326
+ sql["?"]=ar.value.to_s
301
327
  end
302
328
  end
303
329
  end
304
- if args.length>0
305
- sql = sql + "\\nPARAMS - ["+args+ "]"
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
- #trans[6] = db;
470
- top[0] = det
471
- top[1] = trans
472
- top
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.debug "[doConnect] Connected - InstanceID : #{@obj.config.instance_id}"
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
@@ -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 = "1.2.0"
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 = "2016-12-19"
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,85 +1,71 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: site24x7_apminsight
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: '1.3'
5
+ prerelease:
5
6
  platform: ruby
6
7
  authors:
7
8
  - Adithyan P
8
9
  autorequire:
9
10
  bindir: bin
10
11
  cert_chain: []
11
- date: 2016-12-19 00:00:00.000000000 Z
12
+ date: 2017-01-25 00:00:00.000000000Z
12
13
  dependencies:
13
14
  - !ruby/object:Gem::Dependency
14
15
  name: shoulda
15
- requirement: !ruby/object:Gem::Requirement
16
+ requirement: &27221448 !ruby/object:Gem::Requirement
17
+ none: false
16
18
  requirements:
17
- - - ">="
19
+ - - ! '>='
18
20
  - !ruby/object:Gem::Version
19
21
  version: '0'
20
22
  type: :development
21
23
  prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - ">="
25
- - !ruby/object:Gem::Version
26
- version: '0'
24
+ version_requirements: *27221448
27
25
  - !ruby/object:Gem::Dependency
28
26
  name: bundler
29
- requirement: !ruby/object:Gem::Requirement
27
+ requirement: &27221160 !ruby/object:Gem::Requirement
28
+ none: false
30
29
  requirements:
31
- - - "~>"
30
+ - - ~>
32
31
  - !ruby/object:Gem::Version
33
32
  version: 1.0.0
34
33
  type: :development
35
34
  prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - "~>"
39
- - !ruby/object:Gem::Version
40
- version: 1.0.0
35
+ version_requirements: *27221160
41
36
  - !ruby/object:Gem::Dependency
42
37
  name: jeweler
43
- requirement: !ruby/object:Gem::Requirement
38
+ requirement: &27220872 !ruby/object:Gem::Requirement
39
+ none: false
44
40
  requirements:
45
- - - "~>"
41
+ - - ~>
46
42
  - !ruby/object:Gem::Version
47
43
  version: 1.6.4
48
44
  type: :development
49
45
  prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - "~>"
53
- - !ruby/object:Gem::Version
54
- version: 1.6.4
46
+ version_requirements: *27220872
55
47
  - !ruby/object:Gem::Dependency
56
48
  name: rcov
57
- requirement: !ruby/object:Gem::Requirement
49
+ requirement: &27220584 !ruby/object:Gem::Requirement
50
+ none: false
58
51
  requirements:
59
- - - ">="
52
+ - - ! '>='
60
53
  - !ruby/object:Gem::Version
61
54
  version: '0'
62
55
  type: :development
63
56
  prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - ">="
67
- - !ruby/object:Gem::Version
68
- version: '0'
57
+ version_requirements: *27220584
69
58
  - !ruby/object:Gem::Dependency
70
59
  name: rails
71
- requirement: !ruby/object:Gem::Requirement
60
+ requirement: &27220296 !ruby/object:Gem::Requirement
61
+ none: false
72
62
  requirements:
73
- - - ">="
63
+ - - ! '>='
74
64
  - !ruby/object:Gem::Version
75
65
  version: 3.0.0
76
66
  type: :development
77
67
  prerelease: false
78
- version_requirements: !ruby/object:Gem::Requirement
79
- requirements:
80
- - - ">="
81
- - !ruby/object:Gem::Version
82
- version: 3.0.0
68
+ version_requirements: *27220296
83
69
  description: Site24x7 APMInsight gives you end-to-end web-transaction awareness of
84
70
  Rails applications enabling you to isolate performance issues and resolve them quickly.
85
71
  To monitor Rails application performance, download and deploy Ruby agent(site24x7_apminsight)
@@ -97,43 +83,45 @@ files:
97
83
  - README.rdoc
98
84
  - Rakefile
99
85
  - VERSION
86
+ - site24x7-agent.gemspec
100
87
  - conf/apminsight.conf
88
+ - lib/version.rb
89
+ - lib/site24x7_apminsight.rb
101
90
  - lib/agent/am_objectholder.rb
102
- - lib/agent/configuration/am_configuration.rb
103
91
  - lib/agent/logging/am_logger.rb
104
- - lib/agent/metrics/am_metricscollector.rb
92
+ - lib/agent/configuration/am_configuration.rb
93
+ - lib/agent/util/am_constants.rb
94
+ - lib/agent/util/am_util.rb
105
95
  - lib/agent/metrics/am_metricsformatter.rb
106
- - lib/agent/metrics/am_metricsparser.rb
107
96
  - lib/agent/metrics/am_metricstore.rb
97
+ - lib/agent/metrics/am_metricscollector.rb
98
+ - lib/agent/metrics/am_metricsparser.rb
108
99
  - lib/agent/server/am_agent.rb
109
100
  - lib/agent/server/am_connector.rb
101
+ - lib/agent/server/worker/am_worker.rb
110
102
  - lib/agent/server/instrument/am_apm.rb
111
103
  - lib/agent/server/instrument/am_instrumenter.rb
112
- - lib/agent/server/worker/am_worker.rb
113
- - lib/agent/util/am_constants.rb
114
- - lib/agent/util/am_util.rb
115
- - lib/site24x7_apminsight.rb
116
- - site24x7-agent.gemspec
117
104
  homepage: https://www.site24x7.com/help/apm/ruby-agent.html
118
105
  licenses: []
119
- metadata: {}
120
106
  post_install_message:
121
107
  rdoc_options: []
122
108
  require_paths:
123
109
  - lib
124
110
  required_ruby_version: !ruby/object:Gem::Requirement
111
+ none: false
125
112
  requirements:
126
- - - ">="
113
+ - - ! '>='
127
114
  - !ruby/object:Gem::Version
128
115
  version: '0'
129
116
  required_rubygems_version: !ruby/object:Gem::Requirement
117
+ none: false
130
118
  requirements:
131
- - - ">="
119
+ - - ! '>='
132
120
  - !ruby/object:Gem::Version
133
121
  version: '0'
134
122
  requirements: []
135
123
  rubyforge_project:
136
- rubygems_version: 2.5.1
124
+ rubygems_version: 1.7.2
137
125
  signing_key:
138
126
  specification_version: 3
139
127
  summary: Site24x7 APMInsight gives you end-to-end web-transaction awareness of Rails
checksums.yaml DELETED
@@ -1,7 +0,0 @@
1
- ---
2
- SHA1:
3
- metadata.gz: 032c120ceab9ac813a443666cd20afc8417abee5
4
- data.tar.gz: 53fcb0baf07f8ea9146fb895b784bcfc32e1f72b
5
- SHA512:
6
- metadata.gz: ac75fa482fee2f69d7e7e0b3728f3ce86553002d41a81a842aff0a0d5f7a277e292a182f757362ee9cd1dbbd51c6a6a318e77155ceb40aa04caff5929ec8f8e0
7
- data.tar.gz: e4caabce3d0918c160a8d69b4a1876a5eb5b10cc421a884cf1ab6336f8fe1adaafd0249ada5381f9aa43394199f7b358ed6cb4da365d24e9a1928bb230ced73c