skylight-core 4.2.0 → 4.2.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a473587df8be0c1cf35b0296875e2cbd3c47d678be913e61c770e7d29d30756a
4
- data.tar.gz: d637956868b2c614225343bf10a063038778df91418053222d7a5e5038fcaa69
3
+ metadata.gz: 8c4b136b3f461ff94a6d693a2b1aca9c63c178e4bd3db96101ad667cfe54441e
4
+ data.tar.gz: fc5d2e143f1c03184d8ae05cbca803c5e27320ed070a04f7eff13101f4b29023
5
5
  SHA512:
6
- metadata.gz: 91aebd0cfa951251a62903542df63949db425718233e178d362318bce81e4ccd865372e4d1cd9891d1adc09d87d8ac182daf5e5c6c7ded5b81f800ba1faa3374
7
- data.tar.gz: 4d442162789bcbd47ae5bc37fabdaf49650c0fb4f7fc8b50c6a4c2c63cfe6271cd66191db27114d9985ffdcaf5a82effad58984065411b469d9cafa064f3ed63
6
+ metadata.gz: 9e9ed8c974221845ad2724cbedf5deea98a51519a3d098b6d9f5309e6660f6f0327ad6435fd5bf8e420bc3b474e377ab732e4a6fa90b80fac53f222ec16996e2
7
+ data.tar.gz: dff09e0c589d7e2d84eba7c7e5baf8edc294dd44717a5fda4cc2d1effeb9e58adb28fce645176c4d6fcd7c48a4c5ae30db6145e9c5d97367ad92e8e0c7101a24
@@ -44,17 +44,31 @@ module Skylight::Core
44
44
  end
45
45
  end
46
46
 
47
- def self.with_after_close(resp, &block)
47
+ def self.with_after_close(resp, debug_identifier: "unknown", &block)
48
48
  # Responses should be arrays but in some situations they aren't
49
49
  # e.g. https://github.com/ruby-grape/grape/issues/1041
50
- # The safest approach seems to be to rely on implicit destructuring
51
- # since that is currently what Rack::Lint does.
52
50
  # See also https://github.com/rack/rack/issues/1239
53
- status, headers, body = resp
54
51
 
52
+ unless resp.respond_to?(:to_ary)
53
+ if resp.respond_to?(:to_a)
54
+ log_target.warn("Rack response from \"#{debug_identifier}\" cannot be implicitly converted to an array. This is in violation of "\
55
+ "the Rack SPEC and will raise an error in future versions.")
56
+ resp = resp.to_a
57
+ else
58
+ log_target.error("Rack response from \"#{debug_identifier}\" cannot be converted to an array. This is in violation of the Rack SPEC "\
59
+ "and may cause problems with Skylight operation.")
60
+ return resp
61
+ end
62
+ end
63
+
64
+ status, headers, body = resp
55
65
  [status, headers, BodyProxy.new(body, &block)]
56
66
  end
57
67
 
68
+ def self.log_target
69
+ @log_target ||= (Skylight::Core::Fanout.registered.first&.config || Logger.new(STDERR))
70
+ end
71
+
58
72
  include Util::Logging
59
73
 
60
74
  # For Util::Logging
@@ -84,7 +98,7 @@ module Skylight::Core
84
98
  resp = @app.call(env)
85
99
 
86
100
  if trace
87
- Middleware.with_after_close(resp) { trace.submit }
101
+ Middleware.with_after_close(resp, debug_identifier: "Rack App: #{@app.class}") { trace.submit }
88
102
  else
89
103
  resp
90
104
  end
@@ -4,12 +4,12 @@ module Skylight::Core
4
4
  class Perform < Normalizer
5
5
  register "perform.active_job"
6
6
 
7
- DELIVERY_JOB = "ActionMailer::DeliveryJob".freeze
7
+ DELIVERY_JOB = /\AActionMailer::(Mail)?DeliveryJob\Z/.freeze
8
8
  DELAYED_JOB_WRAPPER = "ActiveJob::QueueAdapters::DelayedJobAdapter::JobWrapper".freeze
9
9
 
10
10
  def self.normalize_title(job_instance)
11
11
  job_instance.class.name.to_s.tap do |str|
12
- if str == DELIVERY_JOB
12
+ if str.match(DELIVERY_JOB)
13
13
  mailer_class, mailer_method, * = job_instance.arguments
14
14
  return ["#{mailer_class}##{mailer_method}", str]
15
15
  end
@@ -33,7 +33,7 @@ module Skylight::Core
33
33
  spans = Skylight::Core::Fanout.instrument(title: name, category: "#{category}")
34
34
  resp = call_without_sk(*args, &block)
35
35
 
36
- proxied_response = Skylight::Core::Middleware.with_after_close(resp) do
36
+ proxied_response = Skylight::Core::Middleware.with_after_close(resp, debug_identifier: "Middleware: #{name}") do
37
37
  Skylight::Core::Fanout.done(spans)
38
38
  end
39
39
  rescue Exception => err
@@ -1,5 +1,5 @@
1
1
  module Skylight
2
2
  module Core
3
- VERSION = "4.2.0".freeze
3
+ VERSION = "4.2.1".freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: skylight-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.2.0
4
+ version: 4.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tilde, Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-10-30 00:00:00.000000000 Z
11
+ date: 2020-01-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -269,8 +269,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
269
269
  - !ruby/object:Gem::Version
270
270
  version: '0'
271
271
  requirements: []
272
- rubyforge_project:
273
- rubygems_version: 2.7.6
272
+ rubygems_version: 3.0.6
274
273
  signing_key:
275
274
  specification_version: 4
276
275
  summary: The core methods of the Skylight profiler.