getaround_utils 0.2.21 → 0.2.24
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.ruby-version +1 -1
- data/Gemfile.lock +115 -110
- data/README.md +52 -2
- data/getaround_utils.gemspec +5 -4
- data/lib/getaround_utils/mixins/loggable.rb +34 -0
- data/lib/getaround_utils/railties/dotenv.rb +22 -0
- data/lib/getaround_utils/version.rb +1 -1
- metadata +34 -19
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e6782f48cc315a19f03e388e3cd7af4e4dd9fa36aa661c4423186056c35b86a0
|
4
|
+
data.tar.gz: 6bbe9c3696d4991d77a7ce3205a0aca9fedb16cf4bc9e928024e8911f994ff44
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f8d7e8e930796ad130e8182bee49f4736afe42f9def854547582e5637b344db0bdb318213954a063f716d12f783e925e341f1ee6774958147e29bb362834e7c9
|
7
|
+
data.tar.gz: e19006a2224229ff80c0f68c51b15482641dbb68223b9d627667998f88dd6a0d4c7ed882d036e6c93674f4a2d7972a6f302cd2909459058d0b5f78e0cc054dad
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
ruby-2.
|
1
|
+
ruby-2.7.4
|
data/Gemfile.lock
CHANGED
@@ -1,65 +1,65 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
getaround_utils (0.2.
|
4
|
+
getaround_utils (0.2.24)
|
5
5
|
|
6
6
|
GEM
|
7
7
|
remote: https://rubygems.org/
|
8
8
|
specs:
|
9
|
-
actioncable (6.1.4)
|
10
|
-
actionpack (= 6.1.4)
|
11
|
-
activesupport (= 6.1.4)
|
9
|
+
actioncable (6.1.4.6)
|
10
|
+
actionpack (= 6.1.4.6)
|
11
|
+
activesupport (= 6.1.4.6)
|
12
12
|
nio4r (~> 2.0)
|
13
13
|
websocket-driver (>= 0.6.1)
|
14
|
-
actionmailbox (6.1.4)
|
15
|
-
actionpack (= 6.1.4)
|
16
|
-
activejob (= 6.1.4)
|
17
|
-
activerecord (= 6.1.4)
|
18
|
-
activestorage (= 6.1.4)
|
19
|
-
activesupport (= 6.1.4)
|
14
|
+
actionmailbox (6.1.4.6)
|
15
|
+
actionpack (= 6.1.4.6)
|
16
|
+
activejob (= 6.1.4.6)
|
17
|
+
activerecord (= 6.1.4.6)
|
18
|
+
activestorage (= 6.1.4.6)
|
19
|
+
activesupport (= 6.1.4.6)
|
20
20
|
mail (>= 2.7.1)
|
21
|
-
actionmailer (6.1.4)
|
22
|
-
actionpack (= 6.1.4)
|
23
|
-
actionview (= 6.1.4)
|
24
|
-
activejob (= 6.1.4)
|
25
|
-
activesupport (= 6.1.4)
|
21
|
+
actionmailer (6.1.4.6)
|
22
|
+
actionpack (= 6.1.4.6)
|
23
|
+
actionview (= 6.1.4.6)
|
24
|
+
activejob (= 6.1.4.6)
|
25
|
+
activesupport (= 6.1.4.6)
|
26
26
|
mail (~> 2.5, >= 2.5.4)
|
27
27
|
rails-dom-testing (~> 2.0)
|
28
|
-
actionpack (6.1.4)
|
29
|
-
actionview (= 6.1.4)
|
30
|
-
activesupport (= 6.1.4)
|
28
|
+
actionpack (6.1.4.6)
|
29
|
+
actionview (= 6.1.4.6)
|
30
|
+
activesupport (= 6.1.4.6)
|
31
31
|
rack (~> 2.0, >= 2.0.9)
|
32
32
|
rack-test (>= 0.6.3)
|
33
33
|
rails-dom-testing (~> 2.0)
|
34
34
|
rails-html-sanitizer (~> 1.0, >= 1.2.0)
|
35
|
-
actiontext (6.1.4)
|
36
|
-
actionpack (= 6.1.4)
|
37
|
-
activerecord (= 6.1.4)
|
38
|
-
activestorage (= 6.1.4)
|
39
|
-
activesupport (= 6.1.4)
|
35
|
+
actiontext (6.1.4.6)
|
36
|
+
actionpack (= 6.1.4.6)
|
37
|
+
activerecord (= 6.1.4.6)
|
38
|
+
activestorage (= 6.1.4.6)
|
39
|
+
activesupport (= 6.1.4.6)
|
40
40
|
nokogiri (>= 1.8.5)
|
41
|
-
actionview (6.1.4)
|
42
|
-
activesupport (= 6.1.4)
|
41
|
+
actionview (6.1.4.6)
|
42
|
+
activesupport (= 6.1.4.6)
|
43
43
|
builder (~> 3.1)
|
44
44
|
erubi (~> 1.4)
|
45
45
|
rails-dom-testing (~> 2.0)
|
46
46
|
rails-html-sanitizer (~> 1.1, >= 1.2.0)
|
47
|
-
activejob (6.1.4)
|
48
|
-
activesupport (= 6.1.4)
|
47
|
+
activejob (6.1.4.6)
|
48
|
+
activesupport (= 6.1.4.6)
|
49
49
|
globalid (>= 0.3.6)
|
50
|
-
activemodel (6.1.4)
|
51
|
-
activesupport (= 6.1.4)
|
52
|
-
activerecord (6.1.4)
|
53
|
-
activemodel (= 6.1.4)
|
54
|
-
activesupport (= 6.1.4)
|
55
|
-
activestorage (6.1.4)
|
56
|
-
actionpack (= 6.1.4)
|
57
|
-
activejob (= 6.1.4)
|
58
|
-
activerecord (= 6.1.4)
|
59
|
-
activesupport (= 6.1.4)
|
50
|
+
activemodel (6.1.4.6)
|
51
|
+
activesupport (= 6.1.4.6)
|
52
|
+
activerecord (6.1.4.6)
|
53
|
+
activemodel (= 6.1.4.6)
|
54
|
+
activesupport (= 6.1.4.6)
|
55
|
+
activestorage (6.1.4.6)
|
56
|
+
actionpack (= 6.1.4.6)
|
57
|
+
activejob (= 6.1.4.6)
|
58
|
+
activerecord (= 6.1.4.6)
|
59
|
+
activesupport (= 6.1.4.6)
|
60
60
|
marcel (~> 1.0.0)
|
61
61
|
mini_mime (>= 1.1.0)
|
62
|
-
activesupport (6.1.4)
|
62
|
+
activesupport (6.1.4.6)
|
63
63
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
64
64
|
i18n (>= 1.6, < 2)
|
65
65
|
minitest (>= 5.1)
|
@@ -70,104 +70,108 @@ GEM
|
|
70
70
|
ast (2.4.2)
|
71
71
|
builder (3.2.4)
|
72
72
|
coderay (1.1.3)
|
73
|
-
concurrent-ruby (1.1.
|
74
|
-
connection_pool (2.2.
|
73
|
+
concurrent-ruby (1.1.10)
|
74
|
+
connection_pool (2.2.5)
|
75
75
|
crack (0.4.5)
|
76
76
|
rexml
|
77
77
|
crass (1.0.6)
|
78
|
-
diff-lcs (1.
|
78
|
+
diff-lcs (1.5.0)
|
79
|
+
dotenv (2.7.6)
|
80
|
+
dotenv-rails (2.7.6)
|
81
|
+
dotenv (= 2.7.6)
|
82
|
+
railties (>= 3.2)
|
79
83
|
erubi (1.10.0)
|
80
|
-
getaround-rubocop (0.2.
|
84
|
+
getaround-rubocop (0.2.7)
|
81
85
|
relaxed-rubocop (= 2.5)
|
82
|
-
rubocop (= 1.
|
86
|
+
rubocop (= 1.25.1)
|
83
87
|
rubocop-rspec (= 2.4.0)
|
84
|
-
globalid (0.
|
85
|
-
activesupport (>=
|
88
|
+
globalid (1.0.0)
|
89
|
+
activesupport (>= 5.0)
|
86
90
|
hashdiff (1.0.1)
|
87
|
-
i18n (1.
|
91
|
+
i18n (1.10.0)
|
88
92
|
concurrent-ruby (~> 1.0)
|
89
|
-
lograge (0.
|
93
|
+
lograge (0.12.0)
|
90
94
|
actionpack (>= 4)
|
91
95
|
activesupport (>= 4)
|
92
96
|
railties (>= 4)
|
93
97
|
request_store (~> 1.0)
|
94
|
-
loofah (2.
|
98
|
+
loofah (2.18.0)
|
95
99
|
crass (~> 1.0.2)
|
96
100
|
nokogiri (>= 1.5.9)
|
97
101
|
mail (2.7.1)
|
98
102
|
mini_mime (>= 0.1.1)
|
99
|
-
marcel (1.0.
|
103
|
+
marcel (1.0.2)
|
100
104
|
method_source (1.0.0)
|
101
|
-
mini_mime (1.1.
|
102
|
-
mini_portile2 (2.
|
103
|
-
minitest (5.
|
104
|
-
nio4r (2.5.
|
105
|
-
nokogiri (1.
|
106
|
-
mini_portile2 (~> 2.
|
105
|
+
mini_mime (1.1.2)
|
106
|
+
mini_portile2 (2.8.0)
|
107
|
+
minitest (5.15.0)
|
108
|
+
nio4r (2.5.8)
|
109
|
+
nokogiri (1.13.6)
|
110
|
+
mini_portile2 (~> 2.8.0)
|
107
111
|
racc (~> 1.4)
|
108
112
|
oj (3.11.3)
|
109
113
|
ougai (2.0.0)
|
110
114
|
oj (~> 3.10)
|
111
|
-
parallel (1.
|
112
|
-
parser (3.
|
115
|
+
parallel (1.21.0)
|
116
|
+
parser (3.1.1.0)
|
113
117
|
ast (~> 2.4.1)
|
114
118
|
pry (0.14.1)
|
115
119
|
coderay (~> 1.1)
|
116
120
|
method_source (~> 1.0)
|
117
121
|
public_suffix (4.0.6)
|
118
|
-
racc (1.
|
119
|
-
rack (2.2.3)
|
122
|
+
racc (1.6.0)
|
123
|
+
rack (2.2.3.1)
|
120
124
|
rack-test (1.1.0)
|
121
125
|
rack (>= 1.0, < 3)
|
122
|
-
rails (6.1.4)
|
123
|
-
actioncable (= 6.1.4)
|
124
|
-
actionmailbox (= 6.1.4)
|
125
|
-
actionmailer (= 6.1.4)
|
126
|
-
actionpack (= 6.1.4)
|
127
|
-
actiontext (= 6.1.4)
|
128
|
-
actionview (= 6.1.4)
|
129
|
-
activejob (= 6.1.4)
|
130
|
-
activemodel (= 6.1.4)
|
131
|
-
activerecord (= 6.1.4)
|
132
|
-
activestorage (= 6.1.4)
|
133
|
-
activesupport (= 6.1.4)
|
126
|
+
rails (6.1.4.6)
|
127
|
+
actioncable (= 6.1.4.6)
|
128
|
+
actionmailbox (= 6.1.4.6)
|
129
|
+
actionmailer (= 6.1.4.6)
|
130
|
+
actionpack (= 6.1.4.6)
|
131
|
+
actiontext (= 6.1.4.6)
|
132
|
+
actionview (= 6.1.4.6)
|
133
|
+
activejob (= 6.1.4.6)
|
134
|
+
activemodel (= 6.1.4.6)
|
135
|
+
activerecord (= 6.1.4.6)
|
136
|
+
activestorage (= 6.1.4.6)
|
137
|
+
activesupport (= 6.1.4.6)
|
134
138
|
bundler (>= 1.15.0)
|
135
|
-
railties (= 6.1.4)
|
139
|
+
railties (= 6.1.4.6)
|
136
140
|
sprockets-rails (>= 2.0.0)
|
137
141
|
rails-dom-testing (2.0.3)
|
138
142
|
activesupport (>= 4.2.0)
|
139
143
|
nokogiri (>= 1.6)
|
140
|
-
rails-html-sanitizer (1.3
|
144
|
+
rails-html-sanitizer (1.4.3)
|
141
145
|
loofah (~> 2.3)
|
142
|
-
railties (6.1.4)
|
143
|
-
actionpack (= 6.1.4)
|
144
|
-
activesupport (= 6.1.4)
|
146
|
+
railties (6.1.4.6)
|
147
|
+
actionpack (= 6.1.4.6)
|
148
|
+
activesupport (= 6.1.4.6)
|
145
149
|
method_source
|
146
150
|
rake (>= 0.13)
|
147
151
|
thor (~> 1.0)
|
148
|
-
rainbow (3.
|
152
|
+
rainbow (3.1.1)
|
149
153
|
rake (13.0.6)
|
150
|
-
redis (4.
|
151
|
-
regexp_parser (2.
|
154
|
+
redis (4.6.0)
|
155
|
+
regexp_parser (2.2.1)
|
152
156
|
relaxed-rubocop (2.5)
|
153
|
-
request_store (1.5.
|
157
|
+
request_store (1.5.1)
|
154
158
|
rack (>= 1.4)
|
155
159
|
request_store_rails (2.0.0)
|
156
160
|
concurrent-ruby (~> 1.0)
|
157
161
|
rexml (3.2.5)
|
158
|
-
rspec (3.
|
159
|
-
rspec-core (~> 3.
|
160
|
-
rspec-expectations (~> 3.
|
161
|
-
rspec-mocks (~> 3.
|
162
|
-
rspec-core (3.
|
163
|
-
rspec-support (~> 3.
|
164
|
-
rspec-expectations (3.
|
162
|
+
rspec (3.11.0)
|
163
|
+
rspec-core (~> 3.11.0)
|
164
|
+
rspec-expectations (~> 3.11.0)
|
165
|
+
rspec-mocks (~> 3.11.0)
|
166
|
+
rspec-core (3.11.0)
|
167
|
+
rspec-support (~> 3.11.0)
|
168
|
+
rspec-expectations (3.11.0)
|
165
169
|
diff-lcs (>= 1.2.0, < 2.0)
|
166
|
-
rspec-support (~> 3.
|
167
|
-
rspec-mocks (3.
|
170
|
+
rspec-support (~> 3.11.0)
|
171
|
+
rspec-mocks (3.11.1)
|
168
172
|
diff-lcs (>= 1.2.0, < 2.0)
|
169
|
-
rspec-support (~> 3.
|
170
|
-
rspec-rails (5.
|
173
|
+
rspec-support (~> 3.11.0)
|
174
|
+
rspec-rails (5.1.2)
|
171
175
|
actionpack (>= 5.2)
|
172
176
|
activesupport (>= 5.2)
|
173
177
|
railties (>= 5.2)
|
@@ -175,54 +179,55 @@ GEM
|
|
175
179
|
rspec-expectations (~> 3.10)
|
176
180
|
rspec-mocks (~> 3.10)
|
177
181
|
rspec-support (~> 3.10)
|
178
|
-
rspec-support (3.
|
179
|
-
rubocop (1.
|
182
|
+
rspec-support (3.11.0)
|
183
|
+
rubocop (1.25.1)
|
180
184
|
parallel (~> 1.10)
|
181
|
-
parser (>= 3.
|
185
|
+
parser (>= 3.1.0.0)
|
182
186
|
rainbow (>= 2.2.2, < 4.0)
|
183
187
|
regexp_parser (>= 1.8, < 3.0)
|
184
188
|
rexml
|
185
|
-
rubocop-ast (>= 1.
|
189
|
+
rubocop-ast (>= 1.15.1, < 2.0)
|
186
190
|
ruby-progressbar (~> 1.7)
|
187
191
|
unicode-display_width (>= 1.4.0, < 3.0)
|
188
|
-
rubocop-ast (1.
|
189
|
-
parser (>= 3.
|
192
|
+
rubocop-ast (1.16.0)
|
193
|
+
parser (>= 3.1.1.0)
|
190
194
|
rubocop-rspec (2.4.0)
|
191
195
|
rubocop (~> 1.0)
|
192
196
|
rubocop-ast (>= 1.1.0)
|
193
197
|
ruby-progressbar (1.11.0)
|
194
|
-
sidekiq (6.
|
198
|
+
sidekiq (6.5.0)
|
195
199
|
connection_pool (>= 2.2.2)
|
196
200
|
rack (~> 2.0)
|
197
201
|
redis (>= 4.2.0)
|
198
202
|
sprockets (4.0.2)
|
199
203
|
concurrent-ruby (~> 1.0)
|
200
204
|
rack (> 1, < 3)
|
201
|
-
sprockets-rails (3.
|
202
|
-
actionpack (>=
|
203
|
-
activesupport (>=
|
205
|
+
sprockets-rails (3.4.2)
|
206
|
+
actionpack (>= 5.2)
|
207
|
+
activesupport (>= 5.2)
|
204
208
|
sprockets (>= 3.0.0)
|
205
|
-
thor (1.1
|
209
|
+
thor (1.2.1)
|
206
210
|
tzinfo (2.0.4)
|
207
211
|
concurrent-ruby (~> 1.0)
|
208
|
-
unicode-display_width (2.
|
209
|
-
webmock (3.
|
210
|
-
addressable (>= 2.
|
212
|
+
unicode-display_width (2.1.0)
|
213
|
+
webmock (3.14.0)
|
214
|
+
addressable (>= 2.8.0)
|
211
215
|
crack (>= 0.3.2)
|
212
216
|
hashdiff (>= 0.4.0, < 2.0.0)
|
213
217
|
websocket-driver (0.7.5)
|
214
218
|
websocket-extensions (>= 0.1.0)
|
215
219
|
websocket-extensions (0.1.5)
|
216
|
-
zeitwerk (2.4
|
220
|
+
zeitwerk (2.5.4)
|
217
221
|
|
218
222
|
PLATFORMS
|
219
223
|
ruby
|
220
224
|
|
221
225
|
DEPENDENCIES
|
222
226
|
bundler (~> 2.0)
|
223
|
-
|
227
|
+
dotenv-rails (~> 2.7.6)
|
228
|
+
getaround-rubocop (= 0.2.7)
|
224
229
|
getaround_utils!
|
225
|
-
lograge (~> 0.
|
230
|
+
lograge (~> 0.12.0)
|
226
231
|
ougai (~> 2.0)
|
227
232
|
pry (~> 0.14.0)
|
228
233
|
rails (~> 6.0)
|
@@ -230,9 +235,9 @@ DEPENDENCIES
|
|
230
235
|
request_store_rails (~> 2.0)
|
231
236
|
rspec (~> 3.9, >= 3.9.0)
|
232
237
|
rspec-rails (~> 5.0)
|
233
|
-
rubocop (= 1.
|
238
|
+
rubocop (= 1.25.1)
|
234
239
|
sidekiq (~> 6.0)
|
235
240
|
webmock (~> 3.7)
|
236
241
|
|
237
242
|
BUNDLED WITH
|
238
|
-
2.
|
243
|
+
2.3.4
|
data/README.md
CHANGED
@@ -4,6 +4,31 @@ Backend shared utility classes
|
|
4
4
|
|
5
5
|
## Railties
|
6
6
|
|
7
|
+
### GetaroundUtils::Railties::Dotenv
|
8
|
+
|
9
|
+
Enable currated .env files loading
|
10
|
+
```
|
11
|
+
# config/application.rb
|
12
|
+
require 'getaround_utils/railties/dotenv'
|
13
|
+
|
14
|
+
GetaroundUtils::Railties::Dotenv.load
|
15
|
+
```
|
16
|
+
|
17
|
+
Additional files can be loaded with the highed precedence via the `DOTENVS` variable, ie:
|
18
|
+
```
|
19
|
+
DOTENVS=custom1,custom2 rails c
|
20
|
+
# Will `load` .env files in the following order:
|
21
|
+
# - `.env.custom1.local`
|
22
|
+
# - `.env.custom1`
|
23
|
+
# - `.env.custom2.local`
|
24
|
+
# - `.env.custom2`
|
25
|
+
# - `.env.<RAILS_ENV>.local`
|
26
|
+
# - `.env.<RAILS_ENV>`
|
27
|
+
# - `.env.all.local`
|
28
|
+
# - `.env.all`
|
29
|
+
# - `.env.local`
|
30
|
+
```
|
31
|
+
|
7
32
|
### GetaroundUtils::Railties::Lograge
|
8
33
|
|
9
34
|
Enables lograge (http logs) with favored default.
|
@@ -28,8 +53,8 @@ For more details, [read the spec](spec/getaround_utils/railties/ougai_spec.rb)
|
|
28
53
|
|
29
54
|
### GetaroundUtils::Mixins::Loggable
|
30
55
|
|
31
|
-
Enables lograge (http logs) with favored default.
|
32
|
-
```
|
56
|
+
- Enables lograge (http logs) with favored default.
|
57
|
+
```ruby
|
33
58
|
class MyClass
|
34
59
|
include GetaroundUtils::Mixins::Loggable
|
35
60
|
|
@@ -48,6 +73,31 @@ MyClass.new.action # :info message="hello" origin="MyClass" static="value" dynam
|
|
48
73
|
|
49
74
|
For more details, [read the spec](spec/getaround_utils/mixins/loggable_spec.rb)
|
50
75
|
|
76
|
+
- Offers an abstraction to log messages with a configurable `alert_threshold` attribute
|
77
|
+
|
78
|
+
```ruby
|
79
|
+
class MyClass
|
80
|
+
include GetaroundUtils::Mixins::Loggable
|
81
|
+
|
82
|
+
def action
|
83
|
+
monitorable_log(:my_event_to_be_monitored, dynamic: 'value')
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
MyClass.new.action # :info message="monitorable_log__my_event_to_be_monitored" origin="MyClass" dynamic="value", threshold=10
|
88
|
+
```
|
89
|
+
The threshold is configured in the relevant Rails configuration (eg `config/environments/production.rb`)
|
90
|
+
```ruby
|
91
|
+
# ...
|
92
|
+
config.monitorable_log_thresholds = {
|
93
|
+
my_event_to_be_monitored: 10
|
94
|
+
}
|
95
|
+
# ...
|
96
|
+
```
|
97
|
+
You may set / override the configured thresholds with an environment variable of the event name prefixed with `MONITORABLE_LOG__`, for instance `MONITORABLE_LOG__MY_EVENT_TO_BE_MONITORED`.
|
98
|
+
|
99
|
+
For more details, [read the spec](spec/getaround_utils/mixins/loggable_spec.rb#L171)
|
100
|
+
|
51
101
|
## Misc
|
52
102
|
|
53
103
|
### GetaroundUtils::LogFormatters::DeepKeyValue
|
data/getaround_utils.gemspec
CHANGED
@@ -11,7 +11,7 @@ Gem::Specification.new do |gem|
|
|
11
11
|
gem.email = ['oss@drivy.com']
|
12
12
|
gem.homepage = 'https://github.com/drivy'
|
13
13
|
gem.license = 'MIT'
|
14
|
-
gem.required_ruby_version = '>= 2.
|
14
|
+
gem.required_ruby_version = '>= 2.7'
|
15
15
|
|
16
16
|
gem.files = Dir.chdir(File.expand_path(__dir__)) do
|
17
17
|
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(spec)/}) }
|
@@ -19,16 +19,17 @@ Gem::Specification.new do |gem|
|
|
19
19
|
|
20
20
|
# Development dependencies
|
21
21
|
gem.add_development_dependency 'bundler', '~> 2.0'
|
22
|
-
gem.add_development_dependency 'getaround-rubocop', '= 0.2.
|
22
|
+
gem.add_development_dependency 'getaround-rubocop', '= 0.2.7'
|
23
23
|
gem.add_development_dependency 'pry', '~> 0.14.0'
|
24
24
|
gem.add_development_dependency 'rake', '~> 13.0'
|
25
25
|
gem.add_development_dependency 'rspec', '~> 3.9', '>= 3.9.0'
|
26
26
|
gem.add_development_dependency 'rspec-rails', '~> 5.0'
|
27
|
-
gem.add_development_dependency 'rubocop', '= 1.
|
27
|
+
gem.add_development_dependency 'rubocop', '= 1.25.1'
|
28
28
|
gem.add_development_dependency 'webmock', '~> 3.7'
|
29
29
|
|
30
30
|
# Functional (optional) dependencies
|
31
|
-
gem.add_development_dependency '
|
31
|
+
gem.add_development_dependency 'dotenv-rails', '~> 2.7.6'
|
32
|
+
gem.add_development_dependency 'lograge', '~> 0.12.0'
|
32
33
|
gem.add_development_dependency 'ougai', '~> 2.0'
|
33
34
|
gem.add_development_dependency 'rails', '~> 6.0'
|
34
35
|
gem.add_development_dependency 'request_store_rails', '~> 2.0'
|
@@ -29,4 +29,38 @@ module GetaroundUtils::Mixins::Loggable
|
|
29
29
|
base_append_infos_to_loggable(payload)
|
30
30
|
loggable_logger.send(severity.to_sym, msg: message, **payload)
|
31
31
|
end
|
32
|
+
|
33
|
+
MONITORABLE_LOG_PREFIX = "monitorable_log__"
|
34
|
+
|
35
|
+
def monitorable_log(event_name, **options)
|
36
|
+
monitorable_threshold = monitorable_threshold(event_name)
|
37
|
+
return if monitorable_threshold.blank?
|
38
|
+
|
39
|
+
loggable_log(
|
40
|
+
:info,
|
41
|
+
log_message(event_name),
|
42
|
+
alert_threshold: monitorable_threshold,
|
43
|
+
**options
|
44
|
+
)
|
45
|
+
end
|
46
|
+
|
47
|
+
def monitorable_threshold(event_name)
|
48
|
+
monitorable_threshold = ENV["#{log_message(event_name)}_threshold".upcase]&.to_i
|
49
|
+
if monitorable_threshold.nil? && rails_config_defined?
|
50
|
+
monitorable_threshold = Rails.application.config.monitorable_log_thresholds&.dig(event_name.to_sym)
|
51
|
+
end
|
52
|
+
monitorable_threshold
|
53
|
+
end
|
54
|
+
|
55
|
+
def log_message(event_name)
|
56
|
+
MONITORABLE_LOG_PREFIX + event_name
|
57
|
+
end
|
58
|
+
|
59
|
+
private
|
60
|
+
|
61
|
+
def rails_config_defined?
|
62
|
+
defined?(Rails) &&
|
63
|
+
Rails.application.config.respond_to?(:monitorable_log_thresholds) &&
|
64
|
+
Rails.application.config.monitorable_log_thresholds.respond_to?(:dig)
|
65
|
+
end
|
32
66
|
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'rails/railtie'
|
4
|
+
|
5
|
+
module GetaroundUtils; end
|
6
|
+
|
7
|
+
module GetaroundUtils::Railties; end
|
8
|
+
|
9
|
+
class GetaroundUtils::Railties::Dotenv < Rails::Railtie
|
10
|
+
def load
|
11
|
+
if ENV['DOTENVS'].present?
|
12
|
+
overrides = ENV['DOTENVS'].split(',').map{ |n| [".env.#{n}.local", ".env.#{n}"] }.flatten
|
13
|
+
warn('=' * 100)
|
14
|
+
warn("⚠️ ENV is overriden with the following profiles: #{overrides}")
|
15
|
+
warn('=' * 100)
|
16
|
+
Dotenv.load(*overrides)
|
17
|
+
end
|
18
|
+
Dotenv::Railtie.load
|
19
|
+
Dotenv.load('.env.all', '.env.all.local')
|
20
|
+
nil
|
21
|
+
end
|
22
|
+
end
|
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: getaround_utils
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.24
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Drivy
|
8
8
|
- Laurent Humez
|
9
|
-
autorequire:
|
9
|
+
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2022-06-17 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -31,14 +31,14 @@ dependencies:
|
|
31
31
|
requirements:
|
32
32
|
- - '='
|
33
33
|
- !ruby/object:Gem::Version
|
34
|
-
version: 0.2.
|
34
|
+
version: 0.2.7
|
35
35
|
type: :development
|
36
36
|
prerelease: false
|
37
37
|
version_requirements: !ruby/object:Gem::Requirement
|
38
38
|
requirements:
|
39
39
|
- - '='
|
40
40
|
- !ruby/object:Gem::Version
|
41
|
-
version: 0.2.
|
41
|
+
version: 0.2.7
|
42
42
|
- !ruby/object:Gem::Dependency
|
43
43
|
name: pry
|
44
44
|
requirement: !ruby/object:Gem::Requirement
|
@@ -71,22 +71,22 @@ dependencies:
|
|
71
71
|
name: rspec
|
72
72
|
requirement: !ruby/object:Gem::Requirement
|
73
73
|
requirements:
|
74
|
-
- - ">="
|
75
|
-
- !ruby/object:Gem::Version
|
76
|
-
version: 3.9.0
|
77
74
|
- - "~>"
|
78
75
|
- !ruby/object:Gem::Version
|
79
76
|
version: '3.9'
|
77
|
+
- - ">="
|
78
|
+
- !ruby/object:Gem::Version
|
79
|
+
version: 3.9.0
|
80
80
|
type: :development
|
81
81
|
prerelease: false
|
82
82
|
version_requirements: !ruby/object:Gem::Requirement
|
83
83
|
requirements:
|
84
|
-
- - ">="
|
85
|
-
- !ruby/object:Gem::Version
|
86
|
-
version: 3.9.0
|
87
84
|
- - "~>"
|
88
85
|
- !ruby/object:Gem::Version
|
89
86
|
version: '3.9'
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: 3.9.0
|
90
90
|
- !ruby/object:Gem::Dependency
|
91
91
|
name: rspec-rails
|
92
92
|
requirement: !ruby/object:Gem::Requirement
|
@@ -107,14 +107,14 @@ dependencies:
|
|
107
107
|
requirements:
|
108
108
|
- - '='
|
109
109
|
- !ruby/object:Gem::Version
|
110
|
-
version: 1.
|
110
|
+
version: 1.25.1
|
111
111
|
type: :development
|
112
112
|
prerelease: false
|
113
113
|
version_requirements: !ruby/object:Gem::Requirement
|
114
114
|
requirements:
|
115
115
|
- - '='
|
116
116
|
- !ruby/object:Gem::Version
|
117
|
-
version: 1.
|
117
|
+
version: 1.25.1
|
118
118
|
- !ruby/object:Gem::Dependency
|
119
119
|
name: webmock
|
120
120
|
requirement: !ruby/object:Gem::Requirement
|
@@ -129,20 +129,34 @@ dependencies:
|
|
129
129
|
- - "~>"
|
130
130
|
- !ruby/object:Gem::Version
|
131
131
|
version: '3.7'
|
132
|
+
- !ruby/object:Gem::Dependency
|
133
|
+
name: dotenv-rails
|
134
|
+
requirement: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - "~>"
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: 2.7.6
|
139
|
+
type: :development
|
140
|
+
prerelease: false
|
141
|
+
version_requirements: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - "~>"
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: 2.7.6
|
132
146
|
- !ruby/object:Gem::Dependency
|
133
147
|
name: lograge
|
134
148
|
requirement: !ruby/object:Gem::Requirement
|
135
149
|
requirements:
|
136
150
|
- - "~>"
|
137
151
|
- !ruby/object:Gem::Version
|
138
|
-
version: 0.
|
152
|
+
version: 0.12.0
|
139
153
|
type: :development
|
140
154
|
prerelease: false
|
141
155
|
version_requirements: !ruby/object:Gem::Requirement
|
142
156
|
requirements:
|
143
157
|
- - "~>"
|
144
158
|
- !ruby/object:Gem::Version
|
145
|
-
version: 0.
|
159
|
+
version: 0.12.0
|
146
160
|
- !ruby/object:Gem::Dependency
|
147
161
|
name: ougai
|
148
162
|
requirement: !ruby/object:Gem::Requirement
|
@@ -218,6 +232,7 @@ files:
|
|
218
232
|
- lib/getaround_utils/ougai.rb
|
219
233
|
- lib/getaround_utils/ougai/deep_key_value_formatter.rb
|
220
234
|
- lib/getaround_utils/ougai/json_formatter.rb
|
235
|
+
- lib/getaround_utils/railties/dotenv.rb
|
221
236
|
- lib/getaround_utils/railties/lograge.rb
|
222
237
|
- lib/getaround_utils/railties/ougai.rb
|
223
238
|
- lib/getaround_utils/utils.rb
|
@@ -227,7 +242,7 @@ homepage: https://github.com/drivy
|
|
227
242
|
licenses:
|
228
243
|
- MIT
|
229
244
|
metadata: {}
|
230
|
-
post_install_message:
|
245
|
+
post_install_message:
|
231
246
|
rdoc_options: []
|
232
247
|
require_paths:
|
233
248
|
- lib
|
@@ -235,15 +250,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
235
250
|
requirements:
|
236
251
|
- - ">="
|
237
252
|
- !ruby/object:Gem::Version
|
238
|
-
version: '2.
|
253
|
+
version: '2.7'
|
239
254
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
240
255
|
requirements:
|
241
256
|
- - ">="
|
242
257
|
- !ruby/object:Gem::Version
|
243
258
|
version: '0'
|
244
259
|
requirements: []
|
245
|
-
rubygems_version: 3.
|
246
|
-
signing_key:
|
260
|
+
rubygems_version: 3.1.6
|
261
|
+
signing_key:
|
247
262
|
specification_version: 4
|
248
263
|
summary: Backend shared utility classes
|
249
264
|
test_files: []
|