callstacking-rails 0.1.22 → 0.1.24

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: db3f273ed8ae89ee3727de24fa80f8a3621ebb9aa5997874cf8f8f2607f9595b
4
- data.tar.gz: facd7b5f062db3b4e50ecdd78857b5b0635119a8aa07589bc1e9fa03583bf036
3
+ metadata.gz: 32743c94e97432eef4a4977e0e123eb7f2539d99e6505ee7b05c6e1d3fb32ee6
4
+ data.tar.gz: fa3c04dcba5a84dd926d5ae21c9b0238c9d4843f396d66066ea3406c851f8b6a
5
5
  SHA512:
6
- metadata.gz: a74d58ed4f01a8a466ae81d763499d4a0004a97bdaee5cf8fe7aba47d97b367dbbc4ba7d2f1e8d2be0bff8d450b09a99b8de1fb4f738baa67664623583884660
7
- data.tar.gz: 104df4887100b79f1d056fc24e7690dee30404a5c3827fd9d7fcce2c6c84e74124649a98e6c71c77cd62310d227b5987ee306d2f09f4816b3825adf32250aeb4
6
+ metadata.gz: b4fc6ea5d0ca80b91035456422c18fdda3f132602cee7117289c9e994b50e119962ba0b0d3ccbb67a3862f28b55e915b1923cf638a12bd83490568ff1190b752
7
+ data.tar.gz: 6a2b8ffdb61cf8d76fcabbd80215228e44d37b914678c3f4c4c8e9e0ffb44e12562639501896c662f355a3ca1b9fd58e73c425cfe3b03aa8a1d3a985e8f6d0a8
@@ -17,7 +17,7 @@ require "callstacking/rails/time_based_uuid"
17
17
  module Callstacking
18
18
  module Rails
19
19
  class Engine < ::Rails::Engine
20
- EXCLUDED_TEST_CLASSES = ['test/dummy/app/models/salutation.rb'].freeze
20
+ EXCLUDED_TEST_CLASSES = %w[test/dummy/app/models/salutation.rb test/dummy/app/controllers/application_controller.rb].freeze
21
21
 
22
22
  cattr_accessor :spans, :trace, :settings, :instrumenter, :loader
23
23
 
@@ -5,21 +5,23 @@ module Callstacking
5
5
  module Rails
6
6
  class Instrument
7
7
  attr_accessor :spans
8
- attr_reader :root, :settings, :span_modules
8
+ attr_reader :settings, :span_modules
9
9
 
10
10
  def initialize(spans)
11
11
  @spans = spans
12
12
  @span_modules = Set.new
13
13
  @settings = Callstacking::Rails::Settings.new
14
- @root = Regexp.new(::Rails.root.to_s) # <-------
15
14
  end
16
15
 
17
16
  def instrument_method(klass, method_name, application_level: true)
18
17
  method_path = (klass.instance_method(method_name).source_location.first rescue nil) ||
19
18
  (klass.method(method_name).source_location.first rescue nil)
20
19
 
20
+ # method was not defined in Ruby (i.e. native)
21
+ return if method_path.nil?
22
+
21
23
  # Application level method definitions
22
- return if method_path =~ /#{::Rails.root.to_s}/ && application_level
24
+ return if application_level && !(method_path =~ /#{::Rails.root.to_s}/)
23
25
 
24
26
  return if method_path =~ /initializer/i
25
27
 
@@ -146,7 +148,6 @@ module Callstacking
146
148
  @filtered ||= (Object.instance_methods + Object.private_instance_methods +
147
149
  Object.protected_instance_methods + Object.methods(false)).uniq
148
150
  end
149
-
150
151
  end
151
152
  end
152
153
  end
@@ -3,9 +3,8 @@ require "rails"
3
3
  module Callstacking
4
4
  module Rails
5
5
  class Loader
6
- attr_accessor :root, :instrumenter, :klasses, :excluded
6
+ attr_accessor :instrumenter, :klasses, :excluded
7
7
  def initialize(instrumenter, excluded: [])
8
- @root = Regexp.new(::Rails.root.to_s)
9
8
  @excluded = excluded
10
9
  @instrumenter = instrumenter
11
10
  @klasses = Set.new
@@ -18,7 +17,7 @@ module Callstacking
18
17
 
19
18
  excluded_klass = excluded.any? { |ex| path =~ /#{ex}/ }
20
19
 
21
- if path =~ root &&
20
+ if path =~ /#{::Rails.root.to_s}/ &&
22
21
  !klasses.include?(klass) &&
23
22
  !excluded_klass
24
23
  instrumenter.instrument_klass(klass)
@@ -34,7 +34,7 @@ module Callstacking
34
34
 
35
35
  start_request(trace_id, tuid,
36
36
  payload[:method], payload[:controller],
37
- payload[:action], payload[:format], ::Rails.root,
37
+ payload[:action], payload[:format], ::Rails.root.to_s,
38
38
  payload[:request]&.original_url || payload[:path],
39
39
  payload[:headers], payload[:params])
40
40
  end
@@ -1,5 +1,5 @@
1
1
  module Callstacking
2
2
  module Rails
3
- VERSION = "0.1.22"
3
+ VERSION = "0.1.24"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: callstacking-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.22
4
+ version: 0.1.24
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jim Jones