skylight-core 4.0.0.alpha3 → 4.0.0.alpha4

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: dc9eb39c7b8b4247a019740d8ac1784ed1442ae33f20bfc04fe061be5151a8e3
4
- data.tar.gz: 78c44b3fe3015152a7ebef7da37986e25bd87d48ddae853fdd7af77030dcb40b
3
+ metadata.gz: 5b333f6d3704521099216e030773e068bbae7fb08cdea202b8ffc81e76a0beed
4
+ data.tar.gz: 00042ab9ca7c24ccba1ea0ebebcbfb664aa78755cfc9d6ae6595f2f7e5754bd4
5
5
  SHA512:
6
- metadata.gz: 6797bce1826972cba73f28d2f4c0c941fb3b9f6e593e022d6d58f7fccb155e9162055a0d3defc82aa790d8c2d4c308cd662ea9014dcdce19c3e8d3cf6eaaf201
7
- data.tar.gz: 9831703c5ed2ecf9468c0b6ffde0237c04fe7f7abadb9c4eee9b4697730521a8a870cff9d42089edb571d3ff3ce96f16c017fbef132c4f6af0e9580b38a2ae05
6
+ metadata.gz: 38a125f7978eb1c05a848a06edaf10ffea2b16227ea474ea0e9a069633ed40029baf8667e569a9664621a486e0bea053011609c9703d634f20ca04489d9aae46
7
+ data.tar.gz: c53a44d21608de2a245a8b36ef8d7d4b02870723c88dde340d036473803002f2bef202354cafe3e5b040988adc083dceebf4e575508add93d068945dd13f1fd5
@@ -11,7 +11,7 @@ module Skylight::Core
11
11
  adapter_name = normalize_adapter_name(payload[:adapter])
12
12
  desc = "{ adapter: '#{adapter_name}', queue: '#{payload[:job].queue_name}' }"
13
13
 
14
- trace.endpoint = title
14
+ maybe_set_endpoint(trace, title)
15
15
 
16
16
  [CAT, title, desc]
17
17
  end
@@ -29,6 +29,16 @@ module Skylight::Core
29
29
  rescue
30
30
  "active_job"
31
31
  end
32
+
33
+ def maybe_set_endpoint(trace, string)
34
+ trace.endpoint ||= string
35
+
36
+ # If a job is called using #perform_now inside a controller action
37
+ # or within another job's #perform method, we do not want this to
38
+ # overwrite the existing endpoint name (unless it is the default from ActiveJob).
39
+ return unless trace.endpoint == Skylight::Core::Probes::ActiveJob::Probe::TITLE
40
+ trace.endpoint = string
41
+ end
32
42
  end
33
43
  end
34
44
  end
@@ -2,12 +2,14 @@ module Skylight::Core
2
2
  module Probes
3
3
  module ActiveJob
4
4
  class Probe
5
+ TITLE = "ActiveJob.execute".freeze
6
+
5
7
  def install
6
8
  ::ActiveJob::Base.instance_eval do
7
9
  alias execute_without_sk execute
8
10
 
9
11
  def execute(*args)
10
- Skylight.trace("ActiveJob.execute", "app.job.execute") do |trace|
12
+ Skylight.trace(TITLE, "app.job.execute") do |trace|
11
13
  # See normalizers/active_job/perform for endpoint/segment assignment
12
14
  begin
13
15
  execute_without_sk(*args)
@@ -1,5 +1,5 @@
1
1
  module Skylight
2
2
  module Core
3
- VERSION = "4.0.0-alpha3".freeze
3
+ VERSION = "4.0.0-alpha4".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.alpha3
4
+ version: 4.0.0.alpha4
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-01-10 00:00:00.000000000 Z
11
+ date: 2019-01-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport