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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3b2fde17350e1e195b3e7aa1cf8084b435d474c8d73aee1e83b2924cf8809a40
4
- data.tar.gz: 253e27024b75ef3a5d1cb538b87275afbe373b9645b41d56ff751d86c3c27612
3
+ metadata.gz: c4147059f707d6d81dfc82021c4c56344701560054f5f11b1fb5411b58d94f2e
4
+ data.tar.gz: ce4180ae0fde1b5300d67d4919ff7883204ea61bcc2fe4b13d23fc8471abef2a
5
5
  SHA512:
6
- metadata.gz: dd586cd99584f463ef1c77e25c8c4e2c0920dc66115528c90a53af483e3601f1b1d4a554c9b80e0f403174ceb67fa5e3956d10a60d4c96c206f1669bd74d7c0d
7
- data.tar.gz: 74fc43ecc58017374a011982100e1780ff44e7c068b36c814626be37e85ac517b658527e7021bd7ea2b500b499935b807745cb52a54989f1e23b413f093cd90a
6
+ metadata.gz: 39314b333fefeab949b3cb10948e8efa5dd09fd51bf77194e7cc0542e159d1a693d83fea4fdbd7272e0968915154d68387a0e49bc0c28f10e0eb33d2934ae3db
7
+ data.tar.gz: ff02750df626ada2511ba6ead16311d8ea5afe42835b25a031328e765a432c7839dabdacc336e4a07ba0d69fffcac07b0795b767ca7905de4b8cc36cc2f81a11
data/README.md CHANGED
@@ -1,5 +1,5 @@
1
1
  gem build catpm.gemspec
2
- gem push catpm-0.10.1.gem
2
+ gem push catpm-0.10.2.gem
3
3
 
4
4
  # Catpm
5
5
 
@@ -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 HTTP request — just run the block
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Catpm
4
- VERSION = '0.10.2'
4
+ VERSION = '0.10.3'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: catpm
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.2
4
+ version: 0.10.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - ''