stackify-ruby-apm 1.15.3.beta1 → 1.16.0.beta1

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 014b8a770c78acfd3eba5a9f75e1a4c76eeb2c4d28635d80834e53f985807ed8
4
- data.tar.gz: 1f82c3bb6394992ffe325182d32b76b5a7cf665923ec93842461186cf9594c90
3
+ metadata.gz: 1ebb6c26f4eef249448035790df567d74b2c81915d42dcba72a4d8dfa83649f0
4
+ data.tar.gz: d4a30f83de5976fbacab28c544b27c5d8afb26b13db4af484570e666f4424717
5
5
  SHA512:
6
- metadata.gz: d0e4223d7f5b01adc3ba840ed02aaced9509fe5277ad112d02a0c4febdabfddcac6f2a456866bdd76027486b14f296256b1515399b41eef78672549d02b7bcc5
7
- data.tar.gz: 42ab0ae25cda2ee2d6aae7ff7b54888db652d80c6f72006befc61317d4871068b59986eb92fc5766ca8ff8d96dac8969a69065d08bab661232452dda322481e1
6
+ metadata.gz: af4ef9861dfdeb3eaa8e721ed92f55d752c8687f53aa818596b7688e0a909e1971e35b0aab90c7a37569eb2930c3e07a17697795b932ffee3e4cecc95e92ba67
7
+ data.tar.gz: 8df99628de54aadbe98674602da416dfde21d637f879ea70d540ad4ce830dc740f449da68f390a595893f4ac3665f1b0f8d03edc5d6512e9049cabf5af483585
@@ -40,6 +40,7 @@ module StackifyRubyAPM
40
40
  date_now = Time.now
41
41
  current_trace_file = config.log_trace_path + squish(host_name) + '#' + squish(pid.to_s)
42
42
  if ENV['STACKIFY_RUBY_ENV'] != 'rspec'
43
+ Util.checkOrCreateFolder(config.log_trace_path)
43
44
  config.tracer_logger = StackifyLogger.new(current_trace_file, config.filenum_rotate, config.logger_byte_size)
44
45
  config.debug_logger
45
46
  config.logtime_created = date_now.strftime('%H:%M')
@@ -148,12 +149,12 @@ module StackifyRubyAPM
148
149
 
149
150
  # Loads transaction
150
151
  #
151
- def transaction(*args, &block)
152
- instrumenter.transaction(*args, &block)
152
+ def transaction(*args, **kwargs, &block)
153
+ instrumenter.transaction(*args, **kwargs, &block)
153
154
  end
154
155
 
155
- def span(*args, &block)
156
- instrumenter.span(*args, &block)
156
+ def span(*args, **kwargs, &block)
157
+ instrumenter.span(*args, **kwargs, &block)
157
158
  end
158
159
 
159
160
  # Responsible for building the transaction's context
@@ -32,7 +32,7 @@ module StackifyRubyAPM
32
32
  transport: StackifyRubyAPM::TRACE_LOG,
33
33
  instrument: true,
34
34
  debug_logging: false,
35
- log_path: StackifyRubyAPM::Util.host_os == 'WINDOWS' ? 'C:\ProgramData\Stackify\Ruby\log\stackify-ruby-apm-1.log' : '/usr/local/stackify/stackify-ruby-apm/log/stackify-ruby-apm-1.log',
35
+ log_path: StackifyRubyAPM::Util.host_os == 'WINDOWS' ? 'C:\ProgramData\Stackify\Ruby\debug\stackify-ruby-apm-1.log' : '/usr/local/stackify/stackify-ruby-apm/debug/stackify-ruby-apm-1.log',
36
36
  log_level: Logger::INFO,
37
37
  log_trace_path: StackifyRubyAPM::Util.host_os == 'WINDOWS' ? 'C:\ProgramData\Stackify\Ruby\log\\' : '/usr/local/stackify/stackify-ruby-apm/log/',
38
38
 
@@ -269,6 +269,10 @@ module StackifyRubyAPM
269
269
  # For unix socket we don't create a trace log file
270
270
  when StackifyRubyAPM::TRACE_LOG
271
271
  debugger_logpath = log_path == '-' ? $stdout : log_path
272
+ if (debugger_logpath == log_path)
273
+ dir_name = File.dirname(debugger_logpath)
274
+ Util.checkOrCreateFolder(dir_name)
275
+ end
272
276
  logger = StackifyLogger.new(debugger_logpath, debugger_filenum_rotate, debugger_byte_size)
273
277
  logger.level = log_level
274
278
  self.logger = logger
@@ -344,6 +348,10 @@ module StackifyRubyAPM
344
348
 
345
349
  def build_logger
346
350
  debugger_logpath = log_path == '-' ? $stdout : log_path
351
+ if (debugger_logpath == log_path)
352
+ dir_name = File.dirname(debugger_logpath)
353
+ Util.checkOrCreateFolder(dir_name)
354
+ end
347
355
  logger = StackifyLogger.new(debugger_logpath, debugger_filenum_rotate, debugger_byte_size)
348
356
  logger.level = log_level
349
357
  self.logger = logger
@@ -56,7 +56,7 @@ module StackifyRubyAPM
56
56
 
57
57
  # Creates a new transaction or return the currently running
58
58
  #
59
- def transaction(*args)
59
+ def transaction(*args, **kwargs)
60
60
  unless config.instrument
61
61
  yield if block_given?
62
62
  return
@@ -67,7 +67,7 @@ module StackifyRubyAPM
67
67
  return transaction
68
68
  end
69
69
 
70
- transaction = Transaction.new self, *args
70
+ transaction = Transaction.new self, *args, **kwargs
71
71
 
72
72
  self.current_transaction = transaction
73
73
  return transaction unless block_given?
@@ -82,14 +82,14 @@ module StackifyRubyAPM
82
82
  transaction
83
83
  end
84
84
 
85
- def span(*args, &block)
85
+ def span(*args, **kwargs, &block)
86
86
  unless current_transaction
87
87
  return yield if block_given?
88
88
 
89
89
  return
90
90
  end
91
91
 
92
- current_transaction.span(*args, &block)
92
+ current_transaction.span(*args, **kwargs, &block)
93
93
  end
94
94
 
95
95
  # Once the transaction is submitted it will be stored temporarily in queue
@@ -73,11 +73,11 @@ module StackifyRubyAPM
73
73
  then "protected"
74
74
  end
75
75
  }
76
- def #{current_method}(*args, &block)
76
+ def #{current_method}(*args, **kwargs, &block)
77
77
  if StackifyRubyAPM.current_transaction.nil? && #{!transaction.nil?}
78
78
  t = StackifyRubyAPM.transaction("custom.#{current_class}.#{current_method}", TRACETYPE)
79
79
  begin
80
- req = #{current_method_without}(*args, &block)
80
+ req = #{current_method_without}(*args, **kwargs, &block)
81
81
  rescue Exception => e
82
82
  StackifyRubyAPM.report(e)
83
83
  raise e
@@ -100,10 +100,10 @@ module StackifyRubyAPM
100
100
  end
101
101
 
102
102
  StackifyRubyAPM.span name, type, context: ctx do
103
- #{current_method_without}(*args, &block)
103
+ #{current_method_without}(*args, **kwargs, &block)
104
104
  end
105
105
  else
106
- return #{current_method_without}(*args, &block)
106
+ return #{current_method_without}(*args, **kwargs, &block)
107
107
  end
108
108
  end
109
109
  end
@@ -152,11 +152,11 @@ module StackifyRubyAPM
152
152
  #{current_class}.class_eval do
153
153
  singleton_class.send(:alias_method, :"_self_without_apm_#{current_method}", :"#{current_method}")
154
154
 
155
- def self.#{current_method}(*args, &block)
155
+ def self.#{current_method}(*args, **kwargs, &block)
156
156
  if StackifyRubyAPM.current_transaction.nil? && #{!transaction.nil?}
157
157
  t = StackifyRubyAPM.transaction("custom.#{current_class}.#{current_method}", TRACETYPE)
158
158
  begin
159
- req = _self_without_apm_#{current_method}(*args, &block)
159
+ req = _self_without_apm_#{current_method}(*args, **kwargs, &block)
160
160
  rescue Exception => e
161
161
  StackifyRubyAPM.report(e)
162
162
  raise e
@@ -179,10 +179,10 @@ module StackifyRubyAPM
179
179
  end
180
180
 
181
181
  StackifyRubyAPM.span name, type, context: ctx do
182
- _self_without_apm_#{current_method}(*args, &block)
182
+ _self_without_apm_#{current_method}(*args, **kwargs, &block)
183
183
  end
184
184
  else
185
- return _self_without_apm_#{current_method}(*args, &block)
185
+ return _self_without_apm_#{current_method}(*args, **kwargs, &block)
186
186
  end
187
187
  end
188
188
 
@@ -240,11 +240,11 @@ module StackifyRubyAPM
240
240
  class<< self
241
241
  alias_method "#{current_method}_without_apm", "#{current_method}"
242
242
 
243
- def #{current_method}(*args, &block)
243
+ def #{current_method}(*args, **kwargs, &block)
244
244
  if StackifyRubyAPM.current_transaction.nil? && #{!transaction.nil?}
245
245
  t = StackifyRubyAPM.transaction("custom.#{current_module}.#{current_method}", TRACETYPE)
246
246
  begin
247
- req = #{current_method}_without_apm(*args, &block)
247
+ req = #{current_method}_without_apm(*args, **kwargs, &block)
248
248
  rescue Exception => e
249
249
  StackifyRubyAPM.report(e)
250
250
  raise e
@@ -267,10 +267,10 @@ module StackifyRubyAPM
267
267
  end
268
268
 
269
269
  StackifyRubyAPM.span name, type, context: ctx do
270
- #{current_method}_without_apm(*args, &block)
270
+ #{current_method}_without_apm(*args, **kwargs, &block)
271
271
  end
272
272
  else
273
- return #{current_method}_without_apm(*args, &block)
273
+ return #{current_method}_without_apm(*args, **kwargs, &block)
274
274
  end
275
275
  end
276
276
  end
@@ -84,10 +84,11 @@ module StackifyRubyAPM
84
84
  # Override create_logfile of core LogDevice class where we set File.chmod to 0o777
85
85
  def create_logfile(filename)
86
86
  logdev = super
87
- File.chmod(0o777, filename)
88
87
 
89
88
  begin
90
89
  dir_name = File.dirname(filename)
90
+ StackifyRubyAPM::Util.checkOrCreateFolder(dir_name)
91
+ File.chmod(0o777, filename)
91
92
  # repath current file due to windows separator \\ doesn't work with Dir.glob
92
93
  dir_name = dir_name.split(File::ALT_SEPARATOR).join(File::SEPARATOR)
93
94
  search_files = File.join("#{dir_name}", "{[!stackify-ruby-apm]*}.log")
@@ -3,6 +3,7 @@
3
3
  # Possible use of ActiveSupport.on_load(:active_record)
4
4
 
5
5
  require 'stackify_apm/helper/database_helper'
6
+ require 'rails'
6
7
 
7
8
  module StackifyRubyAPM
8
9
  module Normalizers
@@ -79,17 +80,30 @@ module StackifyRubyAPM
79
80
  end
80
81
 
81
82
  if (connection.nil?)
82
- return 'generic'
83
+ if ::ActiveRecord::Base.respond_to?(:connection)
84
+ return ::ActiveRecord::Base.connection.adapter_name.downcase
85
+ else
86
+ return 'generic'
87
+ end
83
88
  end
84
89
 
85
90
  if (connection.respond_to?(:adapter_name) && connection.adapter_name.nil?)
86
- return 'generic'
91
+ if ::ActiveRecord::Base.respond_to?(:connection)
92
+ return ::ActiveRecord::Base.connection.adapter_name.downcase
93
+ else
94
+ return 'generic'
95
+ end
87
96
  end
88
97
 
89
98
  connection.adapter_name.downcase
90
99
  rescue StandardError => error
91
100
  debug '[SqlNormalizer] lookup_adapter err: ' + error.inspect.to_s
92
- nil
101
+ # do a last fail safe check before returning nil
102
+ if ::ActiveRecord::Base.respond_to?(:connection)
103
+ ::ActiveRecord::Base.connection.adapter_name.downcase
104
+ else
105
+ nil
106
+ end
93
107
  end
94
108
 
95
109
  def lookup_adapter_config
@@ -6,7 +6,7 @@ module StackifyRubyAPM
6
6
  class Context
7
7
  include NaivelyHashable
8
8
 
9
- def initialize(**args)
9
+ def initialize(args)
10
10
  args.each do |key, val|
11
11
  send(:"#{key}=", val)
12
12
  end
@@ -26,6 +26,26 @@ module StackifyRubyAPM
26
26
  end
27
27
  end
28
28
 
29
+ class ActionDispatchDebugExceptionsSpy
30
+ def install
31
+ ::ActionDispatch::DebugExceptions.class_eval do
32
+ alias_method 'render_exception_without_apm', 'render_exception'
33
+
34
+ def render_exception(env, exception)
35
+ # Creates exception log report
36
+ #
37
+ begin
38
+ StackifyRubyAPM.report(exception)
39
+ rescue Exception => e
40
+ StackifyRubyAPM.agent.error '[ActionDispatchDebugExceptionsSpy] Error: repoting exception.'
41
+ StackifyRubyAPM.agent.error "[ActionDispatchDebugExceptionsSpy] #{e.inspect}"
42
+ end
43
+ render_exception_without_apm env, exception
44
+ end
45
+ end
46
+ end
47
+ end
48
+
29
49
  # Registers ActionDispatch spy, go to: /stackify_apm/spies.rb
30
50
  #
31
51
  register(
@@ -33,5 +53,11 @@ module StackifyRubyAPM
33
53
  'action_dispatch/show_exception',
34
54
  ActionDispatchSpy.new
35
55
  )
56
+
57
+ register(
58
+ 'ActionDispatch::DebugExceptions',
59
+ 'action_dispatch/debug_exceptions',
60
+ ActionDispatchDebugExceptionsSpy.new
61
+ )
36
62
  end
37
63
  end
@@ -16,9 +16,9 @@ module StackifyRubyAPM
16
16
  singleton_class.send(:alias_method, :http_put_without_apm, :http_put)
17
17
  singleton_class.send(:alias_method, :http_get_without_apm, :http_get)
18
18
  singleton_class.send(:alias_method, :http_delete_without_apm, :http_delete)
19
- def self.perform(*args)
19
+ def self.perform(*args, **kwargs)
20
20
  req = nil
21
- return perform_without_apm(*args) unless StackifyRubyAPM.current_transaction
21
+ return perform_without_apm(*args, **kwargs) unless StackifyRubyAPM.current_transaction
22
22
 
23
23
  begin
24
24
  # Data configuration
@@ -40,14 +40,14 @@ module StackifyRubyAPM
40
40
  rescue Exception => e
41
41
  StackifyRubyAPM.agent.error "[CurbEasySpy] Error: creating span context."
42
42
  StackifyRubyAPM.agent.error "[CurbEasySpy] #{e.inspect}"
43
- return perform_without_apm(*args)
43
+ return perform_without_apm(*args, **kwargs)
44
44
  end
45
45
 
46
46
  # Creates new span from HTTP result
47
47
  StackifyRubyAPM.span name, type, context: ctx do
48
48
  # Submits HTTP request
49
49
  #
50
- res = perform_without_apm(*args)
50
+ res = perform_without_apm(*args, **kwargs)
51
51
 
52
52
  begin
53
53
  status_code = res.status.sub(/^0-9/, '').to_i
@@ -67,9 +67,9 @@ module StackifyRubyAPM
67
67
  end
68
68
  end
69
69
 
70
- def self.http_post(*args)
70
+ def self.http_post(*args, **kwargs)
71
71
  req = nil
72
- return http_post_without_apm(*args) unless StackifyRubyAPM.current_transaction
72
+ return http_post_without_apm(*args, **kwargs) unless StackifyRubyAPM.current_transaction
73
73
 
74
74
  begin
75
75
  # Data configuration
