sentry-rails 5.1.0 → 6.2.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.
Files changed (46) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -1
  3. data/.rspec +1 -1
  4. data/Gemfile +44 -26
  5. data/README.md +1 -1
  6. data/Rakefile +13 -10
  7. data/app/jobs/sentry/send_event_job.rb +2 -1
  8. data/bin/console +1 -0
  9. data/bin/test +389 -0
  10. data/lib/generators/sentry_generator.rb +31 -0
  11. data/lib/sentry/rails/action_cable.rb +18 -7
  12. data/lib/sentry/rails/active_job.rb +118 -55
  13. data/lib/sentry/rails/background_worker.rb +13 -4
  14. data/lib/sentry/rails/backtrace_cleaner.rb +7 -7
  15. data/lib/sentry/rails/breadcrumb/active_support_logger.rb +5 -7
  16. data/lib/sentry/rails/capture_exceptions.rb +34 -15
  17. data/lib/sentry/rails/configuration.rb +171 -21
  18. data/lib/sentry/rails/controller_methods.rb +2 -0
  19. data/lib/sentry/rails/controller_transaction.rb +34 -2
  20. data/lib/sentry/rails/engine.rb +2 -0
  21. data/lib/sentry/rails/error_subscriber.rb +26 -12
  22. data/lib/sentry/rails/log_subscriber.rb +76 -0
  23. data/lib/sentry/rails/log_subscribers/action_controller_subscriber.rb +118 -0
  24. data/lib/sentry/rails/log_subscribers/action_mailer_subscriber.rb +92 -0
  25. data/lib/sentry/rails/log_subscribers/active_job_subscriber.rb +163 -0
  26. data/lib/sentry/rails/log_subscribers/active_record_subscriber.rb +164 -0
  27. data/lib/sentry/rails/log_subscribers/parameter_filter.rb +52 -0
  28. data/lib/sentry/rails/overrides/streaming_reporter.rb +2 -11
  29. data/lib/sentry/rails/railtie.rb +35 -13
  30. data/lib/sentry/rails/rescued_exception_interceptor.rb +12 -1
  31. data/lib/sentry/rails/structured_logging.rb +32 -0
  32. data/lib/sentry/rails/tracing/abstract_subscriber.rb +8 -10
  33. data/lib/sentry/rails/tracing/action_view_subscriber.rb +11 -2
  34. data/lib/sentry/rails/tracing/active_record_subscriber.rb +70 -6
  35. data/lib/sentry/rails/tracing/active_storage_subscriber.rb +17 -4
  36. data/lib/sentry/rails/tracing/active_support_subscriber.rb +63 -0
  37. data/lib/sentry/rails/tracing.rb +3 -1
  38. data/lib/sentry/rails/version.rb +3 -1
  39. data/lib/sentry/rails.rb +3 -0
  40. data/lib/sentry-rails.rb +2 -0
  41. data/sentry-rails.gemspec +16 -8
  42. metadata +26 -21
  43. data/CODE_OF_CONDUCT.md +0 -74
  44. data/lib/sentry/rails/breadcrumb/monotonic_active_support_logger.rb +0 -44
  45. data/lib/sentry/rails/instrument_payload_cleanup_helper.rb +0 -13
  46. data/lib/sentry/rails/tracing/action_controller_subscriber.rb +0 -33
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sentry-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.1.0
4
+ version: 6.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sentry Team
8
- autorequire:
9
8
  bindir: exe
10
9
  cert_chain: []
11
- date: 2022-02-10 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: railties
@@ -16,40 +15,39 @@ dependencies:
16
15
  requirements:
17
16
  - - ">="
18
17
  - !ruby/object:Gem::Version
19
- version: '5.0'
18
+ version: 5.2.0
20
19
  type: :runtime
21
20
  prerelease: false
22
21
  version_requirements: !ruby/object:Gem::Requirement
23
22
  requirements:
24
23
  - - ">="
25
24
  - !ruby/object:Gem::Version
26
- version: '5.0'
25
+ version: 5.2.0
27
26
  - !ruby/object:Gem::Dependency
28
- name: sentry-ruby-core
27
+ name: sentry-ruby
29
28
  requirement: !ruby/object:Gem::Requirement
30
29
  requirements:
31
30
  - - "~>"
32
31
  - !ruby/object:Gem::Version
33
- version: 5.1.0
32
+ version: 6.2.0
34
33
  type: :runtime
35
34
  prerelease: false
36
35
  version_requirements: !ruby/object:Gem::Requirement
37
36
  requirements:
38
37
  - - "~>"
39
38
  - !ruby/object:Gem::Version
40
- version: 5.1.0
39
+ version: 6.2.0
41
40
  description: A gem that provides Rails integration for the Sentry error logger
42
41
  email: accounts@sentry.io
43
42
  executables: []
44
43
  extensions: []
45
44
  extra_rdoc_files:
46
- - README.md
47
45
  - LICENSE.txt
46
+ - README.md
48
47
  files:
49
48
  - ".gitignore"
50
49
  - ".rspec"
51
50
  - CHANGELOG.md
52
- - CODE_OF_CONDUCT.md
53
51
  - Gemfile
54
52
  - LICENSE.txt
55
53
  - Makefile
@@ -58,6 +56,8 @@ files:
58
56
  - app/jobs/sentry/send_event_job.rb
59
57
  - bin/console
60
58
  - bin/setup
59
+ - bin/test
60
+ - lib/generators/sentry_generator.rb
61
61
  - lib/sentry-rails.rb
62
62
  - lib/sentry/rails.rb
63
63
  - lib/sentry/rails/action_cable.rb
@@ -65,33 +65,39 @@ files:
65
65
  - lib/sentry/rails/background_worker.rb
66
66
  - lib/sentry/rails/backtrace_cleaner.rb
67
67
  - lib/sentry/rails/breadcrumb/active_support_logger.rb
68
- - lib/sentry/rails/breadcrumb/monotonic_active_support_logger.rb
69
68
  - lib/sentry/rails/capture_exceptions.rb
70
69
  - lib/sentry/rails/configuration.rb
71
70
  - lib/sentry/rails/controller_methods.rb
72
71
  - lib/sentry/rails/controller_transaction.rb
73
72
  - lib/sentry/rails/engine.rb
74
73
  - lib/sentry/rails/error_subscriber.rb
75
- - lib/sentry/rails/instrument_payload_cleanup_helper.rb
74
+ - lib/sentry/rails/log_subscriber.rb
75
+ - lib/sentry/rails/log_subscribers/action_controller_subscriber.rb
76
+ - lib/sentry/rails/log_subscribers/action_mailer_subscriber.rb
77
+ - lib/sentry/rails/log_subscribers/active_job_subscriber.rb
78
+ - lib/sentry/rails/log_subscribers/active_record_subscriber.rb
79
+ - lib/sentry/rails/log_subscribers/parameter_filter.rb
76
80
  - lib/sentry/rails/overrides/streaming_reporter.rb
77
81
  - lib/sentry/rails/railtie.rb
78
82
  - lib/sentry/rails/rescued_exception_interceptor.rb
83
+ - lib/sentry/rails/structured_logging.rb
79
84
  - lib/sentry/rails/tracing.rb
80
85
  - lib/sentry/rails/tracing/abstract_subscriber.rb
81
- - lib/sentry/rails/tracing/action_controller_subscriber.rb
82
86
  - lib/sentry/rails/tracing/action_view_subscriber.rb
83
87
  - lib/sentry/rails/tracing/active_record_subscriber.rb
84
88
  - lib/sentry/rails/tracing/active_storage_subscriber.rb
89
+ - lib/sentry/rails/tracing/active_support_subscriber.rb
85
90
  - lib/sentry/rails/version.rb
86
91
  - sentry-rails.gemspec
87
- homepage: https://github.com/getsentry/sentry-ruby
92
+ homepage: https://github.com/getsentry/sentry-ruby/tree/6.2.0/sentry-rails
88
93
  licenses:
89
94
  - MIT
90
95
  metadata:
91
- homepage_uri: https://github.com/getsentry/sentry-ruby
92
- source_code_uri: https://github.com/getsentry/sentry-ruby
93
- changelog_uri: https://github.com/getsentry/sentry-ruby/blob/master/CHANGELOG.md
94
- post_install_message:
96
+ homepage_uri: https://github.com/getsentry/sentry-ruby/tree/6.2.0/sentry-rails
97
+ source_code_uri: https://github.com/getsentry/sentry-ruby/tree/6.2.0/sentry-rails
98
+ changelog_uri: https://github.com/getsentry/sentry-ruby/blob/6.2.0/CHANGELOG.md
99
+ bug_tracker_uri: https://github.com/getsentry/sentry-ruby/issues
100
+ documentation_uri: http://www.rubydoc.info/gems/sentry-rails/6.2.0
95
101
  rdoc_options: []
96
102
  require_paths:
97
103
  - lib
@@ -99,15 +105,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
99
105
  requirements:
100
106
  - - ">="
101
107
  - !ruby/object:Gem::Version
102
- version: '2.4'
108
+ version: '2.7'
103
109
  required_rubygems_version: !ruby/object:Gem::Requirement
104
110
  requirements:
105
111
  - - ">="
106
112
  - !ruby/object:Gem::Version
107
113
  version: '0'
108
114
  requirements: []
109
- rubygems_version: 3.1.6
110
- signing_key:
115
+ rubygems_version: 3.6.9
111
116
  specification_version: 4
112
117
  summary: A gem that provides Rails integration for the Sentry error logger
113
118
  test_files: []
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/
@@ -1,44 +0,0 @@
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
@@ -1,13 +0,0 @@
1
- module Sentry
2
- module Rails
3
- module InstrumentPayloadCleanupHelper
4
- IGNORED_DATA_TYPES = [:request, :response, :headers, :exception, :exception_object, Tracing::START_TIMESTAMP_NAME]
5
-
6
- def cleanup_data(data)
7
- IGNORED_DATA_TYPES.each do |key|
8
- data.delete(key) if data.key?(key)
9
- end
10
- end
11
- end
12
- end
13
- end
@@ -1,33 +0,0 @@
1
- require "sentry/rails/tracing/abstract_subscriber"
2
- require "sentry/rails/instrument_payload_cleanup_helper"
3
-
4
- module Sentry
5
- module Rails
6
- module Tracing
7
- class ActionControllerSubscriber < AbstractSubscriber
8
- extend InstrumentPayloadCleanupHelper
9
-
10
- EVENT_NAMES = ["process_action.action_controller"].freeze
11
-
12
- def self.subscribe!
13
- subscribe_to_event(EVENT_NAMES) do |event_name, duration, payload|
14
- controller = payload[:controller]
15
- action = payload[:action]
16
-
17
- record_on_current_span(
18
- op: event_name,
19
- start_timestamp: payload[START_TIMESTAMP_NAME],
20
- description: "#{controller}##{action}",
21
- duration: duration
22
- ) do |span|
23
- payload = payload.dup
24
- cleanup_data(payload)
25
- span.set_data(:payload, payload)
26
- span.set_http_status(payload[:status])
27
- end
28
- end
29
- end
30
- end
31
- end
32
- end
33
- end