callstacking-rails 0.1.21 → 0.1.22

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: 1da66ff58acecfefd9f52e259cb9d69eb54e8328a4fee36ed130e26f968d61a2
4
- data.tar.gz: 2d8bc0b54633d9a17e607ee1c7006d7d728e999c5a5d5c6bfc93dd9090a1a19e
3
+ metadata.gz: db3f273ed8ae89ee3727de24fa80f8a3621ebb9aa5997874cf8f8f2607f9595b
4
+ data.tar.gz: facd7b5f062db3b4e50ecdd78857b5b0635119a8aa07589bc1e9fa03583bf036
5
5
  SHA512:
6
- metadata.gz: 737cf8e5ddf9467a6ce6ca2ae1ebeee369f5e9200b7893440fb923ecbe21638ac0ec0430ab909cddd29910b5a4bc83d04436fd2cf304109b88d7d64768232789
7
- data.tar.gz: 8f8afdfc52b192dd8e688e5f28dc8f93306241bc4347cc3c90144d7a6b7b9f210b0d9eb6037b288e6bbc4c68554e71456261fd736e5ea5e5fde6402c29051d53
6
+ metadata.gz: a74d58ed4f01a8a466ae81d763499d4a0004a97bdaee5cf8fe7aba47d97b367dbbc4ba7d2f1e8d2be0bff8d450b09a99b8de1fb4f738baa67664623583884660
7
+ data.tar.gz: 104df4887100b79f1d056fc24e7690dee30404a5c3827fd9d7fcce2c6c84e74124649a98e6c71c77cd62310d227b5987ee306d2f09f4816b3825adf32250aeb4
@@ -11,7 +11,7 @@ module Callstacking
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)
14
+ @root = Regexp.new(::Rails.root.to_s) # <-------
15
15
  end
16
16
 
17
17
  def instrument_method(klass, method_name, application_level: true)
@@ -19,7 +19,7 @@ module Callstacking
19
19
  (klass.method(method_name).source_location.first rescue nil)
20
20
 
21
21
  # Application level method definitions
22
- return unless method_path =~ root if application_level
22
+ return if method_path =~ /#{::Rails.root.to_s}/ && application_level
23
23
 
24
24
  return if method_path =~ /initializer/i
25
25
 
@@ -82,6 +82,7 @@ module Callstacking
82
82
  instrument_klass(klass, application_level: true)
83
83
  end
84
84
  end
85
+
85
86
  def disable!
86
87
  span_modules.each do |mod|
87
88
  mod.instance_methods.each do |method_name|
@@ -91,8 +92,8 @@ module Callstacking
91
92
  end
92
93
 
93
94
  def instrument_klass(klass, application_level: true)
94
- relevant = all_methods(klass) - filtered
95
- relevant.each { |method| instrument_method(klass, method, application_level: application_level) }
95
+ relevant_methods = all_methods(klass) - filtered
96
+ relevant_methods.each { |method| instrument_method(klass, method, application_level: application_level) }
96
97
  end
97
98
 
98
99
  def self.arguments_for(m, args)
@@ -3,10 +3,9 @@ require "rails"
3
3
  module Callstacking
4
4
  module Rails
5
5
  class Loader
6
- attr_accessor :root, :spans, :instrumenter, :klasses, :excluded
6
+ attr_accessor :root, :instrumenter, :klasses, :excluded
7
7
  def initialize(instrumenter, excluded: [])
8
8
  @root = Regexp.new(::Rails.root.to_s)
9
- @spans = spans
10
9
  @excluded = excluded
11
10
  @instrumenter = instrumenter
12
11
  @klasses = Set.new
@@ -17,11 +16,13 @@ module Callstacking
17
16
  klass = tp.self
18
17
  path = tp.path
19
18
 
20
- exclude = excluded.any? { |ex| path =~ /#{ex}/ }
19
+ excluded_klass = excluded.any? { |ex| path =~ /#{ex}/ }
21
20
 
22
- if path =~ root && !exclude
23
- instrumenter.instrument_klass(klass)
24
- klasses << klass
21
+ if path =~ root &&
22
+ !klasses.include?(klass) &&
23
+ !excluded_klass
24
+ instrumenter.instrument_klass(klass)
25
+ klasses << klass
25
26
  end
26
27
  end
27
28
 
@@ -1,5 +1,5 @@
1
1
  module Callstacking
2
2
  module Rails
3
- VERSION = "0.1.21"
3
+ VERSION = "0.1.22"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: callstacking-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.21
4
+ version: 0.1.22
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jim Jones
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-03-24 00:00:00.000000000 Z
11
+ date: 2023-04-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails