sentry-rails 4.6.5 → 4.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d5717087ed6c8fd8d83680fc7950992b553bb3bdfdc9bf60622b334d3c757b7c
4
- data.tar.gz: 687f5baaa514011efcadc412e246fcb12b13a9f467c5f518dc45498b6e1e2d7d
3
+ metadata.gz: 59ce1bbed25f0648324eba9ee10c07d24528f48be7c5f32f3e72df38733c7e43
4
+ data.tar.gz: bbe650f5a64b27a7d1fa0dda16a19297d3b93a2b1960eea1c0584a6d7a5f46ef
5
5
  SHA512:
6
- metadata.gz: c7b506fd42ec78b1e0a9dee799de829afc2fae6280753fe5e69d193905b6b12d43bdbfe7a5f2a69c185225e1a082093aaf5b80cd765674b6184e8cca164507c1
7
- data.tar.gz: 6d77e33885b0779a6e9c0bfd5ca0a2973adb5e64146ff1fa8b1a3a4b123febeff98d000583bb8f49567dbf9ddd816a5cea31d157f9613ac20040b2dd73215b3d
6
+ metadata.gz: f3a925fad733fd8432b60b010f71bde64895c33d2ba485a045a25ff1b16d425244045db5d248ac9648fae7f1c98fcffdbc6ba1e151978f2b2c20b94a65dfd2cf
7
+ data.tar.gz: 16582deb8443ebb74767f69018bab391aa1c933d4dc37959735a188a2406f01b1972269770f7783b8ad2381937ea46517ef0a0124bd7adc63418b9270fe9f762
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.5"
3
+ VERSION = "4.7.0"
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.5
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-08-12 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