@@ -90,12 +90,12 @@ module StackifyRubyAPM
90
90
  rescue Exception => e
91
91
  StackifyRubyAPM.agent.error "[CurbEasySpy] Error: creating span context."
92
92
  StackifyRubyAPM.agent.error "[CurbEasySpy] #{e.inspect}"
93
- return http_post_without_apm(*args)
93
+ return http_post_without_apm(*args, **kwargs)
94
94
  end
95
95
 
96
96
  # Creates new span from HTTP result
97
97
  StackifyRubyAPM.span name, type, context: ctx do
98
- res = http_post_without_apm(*args)
98
+ res = http_post_without_apm(*args, **kwargs)
99
99
 
100
100
  begin
101
101
  status_code = res.status.sub(/^0-9/, '').to_i
@@ -178,9 +178,9 @@ module StackifyRubyAPM
178
178
  end
179
179
  end
180
180
 
181
- def self.http_get(*args)
181
+ def self.http_get(*args, **kwargs)
182
182
  req = nil
183
- return http_get_without_apm(*args) unless StackifyRubyAPM.current_transaction
183
+ return http_get_without_apm(*args, **kwargs) unless StackifyRubyAPM.current_transaction
184
184
 
185
185
  begin
186
186
  # Data configuration
@@ -201,12 +201,12 @@ module StackifyRubyAPM
201
201
  rescue Exception => e
202
202
  StackifyRubyAPM.agent.error "[CurbEasySpy] Error: creating span context."
203
203
  StackifyRubyAPM.agent.error "[CurbEasySpy] #{e.inspect}"
204
- return http_get_without_apm(*args)
204
+ return http_get_without_apm(*args, **kwargs)
205
205
  end
206
206
 
207
207
  # Creates new span from HTTP result
208
208
  StackifyRubyAPM.span name, type, context: ctx do
209
- res = http_get_without_apm(*args)
209
+ res = http_get_without_apm(*args, **kwargs)
210
210
 
211
211
  begin
212
212
  status_code = res.status.sub(/^0-9/, '').to_i
@@ -227,9 +227,9 @@ module StackifyRubyAPM
227
227
  end
228
228
  end
229
229
 
230
- def self.http_delete(*args)
230
+ def self.http_delete(*args, **kwargs)
231
231
  req = nil
232
- return http_delete_without_apm(*args) unless StackifyRubyAPM.current_transaction
232
+ return http_delete_without_apm(*args, **kwargs) unless StackifyRubyAPM.current_transaction
233
233
 
234
234
  begin
235
235
  # Data configuration
@@ -250,12 +250,12 @@ module StackifyRubyAPM
250
250
  rescue Exception => e
251
251
  StackifyRubyAPM.agent.error "[CurbEasySpy] Error: creating span context."
252
252
  StackifyRubyAPM.agent.error "[CurbEasySpy] #{e.inspect}"
253
- return http_delete_without_apm(*args)
253
+ return http_delete_without_apm(*args, **kwargs)
254
254
  end
255
255
 
256
256
  # Creates new span from HTTP result
257
257
  StackifyRubyAPM.span name, type, context: ctx do
258
- res = http_delete_without_apm(*args)
258
+ res = http_delete_without_apm(*args, **kwargs)
259
259
 
260
260
  begin
261
261
  status_code = res.status.sub(/^0-9/, '').to_i
@@ -12,7 +12,7 @@ module StackifyRubyAPM
12
12
  Delayed::Backend::Base.class_eval do
13
13
  alias_method 'invoke_job_without_apm', 'invoke_job'
14
14
 
15
- def invoke_job(*args, &block)
15
+ def invoke_job(*args, **kwargs, &block)
16
16
  ret = nil
17
17
  begin
18
18
  name = nil
@@ -29,7 +29,7 @@ module StackifyRubyAPM
29
29
  ctx = StackifyRubyAPM::Context.new
30
30
  ctx.category = 'Delayed::Job'
31
31
  transaction = StackifyRubyAPM.transaction name, 'TASK', context: ctx
32
- ret = invoke_job_without_apm(*args, &block)
32
+ ret = invoke_job_without_apm(*args, **kwargs, &block)
33
33
  rescue StackifyRubyAPM::InternalError
34
34
  raise # Don't report StackifyRubyAPM errors
35
35
  rescue StandardError => e
@@ -12,9 +12,9 @@ module StackifyRubyAPM
12
12
  HTTPClient.class_eval do
13
13
  alias_method 'request_without_apm', 'request'
14
14
 
15
- def request(method, uri, *args, &block)
15
+ def request(method, uri, *args, **kwargs, &block)
16
16
  req = nil
17
- return request_without_apm(method, uri, *args, &block) unless StackifyRubyAPM.current_transaction
17
+ return request_without_apm(method, uri, *args, **kwargs, &block) unless StackifyRubyAPM.current_transaction
18
18
 
19
19
  begin
20
20
  # Data configuration
@@ -36,7 +36,7 @@ module StackifyRubyAPM
36
36
  rescue Exception => e
37
37
  StackifyRubyAPM.agent.error "[HTTPClientSpy] Error: creating span context."
38
38
  StackifyRubyAPM.agent.error "[HTTPClientSpy] #{e.inspect}"
39
- return request_without_apm(method, uri, *args, &block)
39
+ return request_without_apm(method, uri, *args, **kwargs, &block)
40
40
  end
41
41
 
42
42
  # Creates new span from HTTP result
