sentry-delayed_job 4.4.0 → 5.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: '073666230855d7feec1b755a29eb3034ea05ace480b366d6d9d9dfc1fd8ca646'
4
- data.tar.gz: '09e3428050940d6bb9978f9b380322c932b90b52f85cd132dc3aeeddd3ef0fbf'
3
+ metadata.gz: '036399cfd74f8e9417a277a1ff382f1d495ba812a256954beb8433721066ffe9'
4
+ data.tar.gz: 8e7add89ab01a9d680f705768d4ce4f23be01e8150007871eb9a01075b94dfe8
5
5
  SHA512:
6
- metadata.gz: 649c62683c72a9a42bc880bac37e94837a68fb987d3de16ead6d9c74fbe5dde1b3214f782ec4e4761005212e3376a19bdebcb960368016e9de43a4d7ff89970b
7
- data.tar.gz: 21225b60fd9fed8798e7745d247c71372cc36b7f69516b411d28f13bb8bb87fbadda1ef2250807ad90e68cd517f3896d73e24b28feab83d4da67fade97e010c7
6
+ metadata.gz: 83d2102cb679f89fc9a160807879eb2c84574abd68092eb590045adff4adb3127146fdb1c69fe888da3a4f0e3d7d6992547fe3a023bbe311d96e195168561a00
7
+ data.tar.gz: b044bb6ee66131a19bc397281004e980e1b6060f2467a4dd5880cfffd656128baa484a4ffcb7c97292396edd68d8c216098937c7260f788411f9747973e22598
data/CHANGELOG.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # Changelog
2
2
 
3
+ Individual gem's changelog has been deprecated. Please check the [project changelog](https://github.com/getsentry/sentry-ruby/blob/master/CHANGELOG.md).
4
+
3
5
  ## 4.4.0
4
6
 
5
7
  ### Features
data/Gemfile CHANGED
@@ -8,11 +8,13 @@ gem "i18n", "<= 1.8.7"
8
8
 
9
9
  gem "rake", "~> 12.0"
10
10
  gem "rspec", "~> 3.0"
11
- gem "codecov", "0.2.12"
11
+ gem 'simplecov'
12
+ gem "simplecov-cobertura", "~> 1.4"
13
+ gem "rexml"
12
14
 
13
15
  gem "delayed_job"
14
16
  gem "delayed_job_active_record"
15
- gem "rails"
17
+ gem "rails", "< 7.0"
16
18
  gem "activerecord-jdbcmysql-adapter", platform: :jruby
17
19
  gem "jdbc-sqlite3", platform: :jruby
18
20
  gem "sqlite3", platform: :ruby
@@ -21,3 +23,4 @@ gem "sentry-ruby", path: "../sentry-ruby"
21
23
  gem "sentry-rails", path: "../sentry-rails"
22
24
 
23
25
  gem "pry"
26
+ gem "debug", github: "ruby/debug", platform: :ruby if RUBY_VERSION.to_f >= 2.6
data/LICENSE.txt CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2020 st0012
3
+ Copyright (c) 2020 Sentry
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
data/example/Gemfile CHANGED
@@ -8,3 +8,4 @@ gem "sentry-delayed_job", path: "../"
8
8
  gem "sentry-ruby", path: "../../sentry-ruby"
9
9
 
10
10
  gem "pry"
11
+ gem "debug", github: "ruby/debug"
@@ -13,14 +13,21 @@ module Sentry
13
13
  next block.call(job, *args) unless Sentry.initialized?
14
14
 
15
15
  Sentry.with_scope do |scope|
16
- scope.set_contexts(**generate_contexts(job))
16
+ contexts = generate_contexts(job)
17
+ scope.set_transaction_name(contexts.dig(ACTIVE_JOB_CONTEXT_KEY, :job_class) || contexts.dig(DELAYED_JOB_CONTEXT_KEY, :job_class))
18
+ scope.set_contexts(**contexts)
17
19
  scope.set_tags("delayed_job.queue" => job.queue, "delayed_job.id" => job.id.to_s)
18
20
 
21
+ transaction = Sentry.start_transaction(name: scope.transaction_name, op: "delayed_job")
22
+ scope.set_span(transaction) if transaction
23
+
19
24
  begin
20
25
  block.call(job, *args)
26
+
27
+ finish_transaction(transaction, 200)
21
28
  rescue Exception => e
22
29
  capture_exception(e, job)
23
-
30
+ finish_transaction(transaction, 500)
24
31
  raise
25
32
  end
26
33
  end
@@ -40,7 +47,8 @@ module Sentry
40
47
  queue: job.queue,
41
48
  created_at: job.created_at,
42
49
  last_error: job.last_error&.byteslice(0..1000),
43
- handler: job.handler&.byteslice(0..1000)
50
+ handler: job.handler&.byteslice(0..1000),
51
+ job_class: compute_job_class(job.payload_object),
44
52
  }
45
53
 
46
54
  if job.payload_object.respond_to?(:job_data)
@@ -54,6 +62,15 @@ module Sentry
54
62
  context
55
63
  end
56
64
 
65
+ def self.compute_job_class(payload_object)
66
+ if payload_object.is_a? Delayed::PerformableMethod
67
+ klass = payload_object.object.is_a?(Class) ? payload_object.object.name : payload_object.object.class.name
68
+ "#{klass}##{payload_object.method_name}"
69
+ else
70
+ payload_object.class.name
71
+ end
72
+ end
73
+
57
74
  def self.capture_exception(exception, job)
