catpm 0.10.2 → 0.10.3
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/README.md +1 -1
- data/lib/catpm/segment_subscribers.rb +7 -0
- data/lib/catpm/trace.rb +4 -4
- data/lib/catpm/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: c4147059f707d6d81dfc82021c4c56344701560054f5f11b1fb5411b58d94f2e
|
|
4
|
+
data.tar.gz: ce4180ae0fde1b5300d67d4919ff7883204ea61bcc2fe4b13d23fc8471abef2a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 39314b333fefeab949b3cb10948e8efa5dd09fd51bf77194e7cc0542e159d1a693d83fea4fdbd7272e0968915154d68387a0e49bc0c28f10e0eb33d2934ae3db
|
|
7
|
+
data.tar.gz: ff02750df626ada2511ba6ead16311d8ea5afe42835b25a031328e765a432c7839dabdacc336e4a07ba0d69fffcac07b0795b767ca7905de4b8cc36cc2f81a11
|
data/README.md
CHANGED
|
@@ -61,6 +61,11 @@ module Catpm
|
|
|
61
61
|
target = job.class.name
|
|
62
62
|
return if Catpm.config.ignored?(target)
|
|
63
63
|
|
|
64
|
+
# Mark that we're inside a job so nested Catpm.span calls don't
|
|
65
|
+
# promote themselves to standalone endpoints when this job is not
|
|
66
|
+
# selected for segment sampling.
|
|
67
|
+
Thread.current[:catpm_job_active] = true
|
|
68
|
+
|
|
64
69
|
if Collector.should_instrument?(:job, target, job.queue_name)
|
|
65
70
|
use_sampler = Catpm.config.instrument_stack_sampler || Catpm.config.instrument_call_tree
|
|
66
71
|
start_time = Process.clock_gettime(Process::CLOCK_MONOTONIC)
|
|
@@ -79,6 +84,8 @@ module Catpm
|
|
|
79
84
|
end
|
|
80
85
|
|
|
81
86
|
def finish(_name, _id, payload)
|
|
87
|
+
Thread.current[:catpm_job_active] = nil
|
|
88
|
+
|
|
82
89
|
return unless payload[:_catpm_job_owns_segments]
|
|
83
90
|
|
|
84
91
|
req_segments = Thread.current[:catpm_request_segments]
|
data/lib/catpm/trace.rb
CHANGED
|
@@ -9,9 +9,9 @@ module Catpm
|
|
|
9
9
|
|
|
10
10
|
req_segments = Thread.current[:catpm_request_segments]
|
|
11
11
|
unless req_segments
|
|
12
|
-
# Inside a non-instrumented
|
|
12
|
+
# Inside a non-instrumented request/job — just run the block
|
|
13
13
|
# without promoting the span to a standalone endpoint
|
|
14
|
-
if Thread.current[:catpm_request_start]
|
|
14
|
+
if Thread.current[:catpm_request_start] || Thread.current[:catpm_job_active]
|
|
15
15
|
return block.call if block
|
|
16
16
|
return nil
|
|
17
17
|
end
|
|
@@ -52,7 +52,7 @@ module Catpm
|
|
|
52
52
|
type: :custom, duration: duration_ms, detail: name,
|
|
53
53
|
source: source, started_at: start_time
|
|
54
54
|
)
|
|
55
|
-
elsif buffer && !Thread.current[:catpm_request_start]
|
|
55
|
+
elsif buffer && !Thread.current[:catpm_request_start] && !Thread.current[:catpm_job_active]
|
|
56
56
|
Collector.process_custom(
|
|
57
57
|
name: name, duration: duration_ms,
|
|
58
58
|
metadata: metadata, error: error, context: context
|
|
@@ -155,7 +155,7 @@ module Catpm
|
|
|
155
155
|
type: :custom, duration: duration_ms, detail: @name,
|
|
156
156
|
source: source, started_at: @start_time
|
|
157
157
|
)
|
|
158
|
-
elsif Catpm.enabled? && Catpm.buffer && !Thread.current[:catpm_request_start]
|
|
158
|
+
elsif Catpm.enabled? && Catpm.buffer && !Thread.current[:catpm_request_start] && !Thread.current[:catpm_job_active]
|
|
159
159
|
Collector.process_custom(
|
|
160
160
|
name: @name, duration: duration_ms,
|
|
161
161
|
metadata: @metadata, error: error, context: @context
|
data/lib/catpm/version.rb
CHANGED