callstacking-rails 0.1.31 → 0.1.32
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/callstacking/rails/client/base.rb +0 -2
- data/lib/callstacking/rails/engine.rb +2 -4
- data/lib/callstacking/rails/loader.rb +6 -3
- data/lib/callstacking/rails/settings.rb +2 -4
- data/lib/callstacking/rails/trace.rb +0 -2
- data/lib/callstacking/rails/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: 002a4d9f1b5077534ba5ea5dfc3b418fa77325a4028cd4ed9322803cb0200fb5
|
4
|
+
data.tar.gz: e9eb4f9d680d978e66f38f754b8c8e251e243628b8317dfa004df95545661048
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 70c5b03becd0e1e054a5d7142130dfce3ae8e7310a9a249ea6742a95f45b5f3f52a8f59832820c1cd981fbd556ede7f2b672de1ad56cc61e16a978a216fd0b55
|
7
|
+
data.tar.gz: 54719e4784c2c945e05eafdbc202de21c4bf425a5d0a4ce1c9403e9154851ba18a63883e2bf32712d23342cb5f9c0257d65bfd02630b9cb6bd4b58f878479baf
|
@@ -21,8 +21,6 @@ module Callstacking
|
|
21
21
|
# https://github.com/lostisland/awesome-faraday
|
22
22
|
@connection ||= Faraday.new(url) do |c|
|
23
23
|
c.response :json
|
24
|
-
c.use Faraday::Response::Logger
|
25
|
-
# c.use Faraday::Response::Logger, nil, { headers: false, bodies: false }
|
26
24
|
c.response :follow_redirects
|
27
25
|
c.use Faraday::Response::RaiseError # raise exceptions on 40x, 50x responses
|
28
26
|
c.request :json # This will set the "Content-Type" header to application/json and call .to_json on the body
|
@@ -41,11 +41,9 @@ module Callstacking
|
|
41
41
|
spans[Thread.current.object_id]||=Spans.new
|
42
42
|
instrumenter.add_span(spans[Thread.current.object_id])
|
43
43
|
|
44
|
-
@@loader = Callstacking::Rails::Loader.new(instrumenter,
|
45
|
-
|
46
|
-
|
44
|
+
@@loader = Callstacking::Rails::Loader.new(instrumenter,
|
45
|
+
excluded: settings.excluded + EXCLUDED_TEST_CLASSES)
|
47
46
|
loader.on_load
|
48
|
-
# loader.reset!
|
49
47
|
end
|
50
48
|
|
51
49
|
# Serialize all tracing requests for now.
|
@@ -4,14 +4,17 @@ require "callstacking/rails/logger"
|
|
4
4
|
module Callstacking
|
5
5
|
module Rails
|
6
6
|
class Loader
|
7
|
-
attr_accessor :instrumenter, :klasses, :excluded
|
7
|
+
attr_accessor :instrumenter, :klasses, :excluded, :settings
|
8
8
|
def initialize(instrumenter, excluded: [])
|
9
9
|
@excluded = excluded
|
10
10
|
@instrumenter = instrumenter
|
11
11
|
@klasses = Set.new
|
12
|
+
@settings = Callstacking::Rails::Settings.new
|
13
|
+
|
14
|
+
preloaded_klasses
|
12
15
|
end
|
13
16
|
|
14
|
-
def
|
17
|
+
def preloaded_klasses
|
15
18
|
ObjectSpace.each_object(Module){|ob| filter_klass(ob, (Object.const_source_location(ob.to_s)&.first rescue nil))}
|
16
19
|
end
|
17
20
|
|
@@ -41,7 +44,7 @@ module Callstacking
|
|
41
44
|
if path =~ /#{::Rails.root.to_s}/ &&
|
42
45
|
!klasses.include?(klass) &&
|
43
46
|
!excluded_klass
|
44
|
-
instrumenter.instrument_klass(klass)
|
47
|
+
instrumenter.instrument_klass(klass) if settings.enabled?
|
45
48
|
klasses << klass
|
46
49
|
end
|
47
50
|
end
|
@@ -23,9 +23,7 @@ module Callstacking
|
|
23
23
|
end
|
24
24
|
|
25
25
|
def auth_token
|
26
|
-
|
27
|
-
raise "No auth token found. #{ENV['CALLSTACKING_API_TOKEN']} Please run `callstacking login` to get one." if x.nil?
|
28
|
-
x
|
26
|
+
ENV['CALLSTACKING_API_TOKEN'] || settings[:auth_token]
|
29
27
|
end
|
30
28
|
|
31
29
|
def auth_token?
|
@@ -52,8 +50,8 @@ module Callstacking
|
|
52
50
|
end
|
53
51
|
|
54
52
|
def enabled?
|
55
|
-
return Thread.current[CACHE_KEY] if Thread.current[CACHE_KEY].present?
|
56
53
|
return ActiveRecord::Type::Boolean.new.cast(ENV[ENV_KEY]) if ENV[ENV_KEY].present?
|
54
|
+
return Thread.current[CACHE_KEY] if Thread.current[CACHE_KEY].present?
|
57
55
|
false
|
58
56
|
end
|
59
57
|
|
@@ -148,8 +148,6 @@ module Callstacking
|
|
148
148
|
lock.synchronize do
|
149
149
|
return if traces.empty?
|
150
150
|
|
151
|
-
STDERR.puts "Sending #{traces.size} traces to Callstacking.io -- enabled? - #{settings.enabled?} -- #{traces.inspect}"
|
152
|
-
|
153
151
|
client.upsert(trace_id,
|
154
152
|
{ trace_entries: traces.deep_dup })
|
155
153
|
traces.clear
|