site24x7_apminsight 1.9.0 → 1.9.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 61471f26922c97dccfc1294d9565f8be9009b4031c6b75a41f776628c3a6295e
4
+ data.tar.gz: 0d34c97c8a0501b9c655fddd09decaf45c26c5be5e08c82a4046ac229a144fd4
5
+ SHA512:
6
+ metadata.gz: 99cf966c504848406f8d870eadaa1947eb91af4278b864073a4820a237038ba68606524188102110d2eaef7a395e2e0ebcaa1be97c746ceb23ad64037997a5b8
7
+ data.tar.gz: 3ac8d504af5ed03b369ca08ff48158d6407e80f07153476647a0698f32fa90c01e05736cbf7811c9b78f11d4109c8fb2f470c5d8f5ad9ec7232f2667c611c875
@@ -180,7 +180,7 @@ module ManageEngine
180
180
  @metric_overflow_t=250
181
181
  @dbmetric_overflow_t=500
182
182
  @trace_overflow_t=30
183
- @site24x7url = @obj.constants.site24x7USurl #default agent communication URL
183
+ #@site24x7url = @obj.constants.site24x7USurl #default agent communication URL
184
184
  @delayedStart = false
185
185
  end
186
186
 
@@ -267,6 +267,28 @@ module ManageEngine
267
267
  end
268
268
 
269
269
  def getHostType
270
+ begin
271
+ # Checking for OpenShift
272
+ if (ENV.has_key?('OPENSHIFT_BUILD_NAMESPACE'))
273
+ @obj.log.info "Agent is hosted in OpenShift"
274
+ @hostType = "DOCKER"
275
+ return @hostType
276
+ end
277
+ # Checking for k8s env
278
+ if (ENV.has_key?('KUBERNETES_SERVICE_HOST'))
279
+ @obj.log.info "Agent is hosted in Kubernetes"
280
+ @hostType = "DOCKER"
281
+ return @hostType
282
+ end
283
+ # Checking for Docker
284
+ if (File.exist?('/.dockerenv') || File.read('/proc/1/cgroup').include?('docker'))
285
+ @obj.log.info "Agent is hosted in DOCKER"
286
+ @hostType = "DOCKER"
287
+ return @hostType
288
+ end
289
+ rescue Exception => e
290
+ end
291
+
270
292
  begin
271
293
  # Check for AWS environment
272
294
  url = URI.parse('http://169.254.169.254/latest/meta-data/') # AWS metadata url
@@ -275,6 +297,20 @@ module ManageEngine
275
297
  if (response.kind_of? Net::HTTPOK)
276
298
  @hostType = "AWS"
277
299
  return @hostType
300
+ elsif (response.kind_of? Net::HTTPUnauthorized)
301
+ uri = URI('http://169.254.169.254/latest/api/token')
302
+ request = Net::HTTP::Put.new(uri)
303
+ request['X-aws-ec2-metadata-token-ttl-seconds'] = '30'
304
+ response = Net::HTTP.start(uri.hostname, uri.port) {|http| http.request(request)}
305
+ token = response.body
306
+ url = URI.parse('http://169.254.169.254/latest/meta-data/instance-id') # AWS metadata url
307
+ request = Net::HTTP::Get.new(url.path)
308
+ request['X-aws-ec2-metadata-token'] = token
309
+ response = Net::HTTP.start(url.host, url.port, :read_timeout => 2) {|http| http.request(request)}
310
+ if (response.kind_of? Net::HTTPOK)
311
+ @hostType = "AWS"
312
+ return @hostType
313
+ end
278
314
  end
279
315
  rescue Exception => e
280
316
  end
@@ -294,6 +330,7 @@ module ManageEngine
294
330
  begin
295
331
  # Check for Heroku env. In the backgroud it is using AWS EC2, hence sending as AWS
296
332
  if (ENV.has_key?('DYNO') || ENV.has_key?('STACK'))
333
+ @obj.log.info "Agent is hosted in Heroku"
297
334
  @hostType = "AWS"
298
335
  return @hostType
299
336
  end
@@ -385,6 +422,9 @@ module ManageEngine
385
422
  if defined?(Rainbows) then
386
423
  dispatcher = "rainbows"
387
424
  end
425
+ if defined?(Puma) then
426
+ dispatcher = "puma"
427
+ end
388
428
  dispatcher
389
429
  end
390
430
 
@@ -107,8 +107,8 @@ module ManageEngine
107
107
 
108
108
 
109
109
  def logException(msg,e)
110
- @apmlog.warn( "#{msg} => #{e.message}")
111
- @apmlog.warn( "Message : #{msg}\nTrace :\n#{e.backtrace}")
110
+ @apmlog.warn( "#{msg} => #{e.message} => #{e.backtrace}")
111
+ #@apmlog.warn( "Message : #{msg}\nTrace :\n#{e.backtrace}")
112
112
  end
113
113
 
114
114
  def close
@@ -3,6 +3,7 @@ require 'agent/server/instrument/sinatra'
3
3
  require 'agent/server/instrument/active_record'
4
4
  require 'agent/server/instrument/action_view'
5
5
  require 'agent/server/instrument/sidekiq_server'
6
+ require 'agent/server/instrument/puma'
6
7
 
7
8
  module ManageEngine
8
9
  class Environment
@@ -18,7 +19,8 @@ module ManageEngine
18
19
 
19
20
  OTHER_INTERCEPTORS = [
20
21
  ManageEngine::Instrumentation::ActionView.new,
21
- ManageEngine::Instrumentation::SidekiqServer.new
22
+ ManageEngine::Instrumentation::SidekiqServer.new,
23
+ ManageEngine::Instrumentation::PumaWorker.new
22
24
  ]
23
25
 
24
26
  def detect_and_instrument
@@ -0,0 +1,39 @@
1
+ module ManageEngine
2
+ module Instrumentation
3
+ class PumaWorker
4
+
5
+ def present?
6
+ defined?(Puma::Server)
7
+ end
8
+
9
+ def version
10
+ Puma::Const::PUMA_VERSION
11
+ end
12
+
13
+ def env
14
+ ENV['RACK_ENV'] || ENV['RAILS_ENV'] || 'development'
15
+ end
16
+
17
+ def name
18
+ 'Puma Worker'
19
+ end
20
+
21
+ def instrument
22
+ ManageEngine::APMObjectHolder.instance.log.info "Instrumenting Puma server workers. Version: #{version}"
23
+ Puma::Server.class_eval do
24
+ include ManageEngine::Instrumentation::PumaRun
25
+ alias original_run run
26
+ alias run agent_run
27
+ end
28
+ end
29
+ end
30
+
31
+ module PumaRun
32
+ def agent_run(*args, &block)
33
+ ::ManageEngine::APMObjectHolder.instance.agent.doCollect
34
+ original_run(*args, &block)
35
+ end
36
+ end
37
+
38
+ end
39
+ end
@@ -265,7 +265,18 @@ class APMWorker
265
265
  rtData[7] = rtData[7]+dat[0][7]
266
266
  rtData[4] = rtData[3] != 0 ? (rtData[5].to_f + (rtData[6].to_f/2).to_f).to_f/rtData[3].to_f : 0
267
267
  res[0] = rtData
268
- res[1][@obj.constants.error_rt] += dat[1][@obj.constants.error_rt]
268
+
269
+ # error_rt merge
270
+ res_error_rt = res[1][@obj.constants.error_rt];
271
+ dat_error_rt = dat[1][@obj.constants.error_rt];
272
+ if (res_error_rt != nil)
273
+ if (dat_error_rt != nil)
274
+ res[1][@obj.constants.error_rt] = res_error_rt + dat_error_rt;
275
+ end
276
+ elsif (dat_error_rt != nil)
277
+ res[1][@obj.constants.error_rt] = dat_errror_rt;
278
+ end
279
+
269
280
  resExcepData = res[1][@obj.constants.mf_logmetric]
270
281
  excepData = dat[1][@obj.constants.mf_logmetric]
271
282
  if (resExcepData == nil)
@@ -296,7 +307,18 @@ class APMWorker
296
307
  rtData[3] = rtData[3]+dat[0][3]
297
308
  rtData[4] = rtData[4]+dat[0][4]
298
309
  res[0] = rtData
299
- res[1][@obj.constants.error_rt] += dat[1][@obj.constants.error_rt]
310
+
311
+ # error_rt merge
312
+ res_error_rt = res[1][@obj.constants.error_rt];
313
+ dat_error_rt = dat[1][@obj.constants.error_rt];
314
+ if (res_error_rt != nil)
315
+ if (dat_error_rt != nil)
316
+ res[1][@obj.constants.error_rt] = res_error_rt + dat_errror_rt;
317
+ end
318
+ elsif (dat_error_rt != nil)
319
+ res[1][@obj.constants.error_rt] = dat_errror_rt;
320
+ end
321
+
300
322
  resExcepData = res[1][@obj.constants.mf_logmetric]
301
323
  excepData = dat[1][@obj.constants.mf_logmetric]
302
324
  if (resExcepData == nil)
@@ -48,10 +48,28 @@ module ManageEngine
48
48
 
49
49
  begin
50
50
  tableName = case sqlArr[0]
51
- when "select" then sqlArr[sqlArr.index("from")+1]
52
- when "insert" then sqlArr[sqlArr.index("into")+1]
51
+ when "select" then
52
+ fromIndex = sqlArr.index("from");
53
+ if(fromIndex != nil)
54
+ sqlArr[fromIndex+1]
55
+ else
56
+ "-"
57
+ end
58
+ when "insert" then
59
+ intoIndex = sqlArr.index("into");
60
+ if(intoIndex != nil)
61
+ sqlArr[intoIndex+1]
62
+ else
63
+ "-"
64
+ end
53
65
  when "update" then sqlArr[1]
54
- when "delete" then sqlArr[sqlArr.index("from")+1]
66
+ when "delete" then
67
+ fromIndex = sqlArr.index("from");
68
+ if(fromIndex != nil)
69
+ sqlArr[fromIndex+1]
70
+ else
71
+ "-"
72
+ end
55
73
  when "create" then sqlArr[1] + sqlArr[2]
56
74
  when "alter" then sqlArr[1] + sqlArr[2]
57
75
  when "drop" then sqlArr[1] + sqlArr[2]
data/lib/agent/version.rb CHANGED
@@ -6,8 +6,8 @@
6
6
 
7
7
  module ManageEngine
8
8
  class APMInsight
9
- VERSION = '1.9.0'
9
+ VERSION = '1.9.2'
10
10
  MAJOR_VERSION = '1.9'
11
- MINOR_VERSION = '0'
11
+ MINOR_VERSION = '2'
12
12
  end
13
13
  end
metadata CHANGED
@@ -1,110 +1,102 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: site24x7_apminsight
3
- version: !ruby/object:Gem::Version
4
- prerelease: false
5
- segments:
6
- - 1
7
- - 9
8
- - 0
9
- version: 1.9.0
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.9.2
10
5
  platform: ruby
11
- authors:
6
+ authors:
12
7
  - Adithyan P
13
- autorequire:
8
+ autorequire:
14
9
  bindir: bin
15
10
  cert_chain: []
16
-
17
- date: 2024-03-22 00:00:00 +05:30
18
- default_executable:
19
- dependencies:
20
- - !ruby/object:Gem::Dependency
11
+ date: 2024-09-04 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
21
14
  name: shoulda
22
- prerelease: false
23
- requirement: &id001 !ruby/object:Gem::Requirement
24
- none: false
25
- requirements:
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
26
17
  - - ">="
27
- - !ruby/object:Gem::Version
28
- segments:
29
- - 0
30
- version: "0"
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
31
20
  type: :development
32
- version_requirements: *id001
33
- - !ruby/object:Gem::Dependency
34
- name: bundler
35
21
  prerelease: false
36
- requirement: &id002 !ruby/object:Gem::Requirement
37
- none: false
38
- requirements:
39
- - - ~>
40
- - !ruby/object:Gem::Version
41
- segments:
42
- - 1
43
- - 0
44
- - 0
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
45
33
  version: 1.0.0
46
34
  type: :development
47
- version_requirements: *id002
48
- - !ruby/object:Gem::Dependency
49
- name: jeweler
50
35
  prerelease: false
51
- requirement: &id003 !ruby/object:Gem::Requirement
52
- none: false
53
- requirements:
54
- - - ~>
55
- - !ruby/object:Gem::Version
56
- segments:
57
- - 1
58
- - 6
59
- - 4
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: 1.0.0
41
+ - !ruby/object:Gem::Dependency
42
+ name: jeweler
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
60
47
  version: 1.6.4
61
48
  type: :development
62
- version_requirements: *id003
63
- - !ruby/object:Gem::Dependency
64
- name: rcov
65
49
  prerelease: false
66
- requirement: &id004 !ruby/object:Gem::Requirement
67
- none: false
68
- requirements:
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: 1.6.4
55
+ - !ruby/object:Gem::Dependency
56
+ name: rcov
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
69
59
  - - ">="
70
- - !ruby/object:Gem::Version
71
- segments:
72
- - 0
73
- version: "0"
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
74
62
  type: :development
