sentry-rails 4.6.4 → 4.7.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: e479516d519975728175dbed14dc5fe29032abd53c90cbadc9f4e1e12c3b0901
4
- data.tar.gz: ac6d95f904049f87ba1ce0023301cb5d7294c5efbdd2bfe7710c53eb91b2d1f0
3
+ metadata.gz: 601a533a33e665e2a7b470eead7e2598827189e985903fb78c0391d9a446ddeb
4
+ data.tar.gz: e33f1dae2e5d5305432f8fcec69bd26daef8217adf582e6d6747ab1bdb79b112
5
5
  SHA512:
6
- metadata.gz: 16ade3270e7c3b1e4df50bb1a696e0ef2e238673ddc44c05a5a2b3136ce8503bb325d8b73209ce1102c6acca1761e19583790370c6dbd6032b5764695b58734d
7
- data.tar.gz: 94d3f619a04c98c60c4a02a4200e201a11454c1726cbd9c870829e9870f1615c1149137b6ab10259b7374ddbd8309532f7dbfe7a98942345c835c179df853eb3
6
+ metadata.gz: e459f55b49f1b468ee151f5094e3e2bcc28ba6289f86ec83e69c00b2205c37982f34f4922c3c97af72a02902379c61b3a7bb2cb30cf6f6d8972fc2dbba70eeb2
7
+ data.tar.gz: 794f8644fe6499cdeeb7bba75e9bf899629afe77ebbd0daca6dd587b8270b53c386f5bbcdae393d747341d3c758983520546e519aecfe23f6c31d94371e76375
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
@@ -22,11 +22,6 @@ if defined?(ActiveJob)
22
22
  end
23
23
 
24
24
  def perform(event, hint = {})
25
- # users don't need the tracing result of this job
26
- if transaction = Sentry.get_current_scope.span
27
- transaction.instance_variable_set(:@sampled, false)
28
- end
29
-
30
25
  Sentry.send_event(event, hint)
31
26
  end
32
27
  end
@@ -21,7 +21,12 @@ module Sentry
21
21
 
22
22
  def capture_and_reraise_with_sentry(job, scope, block)
23
23
  scope.set_transaction_name(job.class.name)
24
- transaction = Sentry.start_transaction(name: scope.transaction_name, op: "active_job")
24
+ transaction =
25
+ if job.is_a?(::Sentry::SendEventJob)
26
+ nil
27
+ else
28
+ Sentry.start_transaction(name: scope.transaction_name, op: "active_job")
29
+ end
25
30
 
26
31
  scope.set_span(transaction) if transaction
27
32
 
@@ -0,0 +1,44 @@
1
+ require "sentry/rails/instrument_payload_cleanup_helper"
2
+
3
+ module Sentry
4
+ module Rails
5
+ module Breadcrumb
6
+ module MonotonicActiveSupportLogger
7
+ class << self
8
+ include InstrumentPayloadCleanupHelper
9
+
10
+ def add(name, started, _finished, _unique_id, data)
11
+ # skip Rails' internal events
12
+ return if name.start_with?("!")
13
+
14
+ if data.is_a?(Hash)
15
+ # we should only mutate the copy of the data
16
+ data = data.dup
17
+ cleanup_data(data)
18
+ end
19
+
20
+ crumb = Sentry::Breadcrumb.new(
21
+ data: data,
22
+ category: name,
23
+ timestamp: started.to_i
24
+ )
25
+ Sentry.add_breadcrumb(crumb)
26
+ end
27
+
28
+ def inject
29
+ @subscriber = ::ActiveSupport::Notifications.monotonic_subscribe(/.*/) do |name, started, finished, unique_id, data|
30
+ # we only record events that has a float as started timestamp
31
+ if started.is_a?(Float)
32
+ add(name, started, finished, unique_id, data)
33
+ end
34
+ end
35
+ end
36
+
37
+ def detach
38
+ ::ActiveSupport::Notifications.unsubscribe(@subscriber)
39
+ end
40
+ end
41
+ end
42
+ end
43
+ end
44
+ end
@@ -8,8 +8,8 @@ module Sentry
8
8
  initializer "sentry.use_rack_middleware" do |app|
9
9
  # placed after all the file-sending middlewares so we can avoid unnecessary transactions
10
10
  app.config.middleware.insert_after ActionDispatch::Executor, Sentry::Rails::CaptureExceptions
11
- # need to be placed at last to smuggle app exceptions via env
12
- app.config.middleware.use(Sentry::Rails::RescuedExceptionInterceptor)
11
+ # need to place as close to DebugExceptions as possible to intercept most of the exceptions, including those raised by middlewares
12
+ app.config.middleware.insert_after ActionDispatch::DebugExceptions, Sentry::Rails::RescuedExceptionInterceptor
13
13
  end
14
14
 
15
15
  # because the extension works by registering the around_perform callcack, it should always be ran
@@ -69,6 +69,13 @@ module Sentry
69
69
  require 'sentry/rails/breadcrumb/active_support_logger'
70
70
  Sentry::Rails::Breadcrumb::ActiveSupportLogger.inject
71
71
  end
72
+
73
+ if Sentry.configuration.breadcrumbs_logger.include?(:monotonic_active_support_logger)
74
+ return warn "Usage of `monotonic_active_support_logger` require a version of Rails >= 6.1, please upgrade your Rails version or use another logger" if ::Rails.version.to_f < 6.1
75
+
76
+ require 'sentry/rails/breadcrumb/monotonic_active_support_logger'
77
+ Sentry::Rails::Breadcrumb::MonotonicActiveSupportLogger.inject
78
+ end
72
79
  end
73
80
 
74
81
  def setup_backtrace_cleanup_callback
@@ -1,5 +1,5 @@
1
1
  module Sentry
2
2
  module Rails
3
- VERSION = "4.6.4"
3
+ VERSION = "4.7.2"
4
4
  end
5
5
  end
data/sentry-rails.gemspec CHANGED
@@ -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 Rails 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
@@ -23,5 +23,5 @@ Gem::Specification.new do |spec|
23
23
  spec.require_paths = ["lib"]
24
24
 
25
25
  spec.add_dependency "railties", ">= 5.0"
26
- spec.add_dependency "sentry-ruby-core", "~> 4.6.0"
26
+ spec.add_dependency "sentry-ruby-core", "~> 4.7.0"
27
27
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sentry-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.6.4
4
+ version: 4.7.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-07-29 00:00:00.000000000 Z
11
+ date: 2021-09-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 4.6.0
33
+ version: 4.7.0
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: 4.6.0
40
+ version: 4.7.0
41
41
  description: A gem that provides Rails integration for the Sentry error logger
42
42
  email: accounts@sentry.io
43
43
  executables: []
@@ -64,6 +64,7 @@ files:
64
64
  - lib/sentry/rails/background_worker.rb
65
65
  - lib/sentry/rails/backtrace_cleaner.rb
66
66
  - lib/sentry/rails/breadcrumb/active_support_logger.rb
67
+ - lib/sentry/rails/breadcrumb/monotonic_active_support_logger.rb
67
68
  - lib/sentry/rails/capture_exceptions.rb
68
69
  - lib/sentry/rails/configuration.rb
69
70
  - lib/sentry/rails/controller_methods.rb
@@ -82,7 +83,7 @@ files:
82
83
  - sentry-rails.gemspec
83
84
  homepage: https://github.com/getsentry/sentry-ruby
84
85
  licenses:
85
- - Apache-2.0
86
+ - MIT
86
87
  metadata:
87
88
  homepage_uri: https://github.com/getsentry/sentry-ruby
88
89
  source_code_uri: https://github.com/getsentry/sentry-ruby