sentry-sidekiq 5.4.2 → 5.10.0

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: 53659362d3b216b6fecb61f4248e7f3fda05f4ee88c5f8c1806e8c803c8d00dc
4
- data.tar.gz: 6f31c87f55e00ecbe173c491a9f94b35599040f473bee8075211e9bd3c1d2318
3
+ metadata.gz: e0032fc4b32f7d021cb268513357d37f6697fcae83a4d976a9b0e011e31931e9
4
+ data.tar.gz: f32997df5b2f5aab6430d5828f8a678eff2e3440fc3b55b64f1bea5ab7de752f
5
5
  SHA512:
6
- metadata.gz: 37a5e6593a7189eb0b183ea7f36b69c628f039573f9bf0b9b73de59966cbe52cf5aedb26489e3ec39c1a1a7bc56adf0c15724d8dd939ee8f97bdd19d7e4697a0
7
- data.tar.gz: 49253e2afe2bf91f25f4b3dfae74bd81b0d327050172c7926ef8520f89c46355ccaf284014dbc795743c819b5100d9f28c14dc410e3d3e05a33dbbd29ea985bc
6
+ metadata.gz: 36a7e7af214cfa651ab6a05c34735cb27ada4647a74c2ec3cf4e10af65eee47dd9cfd6bd8551c50971aede6315849f63c7fc44cefa7c8770504421cf24c3333d
7
+ data.tar.gz: a74c6e2bd56eba75ad59504c87636a4de882f890af3ae97d898d2b8c9db7ff7431cc14d55aff13e4bdf44c6b287af4ff3417afad2eaa42806da585c742097119
data/Gemfile CHANGED
@@ -3,23 +3,28 @@ git_source(:github) { |name| "https://github.com/#{name}.git" }
3
3
 
4
4
  # Specify your gem's dependencies in sentry-ruby.gemspec
5
5
  gemspec
6
+ gem "sentry-ruby", path: "../sentry-ruby"
7
+ gem "sentry-rails", path: "../sentry-rails"
6
8
 
7
9
  gem "rake", "~> 12.0"
8
10
  gem "rspec", "~> 3.0"
9
11
  gem 'simplecov'
10
12
  gem "simplecov-cobertura", "~> 1.4"
11
13
  gem "rexml"
14
+ # https://github.com/flavorjones/loofah/pull/267
15
+ # loofah changed the required ruby version in a patch so we need to explicitly pin it
16
+ gem "loofah", "2.20.0" if RUBY_VERSION.to_f < 2.5
12
17
 
13
18
  sidekiq_version = ENV["SIDEKIQ_VERSION"]
14
19
  sidekiq_version = "6.0" if sidekiq_version.nil?
15
20
 
16
- gem "rails", "< 7.0"
17
21
  gem "sidekiq", "~> #{sidekiq_version}"
22
+ gem "rails"
18
23
 
19
- gem "sentry-ruby", path: "../sentry-ruby"
20
- gem "sentry-rails", path: "../sentry-rails"
24
+ if RUBY_VERSION.to_f >= 2.6
25
+ gem "debug", github: "ruby/debug", platform: :ruby
26
+ gem "irb"
27
+ end
21
28
 
22
- gem "object_tracer"
23
- gem "debug", github: "ruby/debug", platform: :ruby if RUBY_VERSION.to_f >= 2.6
24
29
  gem "pry"
25
30
 
@@ -26,6 +26,9 @@ module Sentry
26
26
  end
27
27
  end
28
28
 
29
+ # Sidekiq 7.0 started adding `_config` to the context, which is not easily serialisable
30
+ # And it's presence could be confusing so it's better to remove it until we decided to add it for a reason
31
+ filtered_context.delete(:_config)
29
32
  filtered_context
30
33
  end
31
34
 
@@ -3,13 +3,15 @@ require 'sentry/sidekiq/context_filter'
3
3
  module Sentry
4
4
  module Sidekiq
5
5
  class ErrorHandler
6
+ WITH_SIDEKIQ_7 = ::Gem::Version.new(::Sidekiq::VERSION) >= ::Gem::Version.new("7.0")
7
+
6
8
  def call(ex, context)
7
9
  return unless Sentry.initialized?
8
10
 
9
11
  context_filter = Sentry::Sidekiq::ContextFilter.new(context)
10
12
 
11
13
  scope = Sentry.get_current_scope
12
- scope.set_transaction_name(context_filter.transaction_name) unless scope.transaction_name
14
+ scope.set_transaction_name(context_filter.transaction_name, source: :task) unless scope.transaction_name
13
15
 
14
16
  if Sentry.configuration.sidekiq.report_after_job_retries && retryable?(context)
15
17
  retry_count = context.dig(:job, "retry_count")
@@ -23,6 +25,8 @@ module Sentry
23
25
  contexts: { sidekiq: context_filter.filtered },
24
26
  hint: { background: false }
25
27
  )
28
+ ensure
29
+ scope&.clear
26
30
  end
27
31
 
28
32
  private
@@ -40,7 +44,13 @@ module Sentry
40
44
  when Integer
41
45
  limit
42
46
  when TrueClass
43
- ::Sidekiq.options[:max_retries] || 25
47
+ max_retries =
48
+ if WITH_SIDEKIQ_7
49
+ ::Sidekiq.default_configuration[:max_retries]
50
+ else
51
+ ::Sidekiq.options[:max_retries]
52
+ end
53
+ max_retries || 25
44
54
  else
45
55
  0
46
56
  end
@@ -3,6 +3,8 @@ require 'sentry/sidekiq/context_filter'
3
3
  module Sentry
4
4
  module Sidekiq