75
- version_requirements: *id004
76
- - !ruby/object:Gem::Dependency
77
- name: rails
78
63
  prerelease: false
79
- requirement: &id005 !ruby/object:Gem::Requirement
80
- none: false
81
- requirements:
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rails
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
82
73
  - - ">="
83
- - !ruby/object:Gem::Version
84
- segments:
85
- - 3
86
- - 0
87
- - 0
74
+ - !ruby/object:Gem::Version
88
75
  version: 3.0.0
89
76
  type: :development
90
- version_requirements: *id005
91
- 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
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: 3.0.0
83
+ description: Site24x7 APMInsight gives you end-to-end web-transaction awareness of
84
+ Rails applications enabling you to isolate performance issues and resolve them quickly.
85
+ To monitor Rails application performance, download and deploy Ruby agent(site24x7_apminsight)
86
+ in your Application Server. This agent allows you to send information about Ruby
87
+ applications. You can install APM Insight Agent via Rubygems or download it from
88
+ your user account in Site24x7
92
89
  email: apm-insight@zohocorp.com
93
90
  executables: []
94
-
95
91
  extensions: []
96
-
97
- extra_rdoc_files:
92
+ extra_rdoc_files:
98
93
  - LICENSE.txt
99
94
  - README.rdoc
100
- files:
95
+ files:
101
96
  - LICENSE.txt
102
97
  - README.rdoc
103
98
  - Rakefile
104
99
  - VERSION
105
- - site24x7-agent.gemspec
106
- - conf/apminsight.conf
107
- - lib/site24x7_apminsight.rb
108
100
  - lib/agent/am_objectholder.rb
109
101
  - lib/agent/api/custom_tracker.rb
110
102
  - lib/agent/configuration/am_configuration.rb
@@ -124,6 +116,7 @@ files:
124
116
  - lib/agent/server/instrument/am_apm.rb
125
117
  - lib/agent/server/instrument/am_instrumenter.rb
126
118
  - lib/agent/server/instrument/environment.rb
119
+ - lib/agent/server/instrument/puma.rb
127
120
  - lib/agent/server/instrument/rails.rb
128
121
  - lib/agent/server/instrument/sidekiq_client.rb
129
122
  - lib/agent/server/instrument/sidekiq_server.rb
@@ -136,37 +129,33 @@ files:
136
129
  - lib/agent/util/am_util.rb
137
130
  - lib/agent/util/transaction_util.rb
138
131
  - lib/agent/version.rb
139
- has_rdoc: true
132
+ - lib/site24x7_apminsight.rb
133
+ - site24x7-agent.gemspec
140
134
  homepage: https://www.site24x7.com/help/apm/ruby-agent.html
141
135
  licenses: []
142
-
143
- post_install_message:
136
+ metadata: {}
137
+ post_install_message:
144
138
  rdoc_options: []
145
-
146
- require_paths:
139
+ require_paths:
147
140
  - lib
148
- required_ruby_version: !ruby/object:Gem::Requirement
149
- none: false
150
- requirements:
141
+ required_ruby_version: !ruby/object:Gem::Requirement
142
+ requirements:
151
143
  - - ">="
152
- - !ruby/object:Gem::Version
153
- segments:
154
- - 0
155
- version: "0"
156
- required_rubygems_version: !ruby/object:Gem::Requirement
157
- none: false
158
- requirements:
144
+ - !ruby/object:Gem::Version
145
+ version: '0'
146
+ required_rubygems_version: !ruby/object:Gem::Requirement
147
+ requirements:
159
148
  - - ">="
160
- - !ruby/object:Gem::Version
161
- segments:
162
- - 0
163
- version: "0"
149
+ - !ruby/object:Gem::Version
150
+ version: '0'
164
151
  requirements: []
165
-
166
- rubyforge_project:
167
- rubygems_version: 1.3.7
168
- signing_key:
152
+ rubygems_version: 3.3.7
153
+ signing_key:
169
154
  specification_version: 3
170
- summary: 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.gem) 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
155
+ summary: Site24x7 APMInsight gives you end-to-end web-transaction awareness of Rails
156
+ applications enabling you to isolate performance issues and resolve them quickly.
157
+ To monitor Rails application performance, download and deploy Ruby agent(site24x7_apminsight.gem)
158
+ in your Application Server. This agent allows you to send information about Ruby
159
+ applications. You can install APM Insight Agent via Rubygems or download it from
160
+ your user account in Site24x7
171
161
  test_files: []