@@ -44,7 +44,7 @@ module StackifyRubyAPM
44
44
  StackifyRubyAPM.span name, type, context: ctx do
45
45
  # Submits HTTP request
46
46
  #
47
- res = request_without_apm(method, uri, *args, &block)
47
+ res = request_without_apm(method, uri, *args, **kwargs, &block)
48
48
 
49
49
  begin
50
50
  ctx.update_status(res.status_code)
@@ -29,8 +29,8 @@ module StackifyRubyAPM
29
29
  ::Sequel::Database.class_eval do
30
30
  alias_method 'log_connection_yield_without_apm', 'log_connection_yield'
31
31
 
32
- def log_connection_yield(sql, *args, &block)
33
- return log_connection_yield_without_apm(sql, *args, &block) unless StackifyRubyAPM.current_transaction
32
+ def log_connection_yield(sql, *args, **kwargs, &block)
33
+ return log_connection_yield_without_apm(sql, *args, **kwargs, &block) unless StackifyRubyAPM.current_transaction
34
34
 
35
35
  name = summarize sql
36
36
  db_adapter = ''
@@ -12,7 +12,7 @@ module StackifyRubyAPM
12
12
  Sidekiq::Processor.class_eval do
13
13
  alias_method 'process_without_apm', 'process'
14
14
 
15
- def process(work, *args, &block)
15
+ def process(work, *args, **kwargs, &block)
16
16
  ret = nil
17
17
  begin
18
18
  job = nil
@@ -24,7 +24,7 @@ module StackifyRubyAPM
24
24
  job_hash = JSON.parse job
25
25
  name = job_hash["class"]
26
26
  transaction = StackifyRubyAPM.transaction name, 'TASK'
27
- ret = process_without_apm(work, *args, &block)
27
+ ret = process_without_apm(work, *args, **kwargs, &block)
28
28
  rescue StackifyRubyAPM::InternalError
29
29
  raise # Don't report StackifyRubyAPM errors
30
30
  rescue StandardError => e
@@ -15,8 +15,8 @@ module StackifyRubyAPM
15
15
 
16
16
  # Sets transaction name from Sinatra env's route name
17
17
  #
18
- def dispatch!(*args, &block)
19
- dispatch_without_apm!(*args, &block).tap do
18
+ def dispatch!(*args, **kwargs, &block)
19
+ dispatch_without_apm!(*args, **kwargs, &block).tap do
20
20
  next unless (transaction = StackifyRubyAPM.current_transaction)
21
21
  next unless (route = env['sinatra.route'])
22
22
 
@@ -26,23 +26,23 @@ module StackifyRubyAPM
26
26
 
27
27
  # Tilt engine template
28
28
  #
29
- def compile_template(engine, data, opts, *args, &block)
29
+ def compile_template(engine, data, opts, *args, **kwargs, &block)
30
30
  opts[:__stackify_apm_template_name] =
31
31
  case data
32
32
  when Symbol then data.to_s
33
33
  else format('Inline %s', engine)
34
34
  end
35
35
 
36
- compile_template_without_apm(engine, data, opts, *args, &block)
36
+ compile_template_without_apm(engine, data, opts, *args, **kwargs, &block)
37
37
  end
38
38
 
39
- def route_eval(*args, &block)
39
+ def route_eval(*args, **kwargs, &block)
40
40
  if defined?(StackifyRubyAPM.current_transaction)
41
41
  if env.key?('sinatra.route')
42
42
  StackifyRubyAPM.current_transaction.name = env['sinatra.route']
43
43
  end
44
44
  end
45
- route_eval_without_apm(*args, &block)
45
+ route_eval_without_apm(*args, **kwargs, &block)
46
46
  end
47
47
  end
48
48
  end
@@ -12,14 +12,14 @@ module StackifyRubyAPM
12
12
  SuckerPunch::Job::ClassMethods.class_eval do
13
13
  alias_method '__run_perform_without_elastic_apm', '__run_perform'
14
14
 
15
- def __run_perform(*args)
15
+ def __run_perform(*args, **kwargs)
16
16
  ret = nil
17
17
  begin
18
18
  name = "#{to_s}.perform"
19
19
  ctx = StackifyRubyAPM::Context.new
20
20
  ctx.category = 'SuckerPunch::Job'
21
21
  transaction = StackifyRubyAPM.transaction name, 'TASK', context: ctx
22
- ret = __run_perform_without_elastic_apm(*args)
22
+ ret = __run_perform_without_elastic_apm(*args, **kwargs)
23
23
  rescue StackifyRubyAPM::InternalError
24
24
  raise # Don't report StackifyRubyAPM errors
25
25
  rescue StandardError => e
@@ -15,13 +15,13 @@ module StackifyRubyAPM
15
15
  ::Tilt::Template.class_eval do
16
16
  alias_method 'render_without_apm', 'render'
17
17
 
18
- def render(*args, &block)
18
+ def render(*args, **kwargs, &block)
19
19
  name = options[:__stackify_apm_template_name] || 'Unknown template'
20
20
 
21
21
  # Creates new span for Tilt templating
22
22
  #
23
23
  StackifyRubyAPM.span name, TYPE do
24
- render_without_apm(*args, &block)
24
+ render_without_apm(*args, **kwargs, &block)
25
25
  end
26
26
  end
27
27
  end
@@ -87,6 +87,40 @@ module StackifyRubyAPM
87
87
  string
88
88
  end
89
89
 
