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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 32743c94e97432eef4a4977e0e123eb7f2539d99e6505ee7b05c6e1d3fb32ee6
|
4
|
+
data.tar.gz: fa3c04dcba5a84dd926d5ae21c9b0238c9d4843f396d66066ea3406c851f8b6a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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 = [
|
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 :
|
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}/
|
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 :
|
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
|