railswatch_gem 0.4.0 → 0.4.1
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 +4 -4
- data/lib/railswatch_gem/railtie.rb +4 -5
- data/lib/railswatch_gem/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: e813b247ee297eccab4b8fc1e2240142bdd0dfe29a49c95bb6e39e2e7ff38ecd
|
|
4
|
+
data.tar.gz: fb805d469b067b639d1e2860f68d0ca51cd2360b544ccce7f9a4b868984fde08
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 66833fbfc3fc437c766c07686167d7224c190876d0d9d4f93431db6fb9a11e6d795ea1fb5f73eeec62c44b9c719fb790c033ce800b12fc2ee2bda9024e138ff9
|
|
7
|
+
data.tar.gz: 1f4e3dac70f8e457c73f944fd63426d09e908c41537719a85f50dad8a86e777065899066342939f8aa853e3069a87d5a45bbfe6ea40306ad3fbf641605a78928
|
|
@@ -2,9 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
module RailswatchGem
|
|
4
4
|
class Railtie < ::Rails::Railtie
|
|
5
|
-
# Paths that belong to the host application (not gems or Ruby internals)
|
|
6
|
-
APP_PATH_PATTERN = %r{/(app|lib|config)/}.freeze
|
|
7
|
-
IGNORE_PATH_PATTERN = %r{/vendor/|/railswatch_gem/}.freeze
|
|
8
5
|
MAX_STACKTRACE_FRAMES = 10
|
|
9
6
|
|
|
10
7
|
config.after_initialize do
|
|
@@ -45,6 +42,8 @@ module RailswatchGem
|
|
|
45
42
|
|
|
46
43
|
initializer "railswatch.query_source_location" do
|
|
47
44
|
ActiveSupport.on_load(:active_record) do
|
|
45
|
+
app_root = Rails.root.to_s
|
|
46
|
+
|
|
48
47
|
ActiveSupport::Notifications.subscribe("sql.active_record") do |*, payload|
|
|
49
48
|
next unless RailswatchGem.config.enabled
|
|
50
49
|
next unless RailswatchGem.config.track_query_source
|
|
@@ -53,9 +52,9 @@ module RailswatchGem
|
|
|
53
52
|
next unless span&.recording?
|
|
54
53
|
|
|
55
54
|
frames = caller_locations(0, 40)
|
|
56
|
-
.select { |f| f.path.
|
|
55
|
+
.select { |f| f.path.start_with?(app_root) && !f.path.include?("/vendor/") }
|
|
57
56
|
.first(MAX_STACKTRACE_FRAMES)
|
|
58
|
-
.map { |f| "#{f.path}:#{f.lineno} in `#{f.label}`" }
|
|
57
|
+
.map { |f| "#{f.path.delete_prefix(app_root + '/')}:#{f.lineno} in `#{f.label}`" }
|
|
59
58
|
|
|
60
59
|
span.set_attribute("code.stacktrace", frames.join("\n")) if frames.any?
|
|
61
60
|
rescue => e
|