90
+ def self.fileExists?(dir_name)
91
+ # Ruby 3.2 changed File.exists to File.exist.
92
+ if Gem::Version.new(RUBY_VERSION) < Gem::Version.new("3.2")
93
+ return File.exists?(dir_name)
94
+ else
95
+ return File.exist?(dir_name)
96
+ end
97
+ end
98
+
99
+ def self.checkOrCreateFolder(dir_name)
100
+ if (dir_name.to_s.empty?)
101
+ return false
102
+ end
103
+
104
+ if (!fileExists?(dir_name))
105
+ umask = File.umask
106
+ File.umask(0)
107
+ FileUtils.mkdir_p(dir_name)
108
+ File.chmod(0777, dir_name)
109
+ File.umask(umask)
110
+ end
111
+
112
+ if (!fileExists?(dir_name))
113
+ puts "Util::Stackify Profiler unable to find [" + dir_name + "]"
114
+ return false
115
+ end
116
+
117
+ if (!File.writable?(dir_name))
118
+ puts "Util::Stackify Profiler unable to access/write [" + dir_name + "]"
119
+ return false
120
+ end
121
+
122
+ return true
123
+ end
90
124
  end
91
125
  end
92
126
  require 'stackify_apm/util/inspector'
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Sets the version of the APM
3
+ # Sets the version of the APM:
4
4
  module StackifyRubyAPM
5
- VERSION = '1.15.3.beta1'.freeze
5
+ VERSION = '1.16.0.beta1'.freeze
6
6
  end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- lib = File.expand_path('lib', __dir__)
3
+ lib = File.expand_path('lib', File.dirname(__FILE__))
4
4
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
5
  require 'stackify_apm/version'
6
6
 
@@ -13,6 +13,9 @@ Gem::Specification.new do |spec|
13
13
  spec.homepage = 'http://www.stackify.com'
14
14
  spec.license = 'Stackify'
15
15
 
16
+ # Set the minimum Ruby version required
17
+ spec.required_ruby_version = '>= 3.0.0'
18
+
16
19
  git_tracked_files = `git ls-files -z`.split("\x0")
17
20
  gem_ignored_files = `git ls-files -i -X .gemignore -z`.split("\x0")
18
21
  spec.files = git_tracked_files - gem_ignored_files
@@ -22,49 +25,77 @@ Gem::Specification.new do |spec|
22
25
  spec.require_paths = ['lib']
23
26
 
24
27
  # rails
25
- if RUBY_VERSION > '2.5'
28
+ if RUBY_VERSION > '2.9'
29
+ spec.add_development_dependency 'rails', '~> 6.1'
30
+ elsif RUBY_VERSION > '2.5'
26
31
  spec.add_development_dependency 'rails', '~> 5.0'
27
32
  else
28
33
  spec.add_development_dependency 'rails', '~> 4.0'
34
+ spec.add_development_dependency 'sprockets', '~> 3.0'
29
35
  end
30
36
 
31
37
  # bigdecimal
32
38
  if RUBY_VERSION > '2.5'
33
39
  spec.add_development_dependency 'bigdecimal'
34
40
  end
35
-
41
+
36
42
  if RUBY_PLATFORM == 'i386-mingw32'
37
43
  spec.add_development_dependency 'tzinfo-data'
44
+ end
45
+
46
+ if RUBY_VERSION > '2.9'
47
+ spec.add_development_dependency 'bundler', '~> 2.4.12'
48
+ else
49
+ spec.add_development_dependency 'bundler', '~> 1.16'
50
+ end
51
+
52
+ if RUBY_VERSION > '2.9'
53
+ spec.add_development_dependency 'rake'
54
+ spec.add_development_dependency 'rspec', '3.9.0'
55
+ spec.add_development_dependency 'curb', '1.0.3'
56
+ spec.add_development_dependency 'pg'
57
+ spec.add_development_dependency 'sqlite3'
38
58
  else
39
- spec.add_development_dependency 'mongo'
59
+ spec.add_development_dependency 'rake', '~> 10.0'
60
+ spec.add_development_dependency 'rspec', '~> 3.0'
40
61
  spec.add_development_dependency 'curb', '0.9.8'
62
+ spec.add_development_dependency 'pg', '~> 0.20'
63
+ spec.add_development_dependency 'sqlite3', '1.3.13'
64
+ spec.add_development_dependency('delegate_matcher', '~> 0.4') # for testing
41
65
  end
42
66
 
43
- spec.add_development_dependency 'bundler', '~> 1.17'
44
- spec.add_development_dependency 'rake', '~> 10.0'
45
- spec.add_development_dependency 'rspec', '~> 3.0'
67
+
46
68
  spec.add_development_dependency 'activerecord'
47
-
48
69
  spec.add_development_dependency 'fakeredis'
49
70
  spec.add_development_dependency 'http'
50
71
  spec.add_development_dependency 'httpclient'
72
+ spec.add_development_dependency 'mongo'
51
73
  spec.add_development_dependency 'mysql2'
52
- spec.add_development_dependency 'pg', '~> 0.20'
74
+
53
75
  spec.add_development_dependency 'rack-test'
54
76
  spec.add_development_dependency 'rubocop'
55
77
  spec.add_development_dependency 'sequel'
56
78
  spec.add_development_dependency 'sinatra'
57
79
  spec.add_development_dependency 'sinatra-activerecord'
58
- spec.add_development_dependency 'sqlite3', '1.3.13'
80
+
59
81
  spec.add_development_dependency 'stackify-api-ruby'
60
82
  spec.add_development_dependency 'timecop'
61
83
  spec.add_development_dependency 'to_bool'
62
84
  spec.add_development_dependency 'webmock'
63
85
  spec.add_development_dependency 'delayed_job'
64
- spec.add_development_dependency('delegate_matcher', '~> 0.4') # for testing
65
86
 
66
- spec.add_dependency('concurrent-ruby', '~> 1.0')
67
- spec.add_dependency('faraday', '~> 0.8')
68
- spec.add_dependency('net_http_unix', '~> 0.2')
69
- spec.add_dependency('rufus-scheduler', '~> 3.0')
70
- end
87
+ if RUBY_VERSION > '2.9'
88
+ spec.add_dependency('concurrent-ruby')
89
+ spec.add_dependency('delegate_matcher')
90
+ spec.add_dependency('faraday')
91
+ spec.add_dependency('net_http_unix')
92
+ spec.add_dependency('rufus-scheduler')
93
+ else
94
+ spec.add_dependency('concurrent-ruby', '~> 1.0')
95
+ spec.add_dependency('delegate_matcher', '~> 0.4')
96
+ spec.add_dependency('faraday', '~> 0.8')
97
+ spec.add_dependency('net_http_unix', '~> 0.2')
98
+ spec.add_dependency('rufus-scheduler', '~> 3.0')
99
+ end
100
+
101
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stackify-ruby-apm
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.15.3.beta1
4
+ version: 1.16.0.beta1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stackify
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-08-23 00:00:00.000000000 Z
11
+ date: 2023-05-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '5.0'
19
+ version: '6.1'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '5.0'
26
+ version: '6.1'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: bigdecimal
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -39,7 +39,21 @@ dependencies:
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
- name: mongo
42
+ name: bundler
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: 2.4.12
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: 2.4.12
55
+ - !ruby/object:Gem::Dependency
56
+ name: rake
43
57
  requirement: !ruby/object:Gem::Requirement
44
58
  requirements:
45
59
  - - ">="
@@ -53,61 +67,61 @@ dependencies:
53
67
  - !ruby/object:Gem::Version
54
68
  version: '0'
55
69
  - !ruby/object:Gem::Dependency
56
- name: curb
70
+ name: rspec
57
71
  requirement: !ruby/object:Gem::Requirement
58
72
  requirements:
59
73
  - - '='
60
74
  - !ruby/object:Gem::Version
61
- version: 0.9.8
75
+ version: 3.9.0
62
76
  type: :development
63
77
  prerelease: false
64
78
  version_requirements: !ruby/object:Gem::Requirement
65
79
  requirements:
66
80
  - - '='
67
81
  - !ruby/object:Gem::Version
68
- version: 0.9.8
82
+ version: 3.9.0
69
83
  - !ruby/object:Gem::Dependency
70
- name: bundler
84
+ name: curb
71
85
  requirement: !ruby/object:Gem::Requirement
72
86
  requirements:
73
- - - "~>"
87
+ - - '='
74
88
  - !ruby/object:Gem::Version
75
- version: '1.17'
89
+ version: 1.0.3
76
90
  type: :development
77
91
  prerelease: false
78
92
  version_requirements: !ruby/object:Gem::Requirement
79
93
  requirements:
80
- - - "~>"
94
+ - - '='
81
95
  - !ruby/object:Gem::Version
82
- version: '1.17'
96
+ version: 1.0.3
83
97
  - !ruby/object:Gem::Dependency
84
- name: rake
98
+ name: pg
85
99
  requirement: !ruby/object:Gem::Requirement
86
100
  requirements:
87
- - - "~>"
101
+ - - ">="
88
102
  - !ruby/object:Gem::Version
89
- version: '10.0'
103
+ version: '0'
90
104
  type: :development
91
105
  prerelease: false
92
106
  version_requirements: !ruby/object:Gem::Requirement
93
107
  requirements:
94
- - - "~>"
108
+ - - ">="
95
109
  - !ruby/object:Gem::Version
96
- version: '10.0'
110
+ version: '0'
97
111
  - !ruby/object:Gem::Dependency
98
- name: rspec
112
+ name: sqlite3
99
113
  requirement: !ruby/object:Gem::Requirement
100
114
  requirements:
101
- - - "~>"
115
+ - - ">="
102
116
  - !ruby/object:Gem::Version
103
- version: '3.0'
117
+ version: '0'
104
118
  type: :development
105
119
  prerelease: false
106
120
  version_requirements: !ruby/object:Gem::Requirement
107
121
  requirements:
108
- - - "~>"
122
+ - - ">="
109
123
  - !ruby/object:Gem::Version
110
- version: '3.0'
124
+ version: '0'
111
125
  - !ruby/object:Gem::Dependency
112
126
  name: activerecord
113
127
  requirement: !ruby/object:Gem::Requirement
@@ -165,7 +179,7 @@ dependencies:
165
179
  - !ruby/object:Gem::Version
166
180
  version: '0'
167
181
  - !ruby/object:Gem::Dependency
168
- name: mysql2
182
+ name: mongo
169
183
  requirement: !ruby/object:Gem::Requirement
170
184
  requirements:
171
185
  - - ">="
@@ -179,19 +193,19 @@ dependencies:
179
193
  - !ruby/object:Gem::Version
180
194
  version: '0'
181
195
  - !ruby/object:Gem::Dependency
182
- name: pg
196
+ name: mysql2
183
197
  requirement: !ruby/object:Gem::Requirement
184
198
  requirements:
