stenotype 0.1.0 → 0.1.6
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.
- checksums.yaml +4 -4
- data/.gitignore +3 -0
- data/.rubocop.yml +3 -2
- data/CHANGELOG.md +43 -0
- data/Gemfile +1 -1
- data/Gemfile.lock +111 -60
- data/README.md +48 -17
- data/Rakefile +2 -2
- data/TODO.md +18 -0
- data/bin/console +3 -3
- data/lib/generators/USAGE +8 -0
- data/lib/generators/stenotype/initializer/initializer_generator.rb +23 -0
- data/lib/generators/stenotype/initializer/templates/initializer.rb.erb +82 -0
- data/lib/stenotype.rb +24 -85
- data/lib/stenotype/adapters.rb +3 -3
- data/lib/stenotype/adapters/base.rb +25 -2
- data/lib/stenotype/adapters/google_cloud.rb +70 -22
- data/lib/stenotype/adapters/stdout_adapter.rb +36 -2
- data/lib/stenotype/at_exit.rb +8 -0
- data/lib/stenotype/configuration.rb +127 -36
- data/lib/stenotype/context_handlers.rb +6 -8
- data/lib/stenotype/context_handlers/base.rb +14 -3
- data/lib/stenotype/context_handlers/collection.rb +78 -34
- data/lib/stenotype/context_handlers/rails/active_job.rb +3 -11
- data/lib/stenotype/context_handlers/rails/controller.rb +10 -11
- data/lib/stenotype/dispatcher.rb +1 -2
- data/lib/stenotype/emitter.rb +166 -0
- data/lib/stenotype/event.rb +48 -25
- data/lib/stenotype/event_serializer.rb +31 -11
- data/lib/stenotype/frameworks/rails/action_controller.rb +44 -21
- data/lib/stenotype/frameworks/rails/active_job.rb +3 -5
- data/lib/stenotype/railtie.rb +37 -0
- data/lib/stenotype/version.rb +1 -1
- data/stenotype.gemspec +30 -26
- metadata +70 -19
- data/lib/stenotype/exceptions.rb +0 -31
- data/lib/stenotype/frameworks/object_ext.rb +0 -145
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d77ba29ea50a26b7a8592149629d6a58368b56a615246ebaff36ade2a8a9f3a7
|
4
|
+
data.tar.gz: d519ef0ee071b97d6ff3dbed088f06b18826adbfdadcddaf89019c230b1aecb3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b59b094ef4c1379a2771f78fef83639040fedc62a0a2d2fb9209c50060e2c96856ea26fd28090a5788a06c4d97942b78c954df1eba861d4fbdd07d675f91d60e
|
7
|
+
data.tar.gz: dfca37efc78a9063d8a239e27b2ed36a6b2ae981c330b072a2b3b43b46c9359323f4fd1ac790096c1458a38e860519ceb972f84ef9f9e12f2788b77d96c11709
|
data/.gitignore
CHANGED
data/.rubocop.yml
CHANGED
data/CHANGELOG.md
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
# Changelog
|
2
|
+
|
3
|
+
*Release Date*: 2020/01/13
|
4
|
+
|
5
|
+
### 0.1.5 2020/01/13
|
6
|
+
* In case `graceful_error_handling` is set to off raise a generic `Stenotype::Error` on any exception in order to intercept a single error type in the client code.
|
7
|
+
* Adds an `at_exit` hook to flush the async message queue when using the library in async mode.
|
8
|
+
|
9
|
+
### 0.1.4 2020/01/10
|
10
|
+
* Adds a new configuration option `graceful_error_handling` to suppress errors raised from the gem's internals yet logging the error to specified `config.logger`
|
11
|
+
|
12
|
+
### 0.1.3: 2020/01/10
|
13
|
+
* Adds a new configuration option `logger` to use during error handling
|
14
|
+
* Adds a new config option `Stenotype.config.enabled`. If the option is set to false then event is not going to be published. The option is `true` by default.
|
15
|
+
|
16
|
+
### 0.1.2: 2019/12/10
|
17
|
+
|
18
|
+
* Changes the interface of how event is emitted. Now you must pass `event_name`, `attributes` and optional `eval_context`. Note that `additional_options` are eliminated
|
19
|
+
* Makes StdoutAdapter more informative by adding a special line for every entry in the log.
|
20
|
+
* Fixes Rails initializer not working after switching to Configurable from Spicerack.
|
21
|
+
|
22
|
+
### 0.1.1: 2019/11/25
|
23
|
+
|
24
|
+
* Moves all error into top level namespace definition file.
|
25
|
+
* Introduces a root class for all gem specific errors.
|
26
|
+
* Renames ObjectExt to an Eventable concern.
|
27
|
+
* Changes the aggressive extension of Object, forces a user to include the Eventable module only where necessary.
|
28
|
+
* Moves all rails specific logic into a Railtie, which is required only if in Rails universe.
|
29
|
+
* Adds more examples to yard documentation of the classes.
|
30
|
+
* Adds a TODO list based on the feedback.
|
31
|
+
* Grinds a huge GoogleCloud adapter method into smaller ones.
|
32
|
+
* Add two 'on/off' configuration options for Rails specific components.
|
33
|
+
* Switches to using rails specific delegate method where possible (in rails components extensions).
|
34
|
+
|
35
|
+
### 0.1.0: The Big Bang
|
36
|
+
|
37
|
+
* Rails controller and active job adapters
|
38
|
+
* Generic event method
|
39
|
+
* Handlers for GCP Pub/Sub and STDOUT
|
40
|
+
* Initial commit
|
41
|
+
|
42
|
+
|
43
|
+
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,50 +1,51 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
stenotype (0.1.
|
4
|
+
stenotype (0.1.6)
|
5
5
|
activesupport (>= 5.0.0)
|
6
6
|
google-cloud-pubsub (~> 1.0.0)
|
7
|
+
spicery (>= 0.19.0, < 1.0)
|
7
8
|
|
8
9
|
GEM
|
9
10
|
remote: https://rubygems.org/
|
10
11
|
specs:
|
11
|
-
actioncable (5.2.
|
12
|
-
actionpack (= 5.2.
|
12
|
+
actioncable (5.2.4)
|
13
|
+
actionpack (= 5.2.4)
|
13
14
|
nio4r (~> 2.0)
|
14
15
|
websocket-driver (>= 0.6.1)
|
15
|
-
actionmailer (5.2.
|
16
|
-
actionpack (= 5.2.
|
17
|
-
actionview (= 5.2.
|
18
|
-
activejob (= 5.2.
|
16
|
+
actionmailer (5.2.4)
|
17
|
+
actionpack (= 5.2.4)
|
18
|
+
actionview (= 5.2.4)
|
19
|
+
activejob (= 5.2.4)
|
19
20
|
mail (~> 2.5, >= 2.5.4)
|
20
21
|
rails-dom-testing (~> 2.0)
|
21
|
-
actionpack (5.2.
|
22
|
-
actionview (= 5.2.
|
23
|
-
activesupport (= 5.2.
|
22
|
+
actionpack (5.2.4)
|
23
|
+
actionview (= 5.2.4)
|
24
|
+
activesupport (= 5.2.4)
|
24
25
|
rack (~> 2.0)
|
25
26
|
rack-test (>= 0.6.3)
|
26
27
|
rails-dom-testing (~> 2.0)
|
27
28
|
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
28
|
-
actionview (5.2.
|
29
|
-
activesupport (= 5.2.
|
29
|
+
actionview (5.2.4)
|
30
|
+
activesupport (= 5.2.4)
|
30
31
|
builder (~> 3.1)
|
31
32
|
erubi (~> 1.4)
|
32
33
|
rails-dom-testing (~> 2.0)
|
33
34
|
rails-html-sanitizer (~> 1.0, >= 1.0.3)
|
34
|
-
activejob (5.2.
|
35
|
-
activesupport (= 5.2.
|
35
|
+
activejob (5.2.4)
|
36
|
+
activesupport (= 5.2.4)
|
36
37
|
globalid (>= 0.3.6)
|
37
|
-
activemodel (5.2.
|
38
|
-
activesupport (= 5.2.
|
39
|
-
activerecord (5.2.
|
40
|
-
activemodel (= 5.2.
|
41
|
-
activesupport (= 5.2.
|
38
|
+
activemodel (5.2.4)
|
39
|
+
activesupport (= 5.2.4)
|
40
|
+
activerecord (5.2.4)
|
41
|
+
activemodel (= 5.2.4)
|
42
|
+
activesupport (= 5.2.4)
|
42
43
|
arel (>= 9.0)
|
43
|
-
activestorage (5.2.
|
44
|
-
actionpack (= 5.2.
|
45
|
-
activerecord (= 5.2.
|
44
|
+
activestorage (5.2.4)
|
45
|
+
actionpack (= 5.2.4)
|
46
|
+
activerecord (= 5.2.4)
|
46
47
|
marcel (~> 0.3.1)
|
47
|
-
activesupport (5.2.
|
48
|
+
activesupport (5.2.4)
|
48
49
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
49
50
|
i18n (>= 0.7, < 2)
|
50
51
|
minitest (~> 5.1)
|
@@ -52,17 +53,29 @@ GEM
|
|
52
53
|
addressable (2.7.0)
|
53
54
|
public_suffix (>= 2.0.2, < 5.0)
|
54
55
|
arel (9.0.0)
|
56
|
+
around_the_world (0.19.2)
|
57
|
+
activesupport (>= 5.2.1)
|
55
58
|
ast (2.4.0)
|
56
59
|
builder (3.2.3)
|
57
60
|
coderay (1.1.2)
|
61
|
+
collectible (0.19.2)
|
62
|
+
activesupport (>= 5.2.1)
|
63
|
+
short_circu_it (= 0.19.2)
|
64
|
+
tablesalt (= 0.19.2)
|
58
65
|
concurrent-ruby (1.1.5)
|
66
|
+
conjunction (0.19.2)
|
67
|
+
activesupport (>= 5.2.1)
|
59
68
|
crass (1.0.5)
|
60
69
|
diff-lcs (1.3)
|
61
70
|
docile (1.3.2)
|
62
71
|
erubi (1.9.0)
|
72
|
+
facet (0.19.2)
|
73
|
+
activesupport (>= 5.2.1)
|
74
|
+
short_circu_it (= 0.19.2)
|
75
|
+
tablesalt (= 0.19.2)
|
63
76
|
faker (1.9.6)
|
64
77
|
i18n (>= 0.7)
|
65
|
-
faraday (0.17.
|
78
|
+
faraday (0.17.1)
|
66
79
|
multipart-post (>= 1.2, < 3)
|
67
80
|
github-markup (3.0.4)
|
68
81
|
globalid (0.4.2)
|
@@ -83,7 +96,7 @@ GEM
|
|
83
96
|
googleauth (~> 0.9)
|
84
97
|
grpc (~> 1.24)
|
85
98
|
rly (~> 0.2.3)
|
86
|
-
google-protobuf (3.
|
99
|
+
google-protobuf (3.11.1-universal-darwin)
|
87
100
|
googleapis-common-protos (1.3.9)
|
88
101
|
google-protobuf (~> 3.0)
|
89
102
|
googleapis-common-protos-types (~> 1.0)
|
@@ -108,87 +121,102 @@ GEM
|
|
108
121
|
jaro_winkler (1.5.4)
|
109
122
|
json (2.2.0)
|
110
123
|
jwt (2.2.1)
|
111
|
-
loofah (2.
|
124
|
+
loofah (2.4.0)
|
112
125
|
crass (~> 1.0.2)
|
113
126
|
nokogiri (>= 1.5.9)
|
114
127
|
mail (2.7.1)
|
115
128
|
mini_mime (>= 0.1.1)
|
116
129
|
marcel (0.3.3)
|
117
130
|
mimemagic (~> 0.3.2)
|
118
|
-
memoist (0.16.
|
131
|
+
memoist (0.16.2)
|
119
132
|
method_source (0.9.2)
|
120
133
|
mimemagic (0.3.3)
|
121
134
|
mini_mime (1.0.2)
|
122
135
|
mini_portile2 (2.4.0)
|
123
|
-
minitest (5.
|
136
|
+
minitest (5.13.0)
|
124
137
|
multi_json (1.14.1)
|
125
138
|
multipart-post (2.1.1)
|
126
139
|
nio4r (2.5.2)
|
127
|
-
nokogiri (1.10.
|
140
|
+
nokogiri (1.10.7)
|
128
141
|
mini_portile2 (~> 2.4.0)
|
129
142
|
os (1.0.1)
|
130
|
-
parallel (1.
|
143
|
+
parallel (1.19.1)
|
131
144
|
parser (2.6.5.0)
|
132
145
|
ast (~> 2.4.0)
|
133
146
|
pry (0.12.2)
|
134
147
|
coderay (~> 1.1.0)
|
135
148
|
method_source (~> 0.9.0)
|
136
149
|
public_suffix (4.0.1)
|
137
|
-
rack (2.0.
|
150
|
+
rack (2.0.8)
|
138
151
|
rack-test (1.1.0)
|
139
152
|
rack (>= 1.0, < 3)
|
140
|
-
rails (5.2.
|
141
|
-
actioncable (= 5.2.
|
142
|
-
actionmailer (= 5.2.
|
143
|
-
actionpack (= 5.2.
|
144
|
-
actionview (= 5.2.
|
145
|
-
activejob (= 5.2.
|
146
|
-
activemodel (= 5.2.
|
147
|
-
activerecord (= 5.2.
|
148
|
-
activestorage (= 5.2.
|
149
|
-
activesupport (= 5.2.
|
153
|
+
rails (5.2.4)
|
154
|
+
actioncable (= 5.2.4)
|
155
|
+
actionmailer (= 5.2.4)
|
156
|
+
actionpack (= 5.2.4)
|
157
|
+
actionview (= 5.2.4)
|
158
|
+
activejob (= 5.2.4)
|
159
|
+
activemodel (= 5.2.4)
|
160
|
+
activerecord (= 5.2.4)
|
161
|
+
activestorage (= 5.2.4)
|
162
|
+
activesupport (= 5.2.4)
|
150
163
|
bundler (>= 1.3.0)
|
151
|
-
railties (= 5.2.
|
164
|
+
railties (= 5.2.4)
|
152
165
|
sprockets-rails (>= 2.0.0)
|
153
166
|
rails-dom-testing (2.0.3)
|
154
167
|
activesupport (>= 4.2.0)
|
155
168
|
nokogiri (>= 1.6)
|
156
169
|
rails-html-sanitizer (1.3.0)
|
157
170
|
loofah (~> 2.3)
|
158
|
-
railties (5.2.
|
159
|
-
actionpack (= 5.2.
|
160
|
-
activesupport (= 5.2.
|
171
|
+
railties (5.2.4)
|
172
|
+
actionpack (= 5.2.4)
|
173
|
+
activesupport (= 5.2.4)
|
161
174
|
method_source
|
162
175
|
rake (>= 0.8.7)
|
163
176
|
thor (>= 0.19.0, < 2.0)
|
164
177
|
rainbow (3.0.0)
|
165
178
|
rake (10.5.0)
|
166
179
|
redcarpet (3.5.0)
|
180
|
+
redis (4.1.3)
|
181
|
+
redis_hash (0.19.2)
|
182
|
+
activesupport (>= 5.2.1)
|
183
|
+
redis (>= 3.0)
|
184
|
+
tablesalt (= 0.19.2)
|
167
185
|
rly (0.2.3)
|
168
|
-
rspec (3.
|
169
|
-
rspec-core (~> 3.
|
170
|
-
rspec-expectations (~> 3.
|
171
|
-
rspec-mocks (~> 3.
|
172
|
-
rspec-core (3.
|
173
|
-
rspec-support (~> 3.
|
174
|
-
rspec-expectations (3.
|
186
|
+
rspec (3.9.0)
|
187
|
+
rspec-core (~> 3.9.0)
|
188
|
+
rspec-expectations (~> 3.9.0)
|
189
|
+
rspec-mocks (~> 3.9.0)
|
190
|
+
rspec-core (3.9.0)
|
191
|
+
rspec-support (~> 3.9.0)
|
192
|
+
rspec-expectations (3.9.0)
|
175
193
|
diff-lcs (>= 1.2.0, < 2.0)
|
176
|
-
rspec-support (~> 3.
|
177
|
-
rspec-mocks (3.
|
194
|
+
rspec-support (~> 3.9.0)
|
195
|
+
rspec-mocks (3.9.0)
|
178
196
|
diff-lcs (>= 1.2.0, < 2.0)
|
179
|
-
rspec-support (~> 3.
|
180
|
-
rspec-support (3.
|
181
|
-
rspice (0.
|
182
|
-
faker (
|
197
|
+
rspec-support (~> 3.9.0)
|
198
|
+
rspec-support (3.9.0)
|
199
|
+
rspice (0.19.2)
|
200
|
+
faker (>= 1.8, < 2.0)
|
183
201
|
rspec (~> 3.0)
|
184
|
-
rubocop (0.
|
202
|
+
rubocop (0.74.0)
|
185
203
|
jaro_winkler (~> 1.5.1)
|
186
204
|
parallel (~> 1.10)
|
187
205
|
parser (>= 2.6)
|
188
206
|
rainbow (>= 2.2.2, < 4.0)
|
189
207
|
ruby-progressbar (~> 1.7)
|
190
208
|
unicode-display_width (>= 1.4.0, < 1.7)
|
209
|
+
rubocop-performance (1.4.1)
|
210
|
+
rubocop (>= 0.71.0)
|
211
|
+
rubocop-rails (2.3.0)
|
212
|
+
rack (>= 1.1)
|
213
|
+
rubocop (>= 0.72.0)
|
214
|
+
rubocop-rspec (1.35.0)
|
215
|
+
rubocop (>= 0.60.0)
|
191
216
|
ruby-progressbar (1.10.1)
|
217
|
+
short_circu_it (0.19.2)
|
218
|
+
activesupport (>= 5.2.1)
|
219
|
+
around_the_world (= 0.19.2)
|
192
220
|
signet (0.12.0)
|
193
221
|
addressable (~> 2.3)
|
194
222
|
faraday (~> 0.9)
|
@@ -199,6 +227,22 @@ GEM
|
|
199
227
|
json (>= 1.8, < 3)
|
200
228
|
simplecov-html (~> 0.10.0)
|
201
229
|
simplecov-html (0.10.2)
|
230
|
+
spicerack (0.19.2)
|
231
|
+
around_the_world (= 0.19.2)
|
232
|
+
redis_hash (= 0.19.2)
|
233
|
+
short_circu_it (= 0.19.2)
|
234
|
+
tablesalt (= 0.19.2)
|
235
|
+
technologic (= 0.19.2)
|
236
|
+
spicerack-styleguide (0.19.2)
|
237
|
+
rubocop (= 0.74)
|
238
|
+
rubocop-performance (= 1.4.1)
|
239
|
+
rubocop-rails (= 2.3.0)
|
240
|
+
rubocop-rspec (= 1.35.0)
|
241
|
+
spicery (0.19.2)
|
242
|
+
collectible (= 0.19.2)
|
243
|
+
conjunction (= 0.19.2)
|
244
|
+
facet (= 0.19.2)
|
245
|
+
spicerack (= 0.19.2)
|
202
246
|
sprockets (4.0.0)
|
203
247
|
concurrent-ruby (~> 1.0)
|
204
248
|
rack (> 1, < 3)
|
@@ -206,6 +250,13 @@ GEM
|
|
206
250
|
actionpack (>= 4.0)
|
207
251
|
activesupport (>= 4.0)
|
208
252
|
sprockets (>= 3.0.0)
|
253
|
+
tablesalt (0.19.2)
|
254
|
+
activemodel (>= 5.2.1)
|
255
|
+
activesupport (>= 5.2.1)
|
256
|
+
technologic (0.19.2)
|
257
|
+
activesupport (>= 5.2.1)
|
258
|
+
railties (>= 5.2.1)
|
259
|
+
short_circu_it (= 0.19.2)
|
209
260
|
thor (0.20.3)
|
210
261
|
thread_safe (0.3.6)
|
211
262
|
timecop (0.9.1)
|
@@ -229,8 +280,8 @@ DEPENDENCIES
|
|
229
280
|
redcarpet (~> 3.5)
|
230
281
|
rspec (~> 3.0)
|
231
282
|
rspice
|
232
|
-
rubocop (~> 0.76)
|
233
283
|
simplecov (~> 0.17)
|
284
|
+
spicerack-styleguide (>= 0.19.0, < 1.0)
|
234
285
|
stenotype!
|
235
286
|
timecop (~> 0.9)
|
236
287
|
yard (~> 0.9)
|
data/README.md
CHANGED
@@ -7,7 +7,7 @@ This gem is a tool providing extensions to several rails components in order to
|
|
7
7
|
Add this line to your application's Gemfile:
|
8
8
|
|
9
9
|
```ruby
|
10
|
-
gem
|
10
|
+
gem "Stenotype"
|
11
11
|
```
|
12
12
|
|
13
13
|
And then execute:
|
@@ -25,24 +25,47 @@ Or install it yourself as:
|
|
25
25
|
Configuring the library is as simple as:
|
26
26
|
```ruby
|
27
27
|
Stenotype.configure do |config|
|
28
|
+
config.enabled = true
|
28
29
|
config.targets = [ # Supported targets
|
29
30
|
Stenotype::Adapters::StdoutAdapter.new,
|
30
31
|
Stenotype::Adapters::GoogleCloud.new
|
31
32
|
]
|
32
33
|
|
33
|
-
config.uuid_generator
|
34
|
-
config.dispatcher
|
35
|
-
config.
|
36
|
-
config.
|
37
|
-
|
38
|
-
config.
|
34
|
+
config.uuid_generator = SecureRandom
|
35
|
+
config.dispatcher = Stenotype::Dispatcher.new
|
36
|
+
config.logger = Logger.new(STDOUT)
|
37
|
+
config.graceful_error_handling = true
|
38
|
+
|
39
|
+
config.google_cloud do |gc_config|
|
40
|
+
gc_config.project_id = "google_cloud_project_id"
|
41
|
+
gc_config.credentials = "path_to_key_json"
|
42
|
+
gc_config.topic = "google_cloud_topic"
|
43
|
+
gc_config.async = true # either true or false
|
44
|
+
end
|
45
|
+
|
46
|
+
config.rails do |rails_config|
|
47
|
+
rails_config.enable_action_controller_ext = true
|
48
|
+
rails_config.enable_active_job_ext = true
|
49
|
+
end
|
39
50
|
end
|
40
51
|
```
|
41
52
|
|
53
|
+
#### config.enabled
|
54
|
+
|
55
|
+
A flag checked upon emission of an event. Will prevent event emission if set to false. An event is emitted if set to true.
|
56
|
+
|
42
57
|
#### config.targets
|
43
58
|
|
44
59
|
Contain an array of targets for the events to be published to. Targets must implement method `#publish(event_data, **additional_arguments)`.
|
45
60
|
|
61
|
+
#### config.logger
|
62
|
+
|
63
|
+
Specifies a logger for messages and exceptions to be output to. If not set defaults to `Logger.new(STDOUT)`, otherwise a manually set logger is used.
|
64
|
+
|
65
|
+
#### config.graceful_error_handling
|
66
|
+
|
67
|
+
This flag if set to `true` is going to suppress all `StandardError`'s raised within a gem. Raises the error to the caller if set to `false`
|
68
|
+
|
46
69
|
#### config.uuid_generator
|
47
70
|
|
48
71
|
An object that must implement method `#uuid`. Used when an event is emitted to generate a unique id for each event.
|
@@ -51,21 +74,29 @@ An object that must implement method `#uuid`. Used when an event is emitted to g
|
|
51
74
|
|
52
75
|
Dispatcher used to dispatch the event. A dispatcher must implement method `#publish(even, serializer: Stenotype::EventSerializer)`. By default `Stenotype::EventSerializer` is used, which is responsible for collecting the data from the event and evaluation context.
|
53
76
|
|
54
|
-
#### config.
|
77
|
+
#### config.google_cloud.project_id
|
55
78
|
|
56
79
|
Google cloud project ID. Please refer to Google Cloud management console to get one.
|
57
80
|
|
58
|
-
#### config.
|
81
|
+
#### config.google_cloud.credentials
|
59
82
|
|
60
83
|
Google cloud credentials. Might be obtained from Google Cloud management console.
|
61
84
|
|
62
|
-
#### config.
|
85
|
+
#### config.google_cloud.topic
|
63
86
|
|
64
87
|
Google Cloud topic used for publishing the events.
|
65
88
|
|
66
|
-
#### config.
|
89
|
+
#### config.google_cloud.async
|
90
|
+
|
91
|
+
Google Cloud publish mode. The mode is either sync or async. When in `sync` mode the event will be published in the same thread (which might influence performance). For `async` mode the event will be put into a pull which is going to be flushed after a threshold is met.
|
92
|
+
|
93
|
+
#### config.rails.enable_action_controller_ext
|
94
|
+
|
95
|
+
Allows to enable/disable Rails ActionController extension
|
96
|
+
|
97
|
+
#### config.rails.enable_active_job_ext
|
67
98
|
|
68
|
-
|
99
|
+
Allows to enable/disable Rails ActiveJob extension
|
69
100
|
|
70
101
|
#### Configuring context handlers
|
71
102
|
|
@@ -76,8 +107,8 @@ Each event is emitted in a context which might be an ActionController instance o
|
|
76
107
|
Emitting an event is as simple as:
|
77
108
|
```ruby
|
78
109
|
Stenotype::Event.emit!(
|
79
|
-
|
80
|
-
|
110
|
+
"Event Name",
|
111
|
+
{ attr1: :value1, attr2: :value2 },
|
81
112
|
eval_context: { name_of_registered_context_handler: context_object }
|
82
113
|
)
|
83
114
|
```
|
@@ -150,7 +181,7 @@ class BaseClass
|
|
150
181
|
attr_reader :local_state
|
151
182
|
|
152
183
|
def initialize
|
153
|
-
@local_state =
|
184
|
+
@local_state = "some state"
|
154
185
|
end
|
155
186
|
end
|
156
187
|
|
@@ -172,9 +203,9 @@ Stenotype::ContextHandlers.register CustomHandler
|
|
172
203
|
class PlainRubyClass < BaseClass
|
173
204
|
def some_method(data)
|
174
205
|
event_data = collect_some_data_as_a_hash
|
175
|
-
emit_event(event_data) # method name will be `some_method`, eval_context: { klass: self }
|
206
|
+
emit_event("event_name", event_data) # method name will be `some_method`, eval_context: { klass: self }
|
176
207
|
other_event_data = do_something_else
|
177
|
-
emit_event(other_event_data, method: :custom_method_name, eval_context: { overriden_handler: self })
|
208
|
+
emit_event("other_event_name", other_event_data, method: :custom_method_name, eval_context: { overriden_handler: self })
|
178
209
|
end
|
179
210
|
end
|
180
211
|
```
|