5
5
  class SentryContextServerMiddleware
6
+ OP_NAME = "queue.sidekiq".freeze
7
+
6
8
  def call(_worker, job, queue)
7
9
  return yield unless Sentry.initialized?
8
10
 
@@ -16,8 +18,8 @@ module Sentry
16
18
  scope.set_tags(queue: queue, jid: job["jid"])
17
19
  scope.set_tags(build_tags(job["tags"]))
18
20
  scope.set_contexts(sidekiq: job.merge("queue" => queue))
19
- scope.set_transaction_name(context_filter.transaction_name)
20
- transaction = start_transaction(scope.transaction_name, job["sentry_trace"])
21
+ scope.set_transaction_name(context_filter.transaction_name, source: :task)
22
+ transaction = start_transaction(scope, job["sentry_trace"])
21
23
  scope.set_span(transaction) if transaction
22
24
 
23
25
  begin
@@ -37,8 +39,8 @@ module Sentry
37
39
  Array(tags).each_with_object({}) { |name, tags_hash| tags_hash[:"sidekiq.#{name}"] = true }
38
40
  end
39
41
 
40
- def start_transaction(transaction_name, sentry_trace)
41
- options = { name: transaction_name, op: "sidekiq" }
42
+ def start_transaction(scope, sentry_trace)
43
+ options = { name: scope.transaction_name, source: scope.transaction_source, op: OP_NAME }
42
44
  transaction = Sentry::Transaction.from_sentry_trace(sentry_trace, **options) if sentry_trace
43
45
  Sentry.start_transaction(transaction: transaction, **options)
44
46
  end
@@ -1,5 +1,5 @@
1
1
  module Sentry
2
2
  module Sidekiq
3
- VERSION = "5.4.2"
3
+ VERSION = "5.10.0"
4
4
  end
5
5
  end
@@ -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", "~> 5.4.2"
25
+ spec.add_dependency "sentry-ruby", "~> 5.10.0"
26
26
  spec.add_dependency "sidekiq", ">= 3.0"
27
27
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sentry-sidekiq
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.4.2
4
+ version: 5.10.0
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-08-17 00:00:00.000000000 Z
11
+ date: 2023-07-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sentry-ruby
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 5.4.2
19
+ version: 5.10.0
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.4.2
26
+ version: 5.10.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: sidekiq
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -49,7 +49,6 @@ files:
49
49
  - ".gitignore"
50
50
  - ".rspec"
51
51
  - CHANGELOG.md
52
- - CODE_OF_CONDUCT.md
53
52
  - Gemfile
54
53
  - LICENSE.txt
55
54
  - Makefile
data/CODE_OF_CONDUCT.md DELETED
@@ -1,74 +0,0 @@
1
- # Contributor Covenant Code of Conduct
2
-
3
- ## Our Pledge
4
-
5
- In the interest of fostering an open and welcoming environment, we as
6
- contributors and maintainers pledge to making participation in our project and
7
- our community a harassment-free experience for everyone, regardless of age, body
8
- size, disability, ethnicity, gender identity and expression, level of experience,
9
- nationality, personal appearance, race, religion, or sexual identity and
10
- orientation.
11
-
12
- ## Our Standards
13
-
14
- Examples of behavior that contributes to creating a positive environment
15
- include:
16
-
17
- * Using welcoming and inclusive language
18
- * Being respectful of differing viewpoints and experiences
19
- * Gracefully accepting constructive criticism
20
- * Focusing on what is best for the community
21
- * Showing empathy towards other community members
22
-
23
- Examples of unacceptable behavior by participants include:
24
-
25
- * The use of sexualized language or imagery and unwelcome sexual attention or
26
- advances
27
- * Trolling, insulting/derogatory comments, and personal or political attacks
28
- * Public or private harassment
29
- * Publishing others' private information, such as a physical or electronic
30
- address, without explicit permission
31
- * Other conduct which could reasonably be considered inappropriate in a
32
- professional setting
33
-
34
- ## Our Responsibilities
35
-
36
- Project maintainers are responsible for clarifying the standards of acceptable
37
- behavior and are expected to take appropriate and fair corrective action in
38
- response to any instances of unacceptable behavior.
39
-
40
- Project maintainers have the right and responsibility to remove, edit, or
41
- reject comments, commits, code, wiki edits, issues, and other contributions
42
- that are not aligned to this Code of Conduct, or to ban temporarily or
43
- permanently any contributor for other behaviors that they deem inappropriate,
44
- threatening, offensive, or harmful.
45
-
46
- ## Scope
47
-
48
- This Code of Conduct applies both within project spaces and in public spaces
49
- when an individual is representing the project or its community. Examples of
50
- representing a project or community include using an official project e-mail
51
- address, posting via an official social media account, or acting as an appointed
52
- representative at an online or offline event. Representation of a project may be
53
- further defined and clarified by project maintainers.
54
-
55
- ## Enforcement
56
-
57
- Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
- reported by contacting the project team at stan001212@gmail.com. All
59
- complaints will be reviewed and investigated and will result in a response that
60
- is deemed necessary and appropriate to the circumstances. The project team is
61
- obligated to maintain confidentiality with regard to the reporter of an incident.
62
- Further details of specific enforcement policies may be posted separately.
63
-
64
- Project maintainers who do not follow or enforce the Code of Conduct in good
65
- faith may face temporary or permanent repercussions as determined by other
66
- members of the project's leadership.
67
-
68
- ## Attribution
69
-
70
- This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
- available at [https://contributor-covenant.org/version/1/4][version]
72
-
73
- [homepage]: https://contributor-covenant.org
74
- [version]: https://contributor-covenant.org/version/1/4/