172
-
data/conf/apminsight.conf DELETED
@@ -1,86 +0,0 @@
1
- # $Id$
2
- #
3
- ################### APM Insight Agent Configuration File ###################
4
- #
5
- #This file contains configuration options for APM Insight agent installation in your Application Server.
6
- #
7
- #NOTE: Though the properties can be defined in any different order, it is advisable to maintain
8
- #the below order for related properties and ease of reference.
9
- #
10
- #All the configuration options defaults to factory configuration if commented or not supported values
11
-
12
- #License key of your Site24x7 APM Insight account.
13
- license.key=
14
-
15
- #Logical name of your application. Say for example you have "Order Processing" applications running in
16
- #10 instances of Tomcat server. Specify the name as "Order Processing" for the name in all the 10
17
- #instances while deploying the agent. Site24x7 will group the data from 10 instances of
18
- #Tomcat and provide response time, throughput etc.
19
- application.name=My Application
20
-
21
- #APM Insight agent communicates to the Site24x7 through the HTTP/HTTPS protocol.
22
- #Specify Proxy server configuration when there is a proxy server between APM Insight agent and
23
- #Site24x7 server.
24
- #
25
- behind.proxy=false
26
- #proxy.server.host=proxyserver
27
- #proxy.server.port=proxyport
28
- #proxy.auth.username=proxyuser
29
- #proxy.auth.password=proxypassword
30
-
31
- #Application Server HTTP/HTTPS listening port.Say for example when you are deploying the agent in Tomcat
32
- #Server running in 8080 port, specify the value as 8080.
33
- #[Mandatory]
34
- agent.server.port=8080
35
-
36
- #The Apdex (Application Performance Index) threshold is used to calculate application performance score.
37
- #More at http://www.apdex.org.
38
- #A Transaction is said to be satisfied, if the response time is equal to or below the apdex.threshold.
39
- #A Transaction is said to be tolerating, if the response time is greater than apdex.threshold and less
40
- #than 4 times of apdex.threshold. A Transaction is said to be frustrated, if the response time is greater
41
- #than 4 times of apdex.threshold. Say for example when you specify the value as 2, transactions with response
42
- #time less than 2 seconds is considered as satisfied, transactions with response time greater than 2 and
43
- #less than 8 is considered as tolerating and transactions with response time greater than 8 seconds is
44
- #considered as frustrating.
45
- #default value: 0.5 (second)
46
- apdex.threshold=0.5
47
-
48
- #Whether SQL queries getting executed in your application need to be tracked or not.
49
- #default value: true
50
- sql.capture.enabled=true
51
-
52
- #Whether the transaction trace is enabled or not. Setting this value to true will send the trace of the
53
- #slow transaction.
54
- #default value: true
55
- transaction.trace.enabled=true
56
-
57
- #Threshold to construct the trace for slow transactions. Transaction Traces violating this threshold will be
58
- #collected and sent to the server. Used to analyze and troubleshoot the Transaction by the user.
59
- #default value: 2 (second)
60
- transaction.trace.threshold=2
61
-
62
- #Enabling this option will parametrize all SQL Queries in Slow Transaction Traces (if sql.capture.enabled
63
- #set to true & transaction.trace.enabled set to true). Disabling this option will give you the real query
64
- #with actual parameters. It is recommended to enable this option if there are queries getting executed
65
- #using confidential parameters like credit card number, passwords, etc.
66
- #default value: true
67
- transaction.trace.sql.parametrize=true
68
-
69
- #Threshold value to generate a stack trace to identify the caller who executed a slow query. This stack
70
- #trace is sent to the server for the user to analyze and troubleshoot
71
- #default value: 3 (second)
72
- transaction.trace.sql.stacktrace.threshold=3
73
-
74
- #Stop listening transactions with specified URL pattern.
75
- transaction.skip.listening=*.css, *.js, *.gif, *.jpg, *.jpeg, *.bmp, *.png, *.ico
76
-
77
- #Directory where agent logs information separately.
78
- #Defaults to the directory where apminsight-javaagent.jar is installed.
79
- #Use forward slash(/) as path separator.
80
- #apminsight.log.dir=./apminsight/logs
81
-
82
- #The log level at which the APM Insight agent should record logging
83
- #information. The levels are SEVERE, WARNING, INFO, FINE in the order
84
- #respectively. Defaults to the level INFO if commented or mentioned
85
- #incorrectly.
86
- apminsight.log.level=INFO