185
- - - "~>"
199
+ - - ">="
186
200
  - !ruby/object:Gem::Version
187
- version: '0.20'
201
+ version: '0'
188
202
  type: :development
189
203
  prerelease: false
190
204
  version_requirements: !ruby/object:Gem::Requirement
191
205
  requirements:
192
- - - "~>"
206
+ - - ">="
193
207
  - !ruby/object:Gem::Version
194
- version: '0.20'
208
+ version: '0'
195
209
  - !ruby/object:Gem::Dependency
196
210
  name: rack-test
197
211
  requirement: !ruby/object:Gem::Requirement
@@ -262,20 +276,6 @@ dependencies:
262
276
  - - ">="
263
277
  - !ruby/object:Gem::Version
264
278
  version: '0'
265
- - !ruby/object:Gem::Dependency
266
- name: sqlite3
267
- requirement: !ruby/object:Gem::Requirement
268
- requirements:
269
- - - '='
270
- - !ruby/object:Gem::Version
271
- version: 1.3.13
272
- type: :development
273
- prerelease: false
274
- version_requirements: !ruby/object:Gem::Requirement
275
- requirements:
276
- - - '='
277
- - !ruby/object:Gem::Version
278
- version: 1.3.13
279
279
  - !ruby/object:Gem::Dependency
280
280
  name: stackify-api-ruby
281
281
  requirement: !ruby/object:Gem::Requirement
@@ -347,75 +347,75 @@ dependencies:
347
347
  - !ruby/object:Gem::Version
348
348
  version: '0'
349
349
  - !ruby/object:Gem::Dependency
350
- name: delegate_matcher
350
+ name: concurrent-ruby
351
351
  requirement: !ruby/object:Gem::Requirement
352
352
  requirements:
353
- - - "~>"
353
+ - - ">="
354
354
  - !ruby/object:Gem::Version
355
- version: '0.4'
356
- type: :development
355
+ version: '0'
356
+ type: :runtime
357
357
  prerelease: false
358
358
  version_requirements: !ruby/object:Gem::Requirement
359
359
  requirements:
360
- - - "~>"
360
+ - - ">="
361
361
  - !ruby/object:Gem::Version
362
- version: '0.4'
362
+ version: '0'
363
363
  - !ruby/object:Gem::Dependency
364
- name: concurrent-ruby
364
+ name: delegate_matcher
365
365
  requirement: !ruby/object:Gem::Requirement
366
366
  requirements:
367
- - - "~>"
367
+ - - ">="
368
368
  - !ruby/object:Gem::Version
369
- version: '1.0'
369
+ version: '0'
370
370
  type: :runtime
371
371
  prerelease: false
372
372
  version_requirements: !ruby/object:Gem::Requirement
373
373
  requirements:
374
- - - "~>"
374
+ - - ">="
375
375
  - !ruby/object:Gem::Version
376
- version: '1.0'
376
+ version: '0'
377
377
  - !ruby/object:Gem::Dependency
378
378
  name: faraday
379
379
  requirement: !ruby/object:Gem::Requirement
380
380
  requirements:
381
- - - "~>"
381
+ - - ">="
382
382
  - !ruby/object:Gem::Version
383
- version: '0.8'
383
+ version: '0'
384
384
  type: :runtime
385
385
  prerelease: false
386
386
  version_requirements: !ruby/object:Gem::Requirement
387
387
  requirements:
388
- - - "~>"
388
+ - - ">="
389
389
  - !ruby/object:Gem::Version
390
- version: '0.8'
390
+ version: '0'
391
391
  - !ruby/object:Gem::Dependency
392
392
  name: net_http_unix
393
393
  requirement: !ruby/object:Gem::Requirement
394
394
  requirements:
395
- - - "~>"
395
+ - - ">="
396
396
  - !ruby/object:Gem::Version
397
- version: '0.2'
397
+ version: '0'
398
398
  type: :runtime
399
399
  prerelease: false
400
400
  version_requirements: !ruby/object:Gem::Requirement
401
401
  requirements:
402
- - - "~>"
402
+ - - ">="
403
403
  - !ruby/object:Gem::Version
404
- version: '0.2'
404
+ version: '0'
405
405
  - !ruby/object:Gem::Dependency
406
406
  name: rufus-scheduler
407
407
  requirement: !ruby/object:Gem::Requirement
408
408
  requirements:
409
- - - "~>"
409
+ - - ">="
410
410
  - !ruby/object:Gem::Version
411
- version: '3.0'
411
+ version: '0'
412
412
  type: :runtime
413
413
  prerelease: false
414
414
  version_requirements: !ruby/object:Gem::Requirement
415
415
  requirements:
416
- - - "~>"
416
+ - - ">="
417
417
  - !ruby/object:Gem::Version
418
- version: '3.0'
418
+ version: '0'
419
419
  description:
420
420
  email:
421
421
  - support@stackify.com
@@ -530,14 +530,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
530
530
  requirements:
531
531
  - - ">="
532
532
  - !ruby/object:Gem::Version
533
- version: '0'
533
+ version: 3.0.0
534
534
  required_rubygems_version: !ruby/object:Gem::Requirement
535
535
  requirements:
536
536
  - - ">"
537
537
  - !ruby/object:Gem::Version
538
538
  version: 1.3.1
539
539
  requirements: []
540
- rubygems_version: 3.0.1
540
+ rubygems_version: 3.4.10
541
541
  signing_key:
542
542
  specification_version: 4
543
543
  summary: Stackify APM for Ruby