skylight-core 4.0.0.beta → 4.0.0.beta2

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: ab9eed2e498ca4b55dfed12501b36fdea71433e0505a2c34733a0d025b03bbdd
4
- data.tar.gz: c5a4eed17eb02f2beb8e0b54e90196429467676a9b79dbff10ecd24d0cd9c31d
3
+ metadata.gz: 5667f3a36781897ae62521c5d959f4b840901098bd3fe639b8bbce7751b7339b
4
+ data.tar.gz: c39fbb604997035cbfdaabafb2a6f9774c744711b41ae2201e34bf8ba6ee82ca
5
5
  SHA512:
6
- metadata.gz: 823f266c1a844a4e8424569b34f35afb9b5998c2688b66e299bbc4ad16c335aceffa17d24ed0c38243d89f7b8b16b202f65fdb8d416dc13a830e3505848b86a2
7
- data.tar.gz: 6c134666859922615c8083298fd42d7d7b04bbb6d2845ab08071daadb65fcc19aa471361cc197b84ddecb708694b3bebb3d8e35f9f825985348c5eacf4809afe
6
+ metadata.gz: 4afc3b9e000c00161e196a91936894b15a04adc6edb15760c69dd6adaa44357d1ed397f8dfe59f5105268f68faff22a72fcc1c1e8a0060236adc1141c97c3416
7
+ data.tar.gz: 23f7bca0c54d9266865ea766798640a6bc4d24815611fcde6dc0e0bd81a05a7710a81ab6e22ef19dd959cbdbef099b8af0c4854ccab4daea96366825369e0c0a
@@ -28,10 +28,10 @@ module Skylight::Core
28
28
  # Show 'error' if there's an unhandled exception or if the status is 4xx or 5xx
29
29
  if payload[:exception] || payload[:exception_object] || payload[:status].to_s =~ /^[45]/
30
30
  segment = "error"
31
- # We won't have a rendered_format if it's a `head` outside of a `respond_to` block.
32
- elsif payload[:rendered_format]
31
+ # We won't have a sk_rendered_format if it's a `head` outside of a `respond_to` block.
32
+ elsif payload[:sk_rendered_format]
33
33
  # We only show the variant if we actually have a format
34
- segment = [payload[:rendered_format], payload[:variant]].compact.flatten.join("+")
34
+ segment = [payload[:sk_rendered_format], payload[:sk_variant]].compact.flatten.join("+")
35
35
  end
36
36
 
37
37
  if segment
@@ -4,6 +4,17 @@ module Skylight::Core
4
4
  class Perform < Normalizer
5
5
  register "perform.active_job"
6
6
 
7
+ DELIVERY_JOB = "ActionMailer::DeliveryJob".freeze
8
+
9
+ def self.normalize_title(job_instance)
10
+ job_instance.class.name.to_s.tap do |str|
11
+ if str == DELIVERY_JOB
12
+ mailer_class, mailer_method, * = job_instance.arguments
13
+ return ["#{mailer_class}##{mailer_method}", str]
14
+ end
15
+ end
16
+ end
17
+
7
18
  CAT = "app.job.perform".freeze
8
19
 
9
20
  def normalize(trace, _name, payload)
@@ -49,11 +60,13 @@ module Skylight::Core
49
60
  # If the current endpoint name matches this payload, return true to allow the
50
61
  # segment to be assigned by normalize_after.
51
62
  trace.endpoint == Skylight::Core::Probes::ActiveJob::Probe::TITLE ||
63
+ trace.endpoint == DELIVERY_JOB ||
52
64
  trace.endpoint == normalize_title(payload[:job])
53
65
  end
54
66
 
55
67
  def normalize_title(job_instance)
56
- job_instance.class.to_s
68
+ title, * = self.class.normalize_title(job_instance)
69
+ title
57
70
  end
58
71
  end
59
72
  end
@@ -5,22 +5,23 @@ module Skylight::Core
5
5
  def install
6
6
  ::ActionController::Instrumentation.class_eval do
7
7
  private
8
-
9
8
  alias_method :append_info_to_payload_without_sk, :append_info_to_payload
10
9
  def append_info_to_payload(payload)
11
10
  append_info_to_payload_without_sk(payload)
11
+
12
12
  rendered_mime = begin
13
- if respond_to?(:rendered_format)
13
+ if respond_to?(:rendered_format) && rendered_format
14
14
  rendered_format
15
15
  elsif content_type.is_a?(Mime::Type)
16
16
  content_type
17
17
  elsif content_type.respond_to?(:to_s)
18
- type_str = content_type.to_s.split(";").first
18
+ type_str = content_type.to_s.split(';').first
19
19
  Mime::Type.lookup(type_str) unless type_str.blank?
20
20
  end
21
21
  end
22
- payload[:rendered_format] = rendered_mime.try(:ref)
23
- payload[:variant] = request.respond_to?(:variant) ? request.variant : nil
22
+
23
+ payload[:sk_rendered_format] = rendered_mime.try(:ref)
24
+ payload[:sk_variant] = request.respond_to?(:variant) ? request.variant : nil
24
25
  end
25
26
  end
26
27
  end
@@ -10,9 +10,9 @@ module Skylight::Core
10
10
  path, locals = case args.length
11
11
  when 2
12
12
  args
13
- when 3
14
- # Rails > 6.0.0.beta1 prepends an additional `view` argument
15
- args.last(2)
13
+ when 4
14
+ # Rails >= 6.0.0.beta2 arguments are (view, path, template, locals)
15
+ [args[1], args[3]]
16
16
  end
17
17
 
18
18
  layout = nil
@@ -9,8 +9,13 @@ module Skylight::Core
9
9
  begin
10
10
  job_class = job.class
11
11
  adapter_name = EnqueueProbe.normalize_adapter_name(job_class)
12
- desc = "{ adapter: #{adapter_name}, queue: '#{job.queue_name}' }"
13
- name = job_class.name
12
+
13
+ # If this is an ActionMailer::DeliveryJob, we'll report this as the mailer title
14
+ # and include ActionMailer::DeliveryJob in the description.
15
+ name, job_class_name = Skylight::Core::Normalizers::ActiveJob::Perform.normalize_title(job)
16
+ descriptors = ["adapter: '#{adapter_name}'", "queue: '#{job.queue_name}'"]
17
+ descriptors << "job: '#{job_class_name}'" if job_class_name
18
+ desc = "{ #{descriptors.join(', ')} }"
14
19
  rescue
15
20
  block.call
16
21
  else
@@ -1,5 +1,5 @@
1
1
  module Skylight
2
2
  module Core
3
- VERSION = "4.0.0-beta".freeze
3
+ VERSION = "4.0.0-beta2".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.0.0.beta
4
+ version: 4.0.0.beta2
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-02-14 00:00:00.000000000 Z
11
+ date: 2019-03-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport