sentry-inst_jobs 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: e0250d6d03093d1710d127eb2b62f39c1dc97cabce887b342d75339634d18372
4
+ data.tar.gz: ae48a68b18e7a34229a73f3103d69884143cd6c9f2a147c7624471e79012f8ac
5
+ SHA512:
6
+ metadata.gz: ee3495292b58b75103ba9e4f728a6b01ab5ac214785737d4d9193f333a8fbbb0878ea0e69af57161dcdc9dfcb4137d3b21bdf92b559fe15eb4950caf0ea8bb4f
7
+ data.tar.gz: 4e4fad25cea53f698238e87abb1b1941bdd68a7d5c7fe8469a73952073319de144fa07fd91814f082f39f046f697fcbe6d0172d775263ef0fa1884ac4406500d
data/.dockerignore ADDED
@@ -0,0 +1,11 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Dockerfile.ci
4
+ /Gemfile.lock
5
+ /coverage/
6
+ /docker-compose.yml
7
+ /docker-compose.override.yml
8
+ /pkg/
9
+ /tmp/
10
+ /spec/gemfiles/.bundle
11
+ /spec/gemfiles/*.lock
data/.gitignore ADDED
@@ -0,0 +1,11 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+
10
+ # rspec failure tracking
11
+ .rspec_status
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --color
2
+ --format progress
3
+ --require spec_helper
@@ -0,0 +1,13 @@
1
+ # Contributor Code of Conduct
2
+
3
+ As contributors and maintainers of this project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.
4
+
5
+ We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, age, or religion, or other protected status as identified in the Company’s policy against Harassment.
6
+
7
+ Examples of unacceptable behavior by participants include the use of sexual language or imagery, derogatory comments or personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct.
8
+
9
+ Project maintainers may remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that they believe are not aligned to this Code of Conduct. Project maintainers who do not follow the Code of Conduct may be reported under the Company’s policy against Harassment, and will be subject to corrective action as determined by the Company.
10
+
11
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers, and reporting the behavior using the process in the Company’s policy against Harassment.
12
+
13
+ This Code of Conduct is adapted from the [Contributor Covenant](http:contributor-covenant.org), version 1.0.0, available at [http://contributor-covenant.org/version/1/0/0/](http://contributor-covenant.org/version/1/0/0/)
data/Dockerfile.ci ADDED
@@ -0,0 +1,19 @@
1
+ FROM instructure/rvm
2
+
3
+ USER root
4
+ RUN apt-get update && apt-get install -y git postgresql-client
5
+ USER docker
6
+
7
+ RUN bash -lc "rvm use --default 2.6"
8
+ RUN bash -lc "rvm 2.6,2.7,3.0 do gem install bundler -v 2.2.27"
9
+
10
+ COPY --chown=docker:docker sentry-inst_jobs.gemspec Gemfile ./
11
+ COPY --chown=docker:docker lib/sentry/inst_jobs/version.rb lib/sentry/inst_jobs/version.rb
12
+
13
+ RUN bash -lc "rvm 2.6,2.7,3.0 do bundle install --jobs 6"
14
+
15
+ COPY --chown=docker:docker . /usr/src/app
16
+
17
+ ENV TEST_DB_USERNAME postgres
18
+
19
+ CMD bash -lc "until pg_isready --host=$TEST_DB_HOST; do sleep 1; done && bundle exec rake"
data/Gemfile ADDED
@@ -0,0 +1,17 @@
1
+ source "https://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in sentry-ruby.gemspec
4
+ gemspec
5
+
6
+ gem "rake", "~> 12.0"
7
+ gem "rspec", "~> 3.0"
8
+
9
+ gem "inst-jobs"
10
+ gem "rails"
11
+ gem "pg"
12
+
13
+ gem "sentry-ruby"
14
+ gem "sentry-rails"
15
+
16
+ gem "pry"
17
+ gem "debug", github: "ruby/debug", platform: :ruby if RUBY_VERSION.to_f >= 2.6
data/Gemfile.lock ADDED
@@ -0,0 +1,236 @@
1
+ GIT
2
+ remote: https://github.com/ruby/debug.git
3
+ revision: 788f6b87186985843637dcd9a3ddac0af9bdb160
4
+ specs:
5
+ debug (1.3.4)
6
+ irb (>= 1.3.6)
7
+ reline (>= 0.2.7)
8
+
9
+ PATH
10
+ remote: .
11
+ specs:
12
+ sentry-inst_jobs (1.0.0)
13
+ inst-jobs (~> 3.0)
14
+ sentry-ruby-core (~> 4.8.0)
15
+
16
+ GEM
17
+ remote: https://rubygems.org/
18
+ specs:
19
+ actioncable (6.1.4.1)
20
+ actionpack (= 6.1.4.1)
21
+ activesupport (= 6.1.4.1)
22
+ nio4r (~> 2.0)
23
+ websocket-driver (>= 0.6.1)
24
+ actionmailbox (6.1.4.1)
25
+ actionpack (= 6.1.4.1)
26
+ activejob (= 6.1.4.1)
27
+ activerecord (= 6.1.4.1)
28
+ activestorage (= 6.1.4.1)
29
+ activesupport (= 6.1.4.1)
30
+ mail (>= 2.7.1)
31
+ actionmailer (6.1.4.1)
32
+ actionpack (= 6.1.4.1)
33
+ actionview (= 6.1.4.1)
34
+ activejob (= 6.1.4.1)
35
+ activesupport (= 6.1.4.1)
36
+ mail (~> 2.5, >= 2.5.4)
37
+ rails-dom-testing (~> 2.0)
38
+ actionpack (6.1.4.1)
39
+ actionview (= 6.1.4.1)
40
+ activesupport (= 6.1.4.1)
41
+ rack (~> 2.0, >= 2.0.9)
42
+ rack-test (>= 0.6.3)
43
+ rails-dom-testing (~> 2.0)
44
+ rails-html-sanitizer (~> 1.0, >= 1.2.0)
45
+ actiontext (6.1.4.1)
46
+ actionpack (= 6.1.4.1)
47
+ activerecord (= 6.1.4.1)
48
+ activestorage (= 6.1.4.1)
49
+ activesupport (= 6.1.4.1)
50
+ nokogiri (>= 1.8.5)
51
+ actionview (6.1.4.1)
52
+ activesupport (= 6.1.4.1)
53
+ builder (~> 3.1)
54
+ erubi (~> 1.4)
55
+ rails-dom-testing (~> 2.0)
56
+ rails-html-sanitizer (~> 1.1, >= 1.2.0)
57
+ activejob (6.1.4.1)
58
+ activesupport (= 6.1.4.1)
59
+ globalid (>= 0.3.6)
60
+ activemodel (6.1.4.1)
61
+ activesupport (= 6.1.4.1)
62
+ activerecord (6.1.4.1)
63
+ activemodel (= 6.1.4.1)
64
+ activesupport (= 6.1.4.1)
65
+ activerecord-pg-extensions (0.4.2)
66
+ activerecord (>= 6.0, < 6.2)
67
+ railties (>= 6.0, < 6.2)
68
+ activestorage (6.1.4.1)
69
+ actionpack (= 6.1.4.1)
70
+ activejob (= 6.1.4.1)
71
+ activerecord (= 6.1.4.1)
72
+ activesupport (= 6.1.4.1)
73
+ marcel (~> 1.0.0)
74
+ mini_mime (>= 1.1.0)
75
+ activesupport (6.1.4.1)
76
+ concurrent-ruby (~> 1.0, >= 1.0.2)
77
+ i18n (>= 1.6, < 2)
78
+ minitest (>= 5.1)
79
+ tzinfo (~> 2.0)
80
+ zeitwerk (~> 2.3)
81
+ after_transaction_commit (2.2.2)
82
+ activerecord (>= 5.2)
83
+ builder (3.2.4)
84
+ coderay (1.1.3)
85
+ concurrent-ruby (1.1.9)
86
+ crass (1.0.6)
87
+ debug_inspector (1.1.0)
88
+ diff-lcs (1.4.4)
89
+ erubi (1.10.0)
90
+ et-orbi (1.2.6)
91
+ tzinfo
92
+ faraday (1.8.0)
93
+ faraday-em_http (~> 1.0)
94
+ faraday-em_synchrony (~> 1.0)
95
+ faraday-excon (~> 1.1)
96
+ faraday-httpclient (~> 1.0.1)
97
+ faraday-net_http (~> 1.0)
98
+ faraday-net_http_persistent (~> 1.1)
99
+ faraday-patron (~> 1.0)
100
+ faraday-rack (~> 1.0)
101
+ multipart-post (>= 1.2, < 3)
102
+ ruby2_keywords (>= 0.0.4)
103
+ faraday-em_http (1.0.0)
104
+ faraday-em_synchrony (1.0.0)
105
+ faraday-excon (1.1.0)
106
+ faraday-httpclient (1.0.1)
107
+ faraday-net_http (1.0.1)
108
+ faraday-net_http_persistent (1.2.0)
109
+ faraday-patron (1.0.0)
110
+ faraday-rack (1.0.0)
111
+ fugit (1.5.2)
112
+ et-orbi (~> 1.1, >= 1.1.8)
113
+ raabro (~> 1.4)
114
+ globalid (1.0.0)
115
+ activesupport (>= 5.0)
116
+ i18n (1.8.11)
117
+ concurrent-ruby (~> 1.0)
118
+ inst-jobs (3.0.3)
119
+ activerecord (>= 6.0)
120
+ activerecord-pg-extensions (~> 0.4)
121
+ activesupport (>= 6.0)
122
+ after_transaction_commit (>= 1.0, < 3)
123
+ debug_inspector (~> 1.0)
124
+ fugit (~> 1.3)
125
+ railties (>= 6.0)
126
+ io-console (0.5.9)
127
+ irb (1.3.7)
128
+ reline (>= 0.2.7)
129
+ loofah (2.12.0)
130
+ crass (~> 1.0.2)
131
+ nokogiri (>= 1.5.9)
132
+ mail (2.7.1)
133
+ mini_mime (>= 0.1.1)
134
+ marcel (1.0.2)
135
+ method_source (1.0.0)
136
+ mini_mime (1.1.2)
137
+ minitest (5.14.4)
138
+ multipart-post (2.1.1)
139
+ nio4r (2.5.8)
140
+ nokogiri (1.12.5-x86_64-darwin)
141
+ racc (~> 1.4)
142
+ pg (1.2.3)
143
+ pry (0.14.1)
144
+ coderay (~> 1.1)
145
+ method_source (~> 1.0)
146
+ raabro (1.4.0)
147
+ racc (1.6.0)
148
+ rack (2.2.3)
149
+ rack-test (1.1.0)
150
+ rack (>= 1.0, < 3)
151
+ rails (6.1.4.1)
152
+ actioncable (= 6.1.4.1)
153
+ actionmailbox (= 6.1.4.1)
154
+ actionmailer (= 6.1.4.1)
155
+ actionpack (= 6.1.4.1)
156
+ actiontext (= 6.1.4.1)
157
+ actionview (= 6.1.4.1)
158
+ activejob (= 6.1.4.1)
159
+ activemodel (= 6.1.4.1)
160
+ activerecord (= 6.1.4.1)
161
+ activestorage (= 6.1.4.1)
162
+ activesupport (= 6.1.4.1)
163
+ bundler (>= 1.15.0)
164
+ railties (= 6.1.4.1)
165
+ sprockets-rails (>= 2.0.0)
166
+ rails-dom-testing (2.0.3)
167
+ activesupport (>= 4.2.0)
168
+ nokogiri (>= 1.6)
169
+ rails-html-sanitizer (1.4.2)
170
+ loofah (~> 2.3)
171
+ railties (6.1.4.1)
172
+ actionpack (= 6.1.4.1)
173
+ activesupport (= 6.1.4.1)
174
+ method_source
175
+ rake (>= 0.13)
176
+ thor (~> 1.0)
177
+ rake (12.3.3)
178
+ reline (0.2.7)
179
+ io-console (~> 0.5)
180
+ rspec (3.10.0)
181
+ rspec-core (~> 3.10.0)
182
+ rspec-expectations (~> 3.10.0)
183
+ rspec-mocks (~> 3.10.0)
184
+ rspec-core (3.10.1)
185
+ rspec-support (~> 3.10.0)
186
+ rspec-expectations (3.10.1)
187
+ diff-lcs (>= 1.2.0, < 2.0)
188
+ rspec-support (~> 3.10.0)
189
+ rspec-mocks (3.10.2)
190
+ diff-lcs (>= 1.2.0, < 2.0)
191
+ rspec-support (~> 3.10.0)
192
+ rspec-support (3.10.3)
193
+ ruby2_keywords (0.0.5)
194
+ sentry-rails (4.8.1)
195
+ railties (>= 5.0)
196
+ sentry-ruby-core (~> 4.8.1)
197
+ sentry-ruby (4.8.1)
198
+ concurrent-ruby (~> 1.0, >= 1.0.2)
199
+ faraday (>= 1.0)
200
+ sentry-ruby-core (= 4.8.1)
201
+ sentry-ruby-core (4.8.1)
202
+ concurrent-ruby
203
+ faraday
204
+ sprockets (4.0.2)
205
+ concurrent-ruby (~> 1.0)
206
+ rack (> 1, < 3)
207
+ sprockets-rails (3.4.1)
208
+ actionpack (>= 5.2)
209
+ activesupport (>= 5.2)
210
+ sprockets (>= 3.0.0)
211
+ thor (1.1.0)
212
+ tzinfo (2.0.4)
213
+ concurrent-ruby (~> 1.0)
214
+ websocket-driver (0.7.5)
215
+ websocket-extensions (>= 0.1.0)
216
+ websocket-extensions (0.1.5)
217
+ zeitwerk (2.5.1)
218
+
219
+ PLATFORMS
220
+ x86_64-darwin-20
221
+ x86_64-darwin-21
222
+
223
+ DEPENDENCIES
224
+ debug!
225
+ inst-jobs
226
+ pg
227
+ pry
228
+ rails
229
+ rake (~> 12.0)
230
+ rspec (~> 3.0)
231
+ sentry-inst_jobs!
232
+ sentry-rails
233
+ sentry-ruby
234
+
235
+ BUNDLED WITH
236
+ 2.2.33
data/Jenkinsfile ADDED
@@ -0,0 +1,33 @@
1
+ #! /usr/bin/env groovy
2
+
3
+ pipeline {
4
+ agent { label 'docker' }
5
+
6
+ environment {
7
+ // Make sure we're ignoring any override files that may be present
8
+ COMPOSE_FILE = "docker-compose.yml"
9
+ }
10
+
11
+ stages {
12
+ stage('Build') {
13
+ steps {
14
+ dockerCacheLoad(image: 'tests')
15
+ sh 'docker-compose build --pull'
16
+ }
17
+ }
18
+ stage('Test') {
19
+ steps {
20
+ sh 'docker-compose run --rm -T tests'
21
+ }
22
+ }
23
+ }
24
+
25
+ post {
26
+ success {
27
+ dockerCacheStore(image: 'tests')
28
+ }
29
+ cleanup {
30
+ sh 'docker-compose down --remove-orphans --rmi all'
31
+ }
32
+ }
33
+ }
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2020 Sentry
4
+ Copyright (c) 2021 Instructure Inc.
5
+
6
+ Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ of this software and associated documentation files (the "Software"), to deal
8
+ in the Software without restriction, including without limitation the rights
9
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ copies of the Software, and to permit persons to whom the Software is
11
+ furnished to do so, subject to the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be included in
14
+ all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22
+ THE SOFTWARE.
data/Makefile ADDED
@@ -0,0 +1,3 @@
1
+ build:
2
+ bundle install
3
+ gem build sentry-inst_jobs.gemspec
data/README.md ADDED
@@ -0,0 +1,22 @@
1
+ # sentry-inst_jobs
2
+
3
+ ---
4
+
5
+ [![Gem Version](https://img.shields.io/gem/v/sentry-inst_jobs.svg)](https://rubygems.org/gems/sentry-inst_jobs)
6
+ [![Gem](https://img.shields.io/gem/dt/sentry-inst_jobs.svg)](https://rubygems.org/gems/sentry-inst_jobs/)
7
+
8
+ An [Instructure Delayed Jobs](https://github.com/instructure/inst-jobs) integration for Sentry's Ruby client.
9
+
10
+ This repository was forked from [sentry-ruby](https://github.com/getsentry/sentry-ruby). Very minor changes were made to
11
+ make `sentry-delayed_job` compatible with `inst-jobs`. This integration is not affiliated with Sentry.
12
+
13
+ ## Getting Started
14
+
15
+ ### Install
16
+
17
+ ```ruby
18
+ gem "sentry-ruby"
19
+ gem "sentry-inst_jobs"
20
+ ```
21
+
22
+ Then you're all set! `sentry-inst_jobs` will automatically insert a custom middleware and error handler to capture exceptions from your workers!
data/Rakefile ADDED
@@ -0,0 +1,8 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec).tap do |task|
5
+ task.rspec_opts = "--order rand"
6
+ end
7
+
8
+ task :default => :spec
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "sentry/ruby"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start(__FILE__)
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,16 @@
1
+ version: "2.1"
2
+
3
+ services:
4
+ tests:
5
+ build:
6
+ context: .
7
+ dockerfile: Dockerfile.ci
8
+ environment:
9
+ TEST_DB_HOST: postgres
10
+ depends_on:
11
+ - postgres
12
+
13
+ postgres:
14
+ image: postgres:9.6
15
+ environment:
16
+ POSTGRES_HOST_AUTH_METHOD: trust
data/example/Gemfile ADDED
@@ -0,0 +1,10 @@
1
+ source "https://rubygems.org"
2
+
3
+ gem "rails"
4
+ gem "sqlite3"
5
+ gem "inst-jobs"
6
+ gem "sentry-inst_jobs", path: "../"
7
+ gem "sentry-ruby"
8
+
9
+ gem "pry"
10
+ gem "debug", github: "ruby/debug"
@@ -0,0 +1,215 @@
1
+ GIT
2
+ remote: https://github.com/ruby/debug.git
3
+ revision: bd6947b7aa14c7c0d5ae97b62fe53af1b5738659
4
+ specs:
5
+ debug (1.3.4)
6
+ irb (>= 1.3.6)
7
+ reline (>= 0.2.7)
8
+
9
+ PATH
10
+ remote: ..
11
+ specs:
12
+ sentry-inst_jobs (1.0.0)
13
+ inst-jobs (~> 3.0)
14
+ sentry-ruby-core (~> 4.8.0)
15
+
16
+ GEM
17
+ remote: https://rubygems.org/
18
+ specs:
19
+ actioncable (6.1.4.1)
20
+ actionpack (= 6.1.4.1)
21
+ activesupport (= 6.1.4.1)
22
+ nio4r (~> 2.0)
23
+ websocket-driver (>= 0.6.1)
24
+ actionmailbox (6.1.4.1)
25
+ actionpack (= 6.1.4.1)
26
+ activejob (= 6.1.4.1)
27
+ activerecord (= 6.1.4.1)
28
+ activestorage (= 6.1.4.1)
29
+ activesupport (= 6.1.4.1)
30
+ mail (>= 2.7.1)
31
+ actionmailer (6.1.4.1)
32
+ actionpack (= 6.1.4.1)
33
+ actionview (= 6.1.4.1)
34
+ activejob (= 6.1.4.1)
35
+ activesupport (= 6.1.4.1)
36
+ mail (~> 2.5, >= 2.5.4)
37
+ rails-dom-testing (~> 2.0)
38
+ actionpack (6.1.4.1)
39
+ actionview (= 6.1.4.1)
40
+ activesupport (= 6.1.4.1)
41
+ rack (~> 2.0, >= 2.0.9)
42
+ rack-test (>= 0.6.3)
43
+ rails-dom-testing (~> 2.0)
44
+ rails-html-sanitizer (~> 1.0, >= 1.2.0)
45
+ actiontext (6.1.4.1)
46
+ actionpack (= 6.1.4.1)
47
+ activerecord (= 6.1.4.1)
48
+ activestorage (= 6.1.4.1)
49
+ activesupport (= 6.1.4.1)
50
+ nokogiri (>= 1.8.5)
51
+ actionview (6.1.4.1)
52
+ activesupport (= 6.1.4.1)
53
+ builder (~> 3.1)
54
+ erubi (~> 1.4)
55
+ rails-dom-testing (~> 2.0)
56
+ rails-html-sanitizer (~> 1.1, >= 1.2.0)
57
+ activejob (6.1.4.1)
58
+ activesupport (= 6.1.4.1)
59
+ globalid (>= 0.3.6)
60
+ activemodel (6.1.4.1)
61
+ activesupport (= 6.1.4.1)
62
+ activerecord (6.1.4.1)
63
+ activemodel (= 6.1.4.1)
64
+ activesupport (= 6.1.4.1)
65
+ activerecord-pg-extensions (0.4.2)
66
+ activerecord (>= 6.0, < 6.2)
67
+ railties (>= 6.0, < 6.2)
68
+ activestorage (6.1.4.1)
69
+ actionpack (= 6.1.4.1)
70
+ activejob (= 6.1.4.1)
71
+ activerecord (= 6.1.4.1)
72
+ activesupport (= 6.1.4.1)
73
+ marcel (~> 1.0.0)
74
+ mini_mime (>= 1.1.0)
75
+ activesupport (6.1.4.1)
76
+ concurrent-ruby (~> 1.0, >= 1.0.2)
77
+ i18n (>= 1.6, < 2)
78
+ minitest (>= 5.1)
79
+ tzinfo (~> 2.0)
80
+ zeitwerk (~> 2.3)
81
+ after_transaction_commit (2.2.2)
82
+ activerecord (>= 5.2)
83
+ builder (3.2.4)
84
+ coderay (1.1.3)
85
+ concurrent-ruby (1.1.9)
86
+ crass (1.0.6)
87
+ debug_inspector (1.1.0)
88
+ erubi (1.10.0)
89
+ et-orbi (1.2.6)
90
+ tzinfo
91
+ faraday (1.8.0)
92
+ faraday-em_http (~> 1.0)
93
+ faraday-em_synchrony (~> 1.0)
94
+ faraday-excon (~> 1.1)
95
+ faraday-httpclient (~> 1.0.1)
96
+ faraday-net_http (~> 1.0)
97
+ faraday-net_http_persistent (~> 1.1)
98
+ faraday-patron (~> 1.0)
99
+ faraday-rack (~> 1.0)
100
+ multipart-post (>= 1.2, < 3)
101
+ ruby2_keywords (>= 0.0.4)
102
+ faraday-em_http (1.0.0)
103
+ faraday-em_synchrony (1.0.0)
104
+ faraday-excon (1.1.0)
105
+ faraday-httpclient (1.0.1)
106
+ faraday-net_http (1.0.1)
107
+ faraday-net_http_persistent (1.2.0)
108
+ faraday-patron (1.0.0)
109
+ faraday-rack (1.0.0)
110
+ fugit (1.5.2)
111
+ et-orbi (~> 1.1, >= 1.1.8)
112
+ raabro (~> 1.4)
113
+ globalid (1.0.0)
114
+ activesupport (>= 5.0)
115
+ i18n (1.8.11)
116
+ concurrent-ruby (~> 1.0)
117
+ inst-jobs (3.0.3)
118
+ activerecord (>= 6.0)
119
+ activerecord-pg-extensions (~> 0.4)
120
+ activesupport (>= 6.0)
121
+ after_transaction_commit (>= 1.0, < 3)
122
+ debug_inspector (~> 1.0)
123
+ fugit (~> 1.3)
124
+ railties (>= 6.0)
125
+ io-console (0.5.9)
126
+ irb (1.3.7)
127
+ reline (>= 0.2.7)
128
+ loofah (2.12.0)
129
+ crass (~> 1.0.2)
130
+ nokogiri (>= 1.5.9)
131
+ mail (2.7.1)
132
+ mini_mime (>= 0.1.1)
133
+ marcel (1.0.2)
134
+ method_source (1.0.0)
135
+ mini_mime (1.1.2)
136
+ minitest (5.14.4)
137
+ multipart-post (2.1.1)
138
+ nio4r (2.5.8)
139
+ nokogiri (1.12.5-x86_64-darwin)
140
+ racc (~> 1.4)
141
+ pry (0.14.1)
142
+ coderay (~> 1.1)
143
+ method_source (~> 1.0)
144
+ raabro (1.4.0)
145
+ racc (1.6.0)
146
+ rack (2.2.3)
147
+ rack-test (1.1.0)
148
+ rack (>= 1.0, < 3)
149
+ rails (6.1.4.1)
150
+ actioncable (= 6.1.4.1)
151
+ actionmailbox (= 6.1.4.1)
152
+ actionmailer (= 6.1.4.1)
153
+ actionpack (= 6.1.4.1)
154
+ actiontext (= 6.1.4.1)
155
+ actionview (= 6.1.4.1)
156
+ activejob (= 6.1.4.1)
157
+ activemodel (= 6.1.4.1)
158
+ activerecord (= 6.1.4.1)
159
+ activestorage (= 6.1.4.1)
160
+ activesupport (= 6.1.4.1)
161
+ bundler (>= 1.15.0)
162
+ railties (= 6.1.4.1)
163
+ sprockets-rails (>= 2.0.0)
164
+ rails-dom-testing (2.0.3)
165
+ activesupport (>= 4.2.0)
166
+ nokogiri (>= 1.6)
167
+ rails-html-sanitizer (1.4.2)
168
+ loofah (~> 2.3)
169
+ railties (6.1.4.1)
170
+ actionpack (= 6.1.4.1)
171
+ activesupport (= 6.1.4.1)
172
+ method_source
173
+ rake (>= 0.13)
174
+ thor (~> 1.0)
175
+ rake (13.0.6)
176
+ reline (0.2.7)
177
+ io-console (~> 0.5)
178
+ ruby2_keywords (0.0.5)
179
+ sentry-ruby (4.8.1)
180
+ concurrent-ruby (~> 1.0, >= 1.0.2)
181
+ faraday (>= 1.0)
182
+ sentry-ruby-core (= 4.8.1)
183
+ sentry-ruby-core (4.8.1)
184
+ concurrent-ruby
185
+ faraday
186
+ sprockets (4.0.2)
187
+ concurrent-ruby (~> 1.0)
188
+ rack (> 1, < 3)
189
+ sprockets-rails (3.4.1)
190
+ actionpack (>= 5.2)
191
+ activesupport (>= 5.2)
192
+ sprockets (>= 3.0.0)
193
+ sqlite3 (1.4.2)
194
+ thor (1.1.0)
195
+ tzinfo (2.0.4)
196
+ concurrent-ruby (~> 1.0)
197
+ websocket-driver (0.7.5)
198
+ websocket-extensions (>= 0.1.0)
199
+ websocket-extensions (0.1.5)
200
+ zeitwerk (2.5.1)
201
+
202
+ PLATFORMS
203
+ x86_64-darwin-20
204
+
205
+ DEPENDENCIES
206
+ debug!
207
+ inst-jobs
208
+ pry
209
+ rails
210
+ sentry-inst_jobs!
211
+ sentry-ruby
212
+ sqlite3
213
+
214
+ BUNDLED WITH
215
+ 2.2.3
data/example/app.rb ADDED
@@ -0,0 +1,57 @@
1
+ require "pry"
2
+ require "active_job"
3
+ require "active_record"
4
+ require "inst-jobs"
5
+ require "sentry-inst_jobs"
6
+ # require "logger"
7
+
8
+ # This connection will do for database-independent bug reports.
9
+ ActiveRecord::Base.establish_connection(adapter: "sqlite3", database: ":memory:")
10
+ # ActiveRecord::Base.logger = Logger.new(STDOUT)
11
+
12
+ ActiveRecord::Schema.define do
13
+ create_table :delayed_jobs do |table|
14
+ table.integer :priority, default: 0, null: false # Allows some jobs to jump to the front of the queue
15
+ table.integer :attempts, default: 0, null: false # Provides for retries, but still fail eventually.
16
+ table.text :handler, null: false # YAML-encoded string of the object that will do work
17
+ table.text :last_error # reason for last failure (See Note below)
18
+ table.datetime :run_at # When to run. Could be Time.zone.now for immediately, or sometime in the future.
19
+ table.datetime :locked_at # Set when a client is working on this object
20
+ table.datetime :failed_at # Set when all retries have failed (actually, by default, the record is deleted instead)
21
+ table.string :locked_by # Who is working on this object (if locked)
22
+ table.string :queue # The name of the queue this job is in
23
+ table.timestamps null: true
24
+
25
+ # inst-jobs specific columns
26
+ table.string :tag
27
+ table.string :strand
28
+ table.integer :max_attempts
29
+ table.datetime :expires_at
30
+ table.string :singleton
31
+ table.boolean :next_in_strand, default: true, null: false
32
+ end
33
+ end
34
+
35
+ Sentry.init do |config|
36
+ config.breadcrumbs_logger = [:sentry_logger]
37
+ # replace it with your sentry dsn
38
+ config.dsn = 'http://ae0ee6fcea6d4005aba998c8b1cd6eb1@sentry.docker/3'
39
+ end
40
+
41
+ Delayed::Worker.new
42
+
43
+ class Foo
44
+ def bar
45
+ 1 / 0
46
+ end
47
+ end
48
+
49
+ Foo.new.delay.bar
50
+
51
+ enqueued_job = Delayed::Backend::ActiveRecord::Job.last
52
+
53
+ begin
54
+ enqueued_job.invoke_job
55
+ rescue => e
56
+ puts("inline job failed because of \"#{e.message}\"")
57
+ end
@@ -0,0 +1,21 @@
1
+ module Sentry
2
+ class Configuration
3
+ attr_reader :inst_jobs
4
+
5
+ add_post_initialization_callback do
6
+ @inst_jobs = Sentry::InstJobs::Configuration.new
7
+ end
8
+ end
9
+
10
+ module InstJobs
11
+ class Configuration
12
+ # Set this option to true if you want Sentry to only capture the last job
13
+ # retry if it fails.
14
+ attr_accessor :report_after_job_retries
15
+
16
+ def initialize
17
+ @report_after_job_retries = false
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,87 @@
1
+ # frozen_string_literal: true
2
+ require "inst-jobs"
3
+
4
+ module Sentry
5
+ module InstJobs
6
+ class Plugin < ::Delayed::Plugin
7
+ # need to symbolize strings as keyword arguments in Ruby 2.4~2.6
8
+ INST_JOBS_CONTEXT_KEY = :"Inst-Jobs"
9
+
10
+ callbacks do |lifecycle|
11
+ lifecycle.around(:invoke_job) do |job, *args, &block|
12
+ next block.call(job, *args) unless Sentry.initialized?
13
+
14
+ Sentry.with_scope do |scope|
15
+ contexts = generate_contexts(job)
16
+ scope.set_transaction_name(contexts.dig(INST_JOBS_CONTEXT_KEY, :job_class))
17
+ scope.set_contexts(**contexts)
18
+ scope.set_tags("inst_jobs.queue" => job.queue, "inst_jobs.id" => job.id.to_s)
19
+
20
+ transaction = Sentry.start_transaction(name: scope.transaction_name, op: "inst_jobs")
21
+ scope.set_span(transaction) if transaction
22
+
23
+ begin
24
+ block.call(job, *args)
25
+
26
+ finish_transaction(transaction, 200)
27
+ rescue Exception => e
28
+ capture_exception(e, job)
29
+ finish_transaction(transaction, 500)
30
+ raise
31
+ end
32
+ end
33
+ end
34
+ end
35
+
36
+ def self.generate_contexts(job)
37
+ context = {}
38
+
39
+ context[INST_JOBS_CONTEXT_KEY] = {
40
+ id: job.id.to_s,
41
+ priority: job.priority,
42
+ attempts: job.attempts,
43
+ run_at: job.run_at,
44
+ locked_at: job.locked_at,
45
+ locked_by: job.locked_by,
46
+ queue: job.queue,
47
+ created_at: job.created_at,
48
+ last_error: job.last_error&.byteslice(0..1000),
49
+ handler: job.handler&.byteslice(0..1000),
50
+ job_class: compute_job_class(job.payload_object),
51
+ }
52
+
53
+ context
54
+ end
55
+
56
+ def self.compute_job_class(payload_object)
57
+ if payload_object.is_a? Delayed::PerformableMethod
58
+ klass = payload_object.object.is_a?(Class) ? payload_object.object.name : payload_object.object.class.name
59
+ "#{klass}##{payload_object.method}"
60
+ else
61
+ payload_object.class.name
62
+ end
63
+ end
64
+
65
+ def self.capture_exception(exception, job)
66
+ Sentry::InstJobs.capture_exception(exception, hint: { background: false }) if report?(job)
67
+ end
68
+
69
+ def self.report?(job)
70
+ return true unless Sentry.configuration.inst_jobs.report_after_job_retries
71
+
72
+ # We use the predecessor because the job's attempts haven't been increased to the new
73
+ # count at this point.
74
+ job.attempts >= job.max_attempts.pred
75
+ end
76
+
77
+ def self.finish_transaction(transaction, status)
78
+ return unless transaction
79
+
80
+ transaction.set_http_status(status)
81
+ transaction.finish
82
+ end
83
+ end
84
+ end
85
+ end
86
+
87
+ Delayed::Worker.plugins << Sentry::InstJobs::Plugin
@@ -0,0 +1,5 @@
1
+ module Sentry
2
+ module InstJobs
3
+ VERSION = "1.0.0"
4
+ end
5
+ end
@@ -0,0 +1,14 @@
1
+ require "inst-jobs"
2
+ require "sentry-ruby"
3
+ require "sentry/integrable"
4
+ require "sentry/inst_jobs/configuration"
5
+ require "sentry/inst_jobs/version"
6
+ require "sentry/inst_jobs/plugin"
7
+
8
+ module Sentry
9
+ module InstJobs
10
+ extend Sentry::Integrable
11
+
12
+ register_integration name: "inst_jobs", version: Sentry::InstJobs::VERSION
13
+ end
14
+ end
@@ -0,0 +1,27 @@
1
+ require_relative "lib/sentry/inst_jobs/version"
2
+
3
+ Gem::Specification.new do |spec|
4
+ spec.name = "sentry-inst_jobs"
5
+ spec.version = Sentry::InstJobs::VERSION
6
+ spec.authors = ["Isaac Moore"]
7
+ spec.description = spec.summary = "An inst-jobs integration for the Sentry error logger"
8
+ spec.email = "isaac.moore@instructure.com"
9
+ spec.license = 'MIT'
10
+ spec.homepage = "https://github.com/instructure/sentry-inst_jobs"
11
+
12
+ spec.platform = Gem::Platform::RUBY
13
+ spec.required_ruby_version = '>= 2.4'
14
+ spec.extra_rdoc_files = %w[README.md LICENSE]
15
+ spec.files = `git ls-files | grep -Ev '^(spec|benchmarks|examples)'`.split("\n")
16
+
17
+ spec.metadata["homepage_uri"] = spec.homepage
18
+ spec.metadata["source_code_uri"] = spec.homepage
19
+ spec.metadata["changelog_uri"] = "#{spec.homepage}/blob/master/CHANGELOG.md"
20
+
21
+ spec.bindir = "exe"
22
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
23
+ spec.require_paths = ["lib"]
24
+
25
+ spec.add_dependency "sentry-ruby-core", "~> 4.8.0"
26
+ spec.add_dependency "inst-jobs", "~> 3.0"
27
+ end
metadata ADDED
@@ -0,0 +1,98 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: sentry-inst_jobs
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Isaac Moore
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2021-12-09 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: sentry-ruby-core
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 4.8.0
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: 4.8.0
27
+ - !ruby/object:Gem::Dependency
28
+ name: inst-jobs
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '3.0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '3.0'
41
+ description: An inst-jobs integration for the Sentry error logger
42
+ email: isaac.moore@instructure.com
43
+ executables: []
44
+ extensions: []
45
+ extra_rdoc_files:
46
+ - README.md
47
+ - LICENSE
48
+ files:
49
+ - ".dockerignore"
50
+ - ".gitignore"
51
+ - ".rspec"
52
+ - CODE_OF_CONDUCT.md
53
+ - Dockerfile.ci
54
+ - Gemfile
55
+ - Gemfile.lock
56
+ - Jenkinsfile
57
+ - LICENSE
58
+ - Makefile
59
+ - README.md
60
+ - Rakefile
61
+ - bin/console
62
+ - bin/setup
63
+ - docker-compose.yml
64
+ - example/Gemfile
65
+ - example/Gemfile.lock
66
+ - example/app.rb
67
+ - lib/sentry-inst_jobs.rb
68
+ - lib/sentry/inst_jobs/configuration.rb
69
+ - lib/sentry/inst_jobs/plugin.rb
70
+ - lib/sentry/inst_jobs/version.rb
71
+ - sentry-inst_jobs.gemspec
72
+ homepage: https://github.com/instructure/sentry-inst_jobs
73
+ licenses:
74
+ - MIT
75
+ metadata:
76
+ homepage_uri: https://github.com/instructure/sentry-inst_jobs
77
+ source_code_uri: https://github.com/instructure/sentry-inst_jobs
78
+ changelog_uri: https://github.com/instructure/sentry-inst_jobs/blob/master/CHANGELOG.md
79
+ post_install_message:
80
+ rdoc_options: []
81
+ require_paths:
82
+ - lib
83
+ required_ruby_version: !ruby/object:Gem::Requirement
84
+ requirements:
85
+ - - ">="
86
+ - !ruby/object:Gem::Version
87
+ version: '2.4'
88
+ required_rubygems_version: !ruby/object:Gem::Requirement
89
+ requirements:
90
+ - - ">="
91
+ - !ruby/object:Gem::Version
92
+ version: '0'
93
+ requirements: []
94
+ rubygems_version: 3.2.33
95
+ signing_key:
96
+ specification_version: 4
97
+ summary: An inst-jobs integration for the Sentry error logger
98
+ test_files: []