sentry-resque 5.1.0 → 5.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/sentry/resque/version.rb +1 -1
- data/lib/sentry/resque.rb +58 -46
- data/sentry-resque.gemspec +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 47ed5386880ace81cea24fd9d6a2e3a71169c8b7edf520335666107101bafaf9
|
4
|
+
data.tar.gz: 288dbf76154789de5192033c4679061add2387af8413fb2c56667b4e66a73d7c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8ca1d97342063ef49772edd169ee0c4bcacdba8b3352ec0759baf2e5a27ffee25b3d4b3b584bdde0b145fb4b72908499688ab74f4d91090881686ba5649bdb80
|
7
|
+
data.tar.gz: 20904c4043323ff3104302a28d9c865e7c150738dfe3e79924b71a22d004752d712adfe419cb4d004d78b76d8fbcbbc43b858ba0fe9d75641e1059911080fd5f
|
data/lib/sentry/resque.rb
CHANGED
@@ -5,63 +5,75 @@ require "resque"
|
|
5
5
|
module Sentry
|
6
6
|
module Resque
|
7
7
|
def perform
|
8
|
-
|
8
|
+
if Sentry.initialized?
|
9
|
+
SentryReporter.record(queue, worker, payload) do
|
10
|
+
super
|
11
|
+
end
|
12
|
+
else
|
13
|
+
super
|
14
|
+
end
|
15
|
+
end
|
9
16
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
scope
|
14
|
-
|
17
|
+
class SentryReporter
|
18
|
+
class << self
|
19
|
+
def record(queue, worker, payload, &block)
|
20
|
+
Sentry.with_scope do |scope|
|
21
|
+
begin
|
22
|
+
contexts = generate_contexts(queue, worker, payload)
|
23
|
+
scope.set_contexts(**contexts)
|
24
|
+
scope.set_tags("resque.queue" => queue)
|
15
25
|
|
16
|
-
|
17
|
-
|
18
|
-
|
26
|
+
scope.set_transaction_name(contexts.dig(:"Active-Job", :job_class) || contexts.dig(:"Resque", :job_class))
|
27
|
+
transaction = Sentry.start_transaction(name: scope.transaction_name, op: "resque")
|
28
|
+
scope.set_span(transaction) if transaction
|
19
29
|
|
20
|
-
|
30
|
+
yield
|
21
31
|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
32
|
+
finish_transaction(transaction, 200)
|
33
|
+
rescue Exception => exception
|
34
|
+
::Sentry::Resque.capture_exception(exception, hint: { background: false })
|
35
|
+
finish_transaction(transaction, 500)
|
36
|
+
raise
|
37
|
+
end
|
38
|
+
end
|
27
39
|
end
|
28
|
-
end
|
29
|
-
end
|
30
40
|
|
31
|
-
|
32
|
-
|
41
|
+
def generate_contexts(queue, worker, payload)
|
42
|
+
context = {}
|
33
43
|
|
34
|
-
|
35
|
-
|
44
|
+
if payload["class"] == "ActiveJob::QueueAdapters::ResqueAdapter::JobWrapper"
|
45
|
+
active_job_payload = payload["args"].first
|
36
46
|
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
47
|
+
context[:"Active-Job"] = {
|
48
|
+
job_class: active_job_payload["job_class"],
|
49
|
+
job_id: active_job_payload["job_id"],
|
50
|
+
arguments: active_job_payload["arguments"],
|
51
|
+
executions: active_job_payload["executions"],
|
52
|
+
exception_executions: active_job_payload["exception_executions"],
|
53
|
+
locale: active_job_payload["locale"],
|
54
|
+
enqueued_at: active_job_payload["enqueued_at"],
|
55
|
+
queue: queue,
|
56
|
+
worker: worker.to_s
|
57
|
+
}
|
58
|
+
else
|
59
|
+
context[:"Resque"] = {
|
60
|
+
job_class: payload["class"],
|
61
|
+
arguments: payload["args"],
|
62
|
+
queue: queue,
|
63
|
+
worker: worker.to_s
|
64
|
+
}
|
65
|
+
end
|
56
66
|
|
57
|
-
|
58
|
-
|
67
|
+
context
|
68
|
+
end
|
59
69
|
|
60
|
-
|
61
|
-
|
70
|
+
def finish_transaction(transaction, status)
|
71
|
+
return unless transaction
|
62
72
|
|
63
|
-
|
64
|
-
|
73
|
+
transaction.set_http_status(status)
|
74
|
+
transaction.finish
|
75
|
+
end
|
76
|
+
end
|
65
77
|
end
|
66
78
|
end
|
67
79
|
end
|
data/sentry-resque.gemspec
CHANGED
@@ -22,6 +22,6 @@ Gem::Specification.new do |spec|
|
|
22
22
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
23
23
|
spec.require_paths = ["lib"]
|
24
24
|
|
25
|
-
spec.add_dependency "sentry-ruby-core", "~> 5.1.
|
25
|
+
spec.add_dependency "sentry-ruby-core", "~> 5.1.1"
|
26
26
|
spec.add_dependency "resque", ">= 1.24"
|
27
27
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sentry-resque
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.1.
|
4
|
+
version: 5.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sentry Team
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-02-
|
11
|
+
date: 2022-02-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sentry-ruby-core
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 5.1.
|
19
|
+
version: 5.1.1
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 5.1.
|
26
|
+
version: 5.1.1
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: resque
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|