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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 900944cbc8e142a33165f163ec11ca8feb5600ec273dd4682b4ae8b1981eb170
4
- data.tar.gz: 65d027f53b6c501d2c392800cffa9e1a312dc3c75d44ccc611e3e747e5105d25
3
+ metadata.gz: 5c10aef4b5cddec70c9a214dd9525f907e9f1782efdd45df7b91f12224f958ce
4
+ data.tar.gz: 3f36164dfe5cdcda86b9b9d05fcca28deb7abf583384086b999fbd24dc7e680b
5
5
  SHA512:
6
- metadata.gz: dbff474537dd0812301e7fc4f7f05d11f0946449b0c674c3e0d3b67befbbc90ac74bfb4bd426ace5d53824fa73222e422919ee9d6e388c19aaa026b96e531e81
7
- data.tar.gz: e849b9fe1f607b88aeb11c1da0dc180ba2faecf966a9756509af264de369b2f906bd0e3db3e9dc3c780bbf5108753f0387ffef85224fdddd9e5ba7522f605c80
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,5 +1,3 @@
1
- require "sentry-raven"
2
-
3
1
  require_relative "database"
4
2
  require_relative "sentry"
5
3
 
@@ -1,4 +1,5 @@
1
- require "sentry-raven"
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
- Raven.configure do |config|
16
- config.current_environment = environment
17
- config.release = release
18
- config.dsn = sentry_key if sentry_key
19
- config.environments = ["preview", "production"]
20
- config.async = lambda { |event| Thread.new { Raven.send_event(event) } }
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
- Raven.capture_exception(ex, {
171
+ Sentry.capture_exception(ex, {
172
172
  :level => "fatal",
173
173
  :extra => {
174
174
  "queue_attempts" => attempt_number,
@@ -128,7 +128,7 @@ module HerdstWorker
128
128
  if self.app.config.is_dev?
129
129
  raise message
130
130
  else
131
- Raven.capture_message(message)
131
+ Sentry.capture_message(message)
132
132
  return
133
133
  end
134
134
  end
@@ -1,3 +1,3 @@
1
1
  module HerdstWorker
2
- VERSION = '0.2.8'
2
+ VERSION = '0.2.10'
3
3
  end
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.8
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: 2023-10-12 00:00:00.000000000 Z
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: sentry-raven
150
+ name: stackprof
151
151
  requirement: !ruby/object:Gem::Requirement
152
152
  requirements:
153
153
  - - "~>"
154
154
  - !ruby/object:Gem::Version
155
- version: '3.1'
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: 3.1.2
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: '3.1'
179
+ version: '5.17'
166
180
  - - ">="
167
181
  - !ruby/object:Gem::Version
168
- version: 3.1.2
182
+ version: 5.17.3
169
183
  - !ruby/object:Gem::Dependency
170
184
  name: rake
171
185
  requirement: !ruby/object:Gem::Requirement