herdst_worker 0.2.8 → 0.2.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/herdst_worker/adapters/database.rb +1 -1
- data/lib/herdst_worker/adapters/facade.rb +0 -2
- data/lib/herdst_worker/adapters/sentry.rb +52 -7
- data/lib/herdst_worker/configuration/metadata.rb +11 -2
- data/lib/herdst_worker/queue/facade.rb +1 -1
- data/lib/herdst_worker/queue/processor.rb +1 -1
- data/lib/herdst_worker/queue/runner.rb +1 -1
- data/lib/herdst_worker/version.rb +1 -1
- metadata +21 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5c10aef4b5cddec70c9a214dd9525f907e9f1782efdd45df7b91f12224f958ce
|
4
|
+
data.tar.gz: 3f36164dfe5cdcda86b9b9d05fcca28deb7abf583384086b999fbd24dc7e680b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 05b443e73d5d62a8a21586268f3ac66506953e82005c70dc0da2cd74e1eb9886a774e9c7d12e8bf6119303a3972864f0f666146e78c488c18ad6ee002029152e
|
7
|
+
data.tar.gz: ab82506161ffdd7f9fdbb632ab6c78f5c6d985514c688fbaea7036c0c62413c8668d11bbe27ee825ab0d724cda28190c39e2ccf91bf3521291feac4ce4fcfc62
|
@@ -15,7 +15,7 @@ module HerdstWorker
|
|
15
15
|
db_config.each do |k, v|
|
16
16
|
db_config[k] = ActiveRecord::DatabaseConfigurations::HashConfig.new(app.config.env, k, v)
|
17
17
|
end
|
18
|
-
|
18
|
+
|
19
19
|
ActiveRecord::Base.configurations = db_config.values
|
20
20
|
ActiveRecord::Base.establish_connection(db_config[:primary])
|
21
21
|
ActiveRecord::Base.connection.enable_query_cache!
|
@@ -1,4 +1,5 @@
|
|
1
|
-
require "
|
1
|
+
require "stackprof"
|
2
|
+
require "sentry-ruby"
|
2
3
|
|
3
4
|
|
4
5
|
module HerdstWorker
|
@@ -12,12 +13,20 @@ module HerdstWorker
|
|
12
13
|
release = app.config.metadata[:RELEASE_VERSION]
|
13
14
|
sentry_key = app.config.metadata[:SENTRY_KEY]
|
14
15
|
|
15
|
-
|
16
|
-
config.
|
17
|
-
config.
|
18
|
-
config.
|
19
|
-
config.
|
20
|
-
|
16
|
+
::Sentry.init do |config|
|
17
|
+
config.environment = environment
|
18
|
+
config.dsn = sentry_key
|
19
|
+
config.enabled_environments = %w[preview production]
|
20
|
+
config.release = "#{environment}@#{release}"
|
21
|
+
|
22
|
+
# Set traces_sample_rate to 1.0 to capture 100%
|
23
|
+
# of transactions for performance monitoring.
|
24
|
+
# We recommend adjusting this value in production.
|
25
|
+
config.traces_sample_rate = 0.1
|
26
|
+
# Set profiles_sample_rate to profile 100%
|
27
|
+
# of sampled transactions.
|
28
|
+
# We recommend adjusting this value in production.
|
29
|
+
config.profiles_sample_rate = 0.1
|
21
30
|
end
|
22
31
|
rescue Exception => ex
|
23
32
|
app.logger.error ex.message
|
@@ -28,3 +37,39 @@ module HerdstWorker
|
|
28
37
|
end
|
29
38
|
end
|
30
39
|
end
|
40
|
+
|
41
|
+
|
42
|
+
|
43
|
+
|
44
|
+
|
45
|
+
|
46
|
+
# require "sentry-raven"
|
47
|
+
|
48
|
+
|
49
|
+
# module HerdstWorker
|
50
|
+
# module Adapters
|
51
|
+
# class Sentry
|
52
|
+
|
53
|
+
|
54
|
+
# def self.setup(app)
|
55
|
+
# begin
|
56
|
+
# environment = app.config.metadata[:DEPLOYMENT_ENV]
|
57
|
+
# release = app.config.metadata[:RELEASE_VERSION]
|
58
|
+
# sentry_key = app.config.metadata[:SENTRY_KEY]
|
59
|
+
|
60
|
+
# Raven.configure do |config|
|
61
|
+
# config.current_environment = environment
|
62
|
+
# config.release = release
|
63
|
+
# config.dsn = sentry_key if sentry_key
|
64
|
+
# config.environments = ["preview", "production"]
|
65
|
+
# config.async = lambda { |event| Thread.new { Raven.send_event(event) } }
|
66
|
+
# end
|
67
|
+
# rescue Exception => ex
|
68
|
+
# app.logger.error ex.message
|
69
|
+
# end
|
70
|
+
# end
|
71
|
+
|
72
|
+
|
73
|
+
# end
|
74
|
+
# end
|
75
|
+
# end
|
@@ -10,7 +10,7 @@ module HerdstWorker
|
|
10
10
|
|
11
11
|
|
12
12
|
attr_accessor :config, :aws_credentials, :secrets
|
13
|
-
attr_accessor :config_suffix, :secrets_suffix
|
13
|
+
attr_accessor :config_suffix, :secrets_suffix, :secret_json_keys
|
14
14
|
|
15
15
|
|
16
16
|
def initialize(env, name, config)
|
@@ -20,7 +20,8 @@ module HerdstWorker
|
|
20
20
|
|
21
21
|
self.secrets = {}.with_indifferent_access
|
22
22
|
self.secrets["ENV"] = env
|
23
|
-
|
23
|
+
self.secret_json_keys = ["STRIPE_PLANS"]
|
24
|
+
|
24
25
|
begin
|
25
26
|
self.reload!
|
26
27
|
rescue Exception => ex
|
@@ -177,6 +178,14 @@ module HerdstWorker
|
|
177
178
|
values = self.config.config_for(:metadata)
|
178
179
|
end
|
179
180
|
|
181
|
+
if values && self.secret_json_keys
|
182
|
+
self.secret_json_keys.each do |key|
|
183
|
+
if values[key] && values[key].is_a?(String)
|
184
|
+
values[key] = JSON.parse(values[key]) rescue nil
|
185
|
+
end
|
186
|
+
end
|
187
|
+
end
|
188
|
+
|
180
189
|
values.each { |k, v| self[k] = v } if values
|
181
190
|
end
|
182
191
|
|
@@ -92,7 +92,7 @@ module HerdstWorker
|
|
92
92
|
|
93
93
|
|
94
94
|
def create_email_queue_message(template, company, message_data, attributes = nil, delay = 2)
|
95
|
-
company_key = company.class.name.downcase.to_sym
|
95
|
+
company_key = company.class.name.downcase.to_sym rescue "company"
|
96
96
|
|
97
97
|
# Convert instances of ApplicationRecord to attributes instead of json representation
|
98
98
|
message_data.each do |key, value|
|
@@ -168,7 +168,7 @@ module HerdstWorker
|
|
168
168
|
}.rescue { |ex|
|
169
169
|
if will_fail_permanently
|
170
170
|
self.app.logger.queue.error "Message failed #{attempt_number} times, Reporting and failing permanently. \n#{ex.to_s} \n#{ex.backtrace.join("\n")}"
|
171
|
-
|
171
|
+
Sentry.capture_exception(ex, {
|
172
172
|
:level => "fatal",
|
173
173
|
:extra => {
|
174
174
|
"queue_attempts" => attempt_number,
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: herdst_worker
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Herd.St
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-05-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -147,25 +147,39 @@ dependencies:
|
|
147
147
|
- !ruby/object:Gem::Version
|
148
148
|
version: '1.80'
|
149
149
|
- !ruby/object:Gem::Dependency
|
150
|
-
name:
|
150
|
+
name: stackprof
|
151
151
|
requirement: !ruby/object:Gem::Requirement
|
152
152
|
requirements:
|
153
153
|
- - "~>"
|
154
154
|
- !ruby/object:Gem::Version
|
155
|
-
version:
|
155
|
+
version: 0.2.7
|
156
|
+
type: :runtime
|
157
|
+
prerelease: false
|
158
|
+
version_requirements: !ruby/object:Gem::Requirement
|
159
|
+
requirements:
|
160
|
+
- - "~>"
|
161
|
+
- !ruby/object:Gem::Version
|
162
|
+
version: 0.2.7
|
163
|
+
- !ruby/object:Gem::Dependency
|
164
|
+
name: sentry-ruby
|
165
|
+
requirement: !ruby/object:Gem::Requirement
|
166
|
+
requirements:
|
167
|
+
- - "~>"
|
168
|
+
- !ruby/object:Gem::Version
|
169
|
+
version: '5.17'
|
156
170
|
- - ">="
|
157
171
|
- !ruby/object:Gem::Version
|
158
|
-
version:
|
172
|
+
version: 5.17.3
|
159
173
|
type: :runtime
|
160
174
|
prerelease: false
|
161
175
|
version_requirements: !ruby/object:Gem::Requirement
|
162
176
|
requirements:
|
163
177
|
- - "~>"
|
164
178
|
- !ruby/object:Gem::Version
|
165
|
-
version: '
|
179
|
+
version: '5.17'
|
166
180
|
- - ">="
|
167
181
|
- !ruby/object:Gem::Version
|
168
|
-
version:
|
182
|
+
version: 5.17.3
|
169
183
|
- !ruby/object:Gem::Dependency
|
170
184
|
name: rake
|
171
185
|
requirement: !ruby/object:Gem::Requirement
|