phobos_db_checkpoint 0.3.0 → 0.4.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: bf7c86a517c50d731d343b8cbf72f7fcacd413a4
4
- data.tar.gz: ca87a4ce8ce804edcfdbc6cbc991404730bc8524
3
+ metadata.gz: b434f50dc535e9cba9803dbc09a8945915a8c413
4
+ data.tar.gz: 6e4652af6814ab4ded09e12909ffc0eb8cec5910
5
5
  SHA512:
6
- metadata.gz: dab2ad650f6fe21d495ac3a6d2f8645907d17e39299c509c48f95f7f0005af4d88887b63b1a2a41f959f213626de8550159d6a8b1b14a04b043f7e0a95dfde0e
7
- data.tar.gz: 6ac30e2f38f7d54e9ec1dd44266f113872deadd8f53aedfcded766a60096ce9aff0c7ef527aea866ba479f71dd697a8e96a762c7e9b72ab969574bc29bf903e0
6
+ metadata.gz: 7cc89324d8c4a264d0929cabc2aeb200e38f7ff3b23c08e45798057057e11c0896e2548779db00775295ed1489e949cd3cd7cd75eba0af8ebad80fa8dbf3c177
7
+ data.tar.gz: 5c0626cfe52e3e6b34f8d193083fa23548e4b9a48c9f220867a708bb3cb1cba3a451a2bb687e40c4e98c0bfef1a29290b3ad79bccb8448d2c22428b82907456c
data/CHANGELOG.md CHANGED
@@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file.
4
4
  The format is based on [Keep a Changelog](http://keepachangelog.com/)
5
5
  and this project adheres to [Semantic Versioning](http://semver.org/).
6
6
 
7
+ ## 0.4.0 (2016-12-28)
8
+
9
+ - [feature] Add more instrumentation for consuming
10
+ - [feature] Support custom db config path
11
+
7
12
  ## 0.3.0 (2016-10-10)
8
13
 
9
14
  - [feature] Built-in sinatra APP with events API
data/README.md CHANGED
@@ -170,6 +170,8 @@ Some operations are instrumented using [Phobos::Instrumentation](https://github.
170
170
  #### Handler notifications
171
171
 
172
172
  Overview of the built in notifications:
173
+ * `db_checkpoint.event_already_exists_check` is sent when the event has been queried for existence in the database
174
+ * `db_checkpoint.event_action` is sent when the event action has completed
173
175
  * `db_checkpoint.event_acknowledged` is sent when the event is acknowledged (saved)
174
176
  * `db_checkpoint.event_skipped` is sent when the event is skipped (not saved)
175
177
  * `db_checkpoint.event_already_consumed` is sent when the handler receives an existing message (not saved)
@@ -29,7 +29,7 @@ module PhobosDBCheckpoint
29
29
  end
30
30
 
31
31
  def load_db_config(pool_size: nil)
32
- @db_config_path ||= DEFAULT_DB_CONFIG_PATH
32
+ @db_config_path ||= ENV['DB_CONFIG'] || DEFAULT_DB_CONFIG_PATH
33
33
  configs = YAML.load_file(File.expand_path(@db_config_path))
34
34
  @db_config = configs[env]
35
35
 
@@ -21,13 +21,18 @@ module PhobosDBCheckpoint
21
21
  payload: payload
22
22
  )
23
23
 
24
- event_metadata = {checksum: event.checksum}.merge(metadata)
25
- if event.exists?
24
+ event_metadata = { checksum: event.checksum }.merge(metadata)
25
+
26
+ event_exists = instrument('db_checkpoint.event_already_exists_check', event_metadata) { event.exists? }
27
+ if event_exists
26
28
  instrument('db_checkpoint.event_already_consumed', event_metadata)
27
29
  return
28
30
  end
29
31
 
30
- event_action = yield
32
+ event_action = instrument('db_checkpoint.event_action', event_metadata) do
33
+ yield
34
+ end
35
+
31
36
  case event_action
32
37
  when PhobosDBCheckpoint::Ack
33
38
  instrument('db_checkpoint.event_acknowledged', event_metadata) do
@@ -1,3 +1,3 @@
1
1
  module PhobosDBCheckpoint
2
- VERSION = '0.3.0'
2
+ VERSION = '0.4.0'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: phobos_db_checkpoint
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Túlio Ornelas
@@ -13,7 +13,7 @@ authors:
13
13
  autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
- date: 2016-10-10 00:00:00.000000000 Z
16
+ date: 2016-12-28 00:00:00.000000000 Z
17
17
  dependencies:
18
18
  - !ruby/object:Gem::Dependency
19
19
  name: bundler