58
75
  Sentry::DelayedJob.capture_exception(exception, hint: { background: false }) if report?(job)
59
76
  end
@@ -65,6 +82,13 @@ module Sentry
65
82
  # count at this point.
66
83
  job.attempts >= Delayed::Worker.max_attempts.pred
67
84
  end
85
+
86
+ def self.finish_transaction(transaction, status)
87
+ return unless transaction
88
+
89
+ transaction.set_http_status(status)
90
+ transaction.finish
91
+ end
68
92
  end
69
93
  end
70
94
  end
@@ -1,5 +1,5 @@
1
1
  module Sentry
2
2
  module DelayedJob
3
- VERSION = "4.4.0"
3
+ VERSION = "5.0.2"
4
4
  end
5
5
  end
@@ -14,7 +14,7 @@ module Sentry
14
14
  if defined?(::Rails::Railtie)
15
15
  class Railtie < ::Rails::Railtie
16
16
  config.after_initialize do
17
- next unless Sentry.initialized?
17
+ next unless Sentry.initialized? && defined?(::Sentry::Rails)
18
18
 
19
19
  Sentry.configuration.rails.skippable_job_adapters << "ActiveJob::QueueAdapters::DelayedJobAdapter"
20
20
  end
@@ -6,7 +6,7 @@ Gem::Specification.new do |spec|
6
6
  spec.authors = ["Sentry Team"]
7
7
  spec.description = spec.summary = "A gem that provides DelayedJob integration for the Sentry error logger"
8
8
  spec.email = "accounts@sentry.io"
9
- spec.license = 'Apache-2.0'
9
+ spec.license = 'MIT'
10
10
  spec.homepage = "https://github.com/getsentry/sentry-ruby"
11
11
 
12
12
  spec.platform = Gem::Platform::RUBY
@@ -16,11 +16,12 @@ Gem::Specification.new do |spec|
16
16
 
17
17
  spec.metadata["homepage_uri"] = spec.homepage
18
18
  spec.metadata["source_code_uri"] = spec.homepage
19
- spec.metadata["changelog_uri"] = "#{spec.homepage}/blob/master/sentry-delayed_job/CHANGELOG.md"
19
+ spec.metadata["changelog_uri"] = "#{spec.homepage}/blob/master/CHANGELOG.md"
20
20
 
21
21
  spec.bindir = "exe"
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", "~> 4.4.0.pre.beta"
25
+ spec.add_dependency "sentry-ruby-core", "~> 5.0.2"
26
+ spec.add_dependency "delayed_job", ">= 4.0"
26
27
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sentry-delayed_job
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.4.0
4
+ version: 5.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sentry Team
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-05-03 00:00:00.000000000 Z
11
+ date: 2022-01-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sentry-ruby-core
@@ -16,14 +16,28 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 4.4.0.pre.beta
19
+ version: 5.0.2
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: 4.4.0.pre.beta
26
+ version: 5.0.2
27
+ - !ruby/object:Gem::Dependency
28
+ name: delayed_job
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '4.0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '4.0'
27
41
  description: A gem that provides DelayedJob integration for the Sentry error logger
28
42
  email: accounts@sentry.io
29
43
  executables: []
@@ -32,7 +46,6 @@ extra_rdoc_files:
32
46
  - README.md
33
47
  - LICENSE.txt
34
48
  files:
35
- - ".craft.yml"
36
49
  - ".gitignore"
37
50
  - ".rspec"
38
51
  - CHANGELOG.md
@@ -53,11 +66,11 @@ files:
53
66
  - sentry-delayed_job.gemspec
54
67
  homepage: https://github.com/getsentry/sentry-ruby
55
68
  licenses:
56
- - Apache-2.0
69
+ - MIT
57
70
  metadata:
58
71
  homepage_uri: https://github.com/getsentry/sentry-ruby
59
72
  source_code_uri: https://github.com/getsentry/sentry-ruby
60
- changelog_uri: https://github.com/getsentry/sentry-ruby/blob/master/sentry-delayed_job/CHANGELOG.md
73
+ changelog_uri: https://github.com/getsentry/sentry-ruby/blob/master/CHANGELOG.md
61
74
  post_install_message:
62
75
  rdoc_options: []
63
76
  require_paths:
@@ -73,7 +86,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
73
86
  - !ruby/object:Gem::Version
74
87
  version: '0'
75
88
  requirements: []
76
- rubygems_version: 3.0.3.1
89
+ rubygems_version: 3.1.6
77
90
  signing_key:
78
91
  specification_version: 4
79
92
  summary: A gem that provides DelayedJob integration for the Sentry error logger
data/.craft.yml DELETED
@@ -1,20 +0,0 @@
1
- minVersion: '0.13.2'
2
- github:
3
- owner: getsentry
4
- repo: sentry-ruby
5
- changelogPolicy: simple
6
- preReleaseCommand: ruby ../.scripts/bump-version.rb
7
- releaseBranchPrefix: release-sentry-delayed_job
8
- statusProvider:
9
- name: github
10
- artifactProvider:
11
- name: github
12
- targets:
13
- - name: gem
14
- - name: registry
15
- type: sdk
16
- config:
17
- canonical: 'gem:sentry-delayed_job'
18
- - name: github
19
- tagPrefix: sentry-delayed_job-v
20
- changelog: sentry-delayed_job/CHANGELOG