deimos-ruby 1.3.0.pre.beta4 → 1.3.0.pre.beta5

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
  SHA256:
3
- metadata.gz: 9f45c9dfd2ee1104f6f2959358c9d60892c77ff881da57333023869ecde5e7fe
4
- data.tar.gz: 3a5d8b16495d169028b660e15c91449ec4484dda40a8f84c2a520fcf580edc62
3
+ metadata.gz: 5bf921e758c4cab2c5d35334e1f7dc99382ce414ce1c7492d42175f4c874ae54
4
+ data.tar.gz: f1d2c561854e12adf325ee3a6805f3ddac40f185fe5420932438e38ffee43688
5
5
  SHA512:
6
- metadata.gz: b61f02c57a6c6b53673a46a648d239aa9b72a13aa5df047e6372cac11e0ed035bf8f5251a710d19bb744176da3ff1c742b5a3a806dc069151ee4dcee366cdce7
7
- data.tar.gz: a1cdb60928f9e1e9dd72677b2d7aaa5c04131b28ca084bd98126225a69e3af2d19d8a101f2dd1ded5aab143a6f562a6833d6dc310438ed775e82e05ff143223a
6
+ metadata.gz: b9fe23ad5ecb545ad6a8743bfd5bfb735d9b7d672ae5dfee16d2456b02397c7f8ef3adc71a43a4043aa02974bfa1d6a7a60cd373e8f522e03eba739e877c82cb
7
+ data.tar.gz: df9ea2796a368360ff79ada8735060f7585408d7c59043b488a31bf9fcbb4e7bcd52017882f2f458b8b48d30ff8807e93c640820fef264d859bc1be329bb668e
data/CHANGELOG.md CHANGED
@@ -7,6 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## UNRELEASED
9
9
 
10
+ # [1.3.0-beta5] - 2020-01-14
11
+ - Added `db_producer.insert` and `db_producer.process` metrics.
12
+
10
13
  # [1.3.0-beta4] - 2019-12-02
11
14
  - Fixed bug where by running `rake deimos:start` without
12
15
  specifying a producer backend would crash.
data/Gemfile.lock CHANGED
@@ -74,7 +74,7 @@ GEM
74
74
  digest-crc (0.4.1)
75
75
  dogstatsd-ruby (4.2.0)
76
76
  erubi (1.9.0)
77
- excon (0.69.1)
77
+ excon (0.71.0)
78
78
  exponential-backoff (0.0.4)
79
79
  ffi (1.11.1)
80
80
  formatador (0.2.5)
data/README.md CHANGED
@@ -693,6 +693,11 @@ The following metrics are reported:
693
693
  with the database backend. Tagged with the topic that is waiting.
694
694
  Will send a value of 0 with no topics tagged if there are no messages
695
695
  waiting.
696
+ * `db_producer.insert` - the number of messages inserted into the database
697
+ for publishing. Tagged with `topic:{topic_name}`
698
+ * `db_producer.process` - the number of DB messages processed. Note that this
699
+ is *not* the same as the number of messages *published* if those messages
700
+ are compacted. Tagged with `topic:{topic_name}`
696
701
 
697
702
  ### Configuring Metrics Providers
698
703
 
@@ -20,6 +20,11 @@ module Deimos
20
20
  message
21
21
  end
22
22
  Deimos::KafkaMessage.import(records)
23
+ Deimos.config.metrics&.increment(
24
+ 'db_producer.insert',
25
+ tags: %W(topic:#{producer_class.topic}),
26
+ by: records.size
27
+ )
23
28
  end
24
29
  end
25
30
  end
@@ -93,6 +93,11 @@ module Deimos
93
93
  end
94
94
  end
95
95
  Deimos::KafkaMessage.where(id: messages.map(&:id)).delete_all
96
+ Deimos.config.metrics&.increment(
97
+ 'db_producer.process',
98
+ tags: %W(topic:#{@current_topic}),
99
+ by: messages.size
100
+ )
96
101
  return false if batch_size < BATCH_SIZE
97
102
 
98
103
  KafkaTopicInfo.heartbeat(@current_topic, @id) # keep alive
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Deimos
4
- VERSION = '1.3.0-beta4'
4
+ VERSION = '1.3.0-beta5'
5
5
  end
@@ -4,6 +4,11 @@ each_db_config(Deimos::Backends::Db) do
4
4
  include_context 'with publish_backend'
5
5
 
6
6
  it 'should save to the database' do
7
+ expect(Deimos.config.metrics).to receive(:increment).with(
8
+ 'db_producer.insert',
9
+ tags: %w(topic:my-topic),
10
+ by: 3
11
+ )
7
12
  described_class.publish(producer_class: MyProducer, messages: messages)
8
13
  records = Deimos::KafkaMessage.all
9
14
  expect(records.size).to eq(3)
@@ -192,6 +192,11 @@ each_db_config(Deimos::Utils::DbProducer) do
192
192
  topic: 'my-topic'
193
193
  }
194
194
  ])
195
+ expect(Deimos.config.metrics).to receive(:increment).ordered.with(
196
+ 'db_producer.process',
197
+ tags: %w(topic:my-topic),
198
+ by: 2
199
+ )
195
200
  expect(producer).to receive(:retrieve_messages).ordered.
196
201
  and_return(messages[2..3])
197
202
  expect(producer).to receive(:produce_messages).ordered.with([
@@ -208,6 +213,11 @@ each_db_config(Deimos::Utils::DbProducer) do
208
213
  topic: 'my-topic'
209
214
  }
210
215
  ])
216
+ expect(Deimos.config.metrics).to receive(:increment).ordered.with(
217
+ 'db_producer.process',
218
+ tags: %w(topic:my-topic),
219
+ by: 2
220
+ )
211
221
  expect(producer).to receive(:retrieve_messages).ordered.
212
222
  and_return([])
213
223
  expect(Deimos::KafkaTopicInfo).to receive(:heartbeat).
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: deimos-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0.pre.beta4
4
+ version: 1.3.0.pre.beta5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Orner
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-12-02 00:00:00.000000000 Z
11
+ date: 2020-01-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: avro-patches