sentry-rails 4.6.2 → 4.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE.txt +1 -1
- data/app/jobs/sentry/send_event_job.rb +0 -5
- data/lib/sentry/rails/active_job.rb +6 -1
- data/lib/sentry/rails/breadcrumb/monotonic_active_support_logger.rb +44 -0
- data/lib/sentry/rails/railtie.rb +7 -0
- data/lib/sentry/rails/version.rb +1 -1
- data/sentry-rails.gemspec +2 -2
- metadata +6 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 59ce1bbed25f0648324eba9ee10c07d24528f48be7c5f32f3e72df38733c7e43
|
4
|
+
data.tar.gz: bbe650f5a64b27a7d1fa0dda16a19297d3b93a2b1960eea1c0584a6d7a5f46ef
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f3a925fad733fd8432b60b010f71bde64895c33d2ba485a045a25ff1b16d425244045db5d248ac9648fae7f1c98fcffdbc6ba1e151978f2b2c20b94a65dfd2cf
|
7
|
+
data.tar.gz: 16582deb8443ebb74767f69018bab391aa1c933d4dc37959735a188a2406f01b1972269770f7783b8ad2381937ea46517ef0a0124bd7adc63418b9270fe9f762
|
data/LICENSE.txt
CHANGED
@@ -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 =
|
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
|
data/lib/sentry/rails/railtie.rb
CHANGED
@@ -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
|
data/lib/sentry/rails/version.rb
CHANGED
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 = '
|
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.
|
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.
|
4
|
+
version: 4.7.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: 2021-
|
11
|
+
date: 2021-09-01 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.
|
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.
|
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
|
-
-
|
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
|