sentry-rails 4.6.3 → 4.7.1

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: c2d42e3ed09f91a5ba598f1879324a2015250f33090174cc4ed8aeb82e1dae06
4
- data.tar.gz: 1acb7af3fc83233fa1b99a61aa0362e7ca589f3a62a6f3830b308851225c4b0b
3
+ metadata.gz: f154b9bdfa492c8a89c668702466943798d40e202bfad8831ac04b49b21f2150
4
+ data.tar.gz: deadc1a6acce982434b1c5db9abe814f7f22eed7a6d18ea7c34bba26ffdc758b
5
5
  SHA512:
6
- metadata.gz: cd7e6f5994e156753de716d100fb86d5e6ecec851670aa2d295760e4f0becf725c5242ed2bc6a848b04887e811a0d890f580ff2d1c815dfad34534d0edd4ceac
7
- data.tar.gz: 2a1d041d4fe42c8c7fa472da77bfad78a5659e516290d2b28d949af6de6936035a7a998fcef75ea0f7b6d2649be9bbe7fe59ef15754fd43cfc6fd18fb081b923
6
+ metadata.gz: 531f555bb811a8f4585106a197036ea92d273e06d4584937cf9ea30b9272535e9ac704288bde36bdcb2f522562a83abcb50c8b7bbac83fef6504540e31cbb460
7
+ data.tar.gz: 658686bdef75a7807c767b5d999065ab109254db5075028d8aa6a11020b68761ebf63e05a3775af2dc58316587ec140d92171536f24351b19745e55500991cd2
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 getsentry
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
@@ -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.3"
3
+ VERSION = "4.7.1"
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.3
4
+ version: 4.7.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: 2021-07-26 00:00:00.000000000 Z
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.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