skylight-core 4.0.1 → 4.0.2

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: 1f304ee5634a0e64ef85b3b34bf2f29f21db7ec1a512d4e6c0441e2e1977ba86
4
- data.tar.gz: 85ee002ae23cb1a6b61858e23294c97258da9a06723f815afd9ad741a0a389b3
3
+ metadata.gz: 5c97eeb92d20fa41cb51d27ca04a7fd736ba6fcb0c81f7697fa89bff76666cbb
4
+ data.tar.gz: 439e037bbb5e5d0e9f8262fd533b4b570e84392122ea4a9eb4e8f5bd36d5308a
5
5
  SHA512:
6
- metadata.gz: 1721fb03d1982d06c9f1e9b7d668f9ea7efdc3c416a796e70613fa71b20804c0dc922bc9b218af6fba2897074a42bb909b1e8f866ceaa0949cf137f9f531d4fc
7
- data.tar.gz: 215e468eea9895f4a1181b9717d3a0fb49cf036c13188fc33e3516dd4d0c3c05d002a121eed9180cf9ef20c7866f9ac165de1cb9c984bfcfa5b2551e4be86d08
6
+ metadata.gz: 3681da84f5e8bcc320de64d555b7520311c4143d593ac1df00e06991d85368b43b157d12f25b771be5dd9ef7ae2b512b8d5126c126a02b1f385180cac18fb7c8
7
+ data.tar.gz: b087cdf2965947ead6ea3186fdc85a7c25f6e0fbe7402b11fa5082fc1b7919338b57eec43a7c3f8b327eb8496996414a75f249b236f907457c16cbf951ceb537
@@ -5,6 +5,7 @@ module Skylight::Core
5
5
  register "perform.active_job"
6
6
 
7
7
  DELIVERY_JOB = "ActionMailer::DeliveryJob".freeze
8
+ DELAYED_JOB_WRAPPER = "ActiveJob::QueueAdapters::DelayedJobAdapter::JobWrapper".freeze
8
9
 
9
10
  def self.normalize_title(job_instance)
10
11
  job_instance.class.name.to_s.tap do |str|
@@ -51,7 +52,10 @@ module Skylight::Core
51
52
  def assign_endpoint?(trace, payload)
52
53
  # Always assign the endpoint if it has not yet been assigned by the ActiveJob probe.
53
54
  return true unless trace.endpoint
54
- return unless defined?(Skylight::Core::Probes::ActiveJob::Probe::TITLE)
55
+ return true if defined?(Skylight::Core::Probes::ActiveJob::Probe::TITLE) &&
56
+ trace.endpoint == Skylight::Core::Probes::ActiveJob::Probe::TITLE
57
+ return true if defined?(SKylight::Core::Probes::DelayedJob::Probe::UNKNOWN) &&
58
+ trace.endpoint == Skylight::Core::Probes::DelayedJob::Probe::UNKNOWN
55
59
 
56
60
  # If a job is called using #perform_now inside a controller action
57
61
  # or within another job's #perform method, we do not want this to
@@ -59,9 +63,12 @@ module Skylight::Core
59
63
  #
60
64
  # If the current endpoint name matches this payload, return true to allow the
61
65
  # segment to be assigned by normalize_after.
62
- trace.endpoint == Skylight::Core::Probes::ActiveJob::Probe::TITLE ||
63
- trace.endpoint == DELIVERY_JOB ||
64
- trace.endpoint == normalize_title(payload[:job])
66
+ trace.endpoint == DELIVERY_JOB ||
67
+ trace.endpoint == normalize_title(payload[:job]) ||
68
+ # This adapter wrapper needs to be handled specifically due to interactions with the
69
+ # standalone Delayed::Job probe, as there is no consistent way to get the wrapped
70
+ # job name among all Delayed::Job backends.
71
+ trace.endpoint == DELAYED_JOB_WRAPPER
65
72
  end
66
73
 
67
74
  def normalize_title(job_instance)
@@ -2,6 +2,8 @@ module Skylight::Core
2
2
  module Probes
3
3
  module DelayedJob
4
4
  class Probe
5
+ UNKNOWN = "<Delayed::Job Unknown>".freeze
6
+
5
7
  def install
6
8
  return unless validate_version
7
9
  ::Delayed::Worker.class_eval do
@@ -11,7 +13,18 @@ module Skylight::Core
11
13
 
12
14
  def run(job, *args)
13
15
  t { "Delayed::Job beginning trace" }
14
- Skylight.trace(job.name, "app.delayed_job.worker", "Delayed::Worker#run", segment: job.queue) do
16
+
17
+ handler_name = begin
18
+ if defined?(::Delayed::PerformableMethod) && job.payload_object.is_a?(::Delayed::PerformableMethod)
19
+ job.name
20
+ else
21
+ job.payload_object.class.name
22
+ end
23
+ rescue
24
+ UNKNOWN
25
+ end
26
+
27
+ Skylight.trace(handler_name, "app.delayed_job.worker", "Delayed::Worker#run", segment: job.queue) do
15
28
  run_without_sk(job, *args)
16
29
  end
17
30
  end
@@ -1,5 +1,5 @@
1
1
  module Skylight
2
2
  module Core
3
- VERSION = "4.0.1".freeze
3
+ VERSION = "4.0.2".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.1
4
+ version: 4.0.2
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-05-09 00:00:00.000000000 Z
11
+ date: 2019-05-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport