harness-active_publisher 0.5.0 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/harness-active_publisher.gemspec +1 -1
- data/lib/harness/active_publisher.rb +24 -20
- data/lib/harness/active_publisher/version.rb +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2c8406c4436e248e55c89fba264833993ab57b58
|
4
|
+
data.tar.gz: 820a74e56d4bf6788947babc1d9981657c103bc5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2421be092365302abbb5a8115552b91301b2b0a8a8244d290ec1ccfbafe8c160755791a30fffdad057be0131f989225f1c9c2d1c19c8822c567175a65b1d09e7
|
7
|
+
data.tar.gz: ff6d94490814361e6c25698d4444d3e71c1b582e7de8cb173f7ef13571a3448f758e365f0bc7bc68437369c0ccce1dcb287d5c9b0bbe541e2cbab33dc04b1400
|
@@ -24,7 +24,7 @@ Gem::Specification.new do |spec|
|
|
24
24
|
spec.add_runtime_dependency "activesupport", ">= 3.2"
|
25
25
|
spec.add_runtime_dependency "harness", ">= 2.0.0"
|
26
26
|
|
27
|
-
spec.add_development_dependency "bundler"
|
27
|
+
spec.add_development_dependency "bundler"
|
28
28
|
spec.add_development_dependency "rake", "~> 10.0"
|
29
29
|
spec.add_development_dependency "rspec", "~> 3.0"
|
30
30
|
end
|
@@ -3,28 +3,32 @@ require "harness/active_publisher/version"
|
|
3
3
|
require "harness"
|
4
4
|
require "active_support"
|
5
5
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
6
|
+
module Harness
|
7
|
+
module ActivePublisher
|
8
|
+
DROPPED_METRIC = ["active_publisher", ENV["SERVICE_NAME"], "message_dropped"].reject(&:nil?).join(".").freeze
|
9
|
+
LATENCY_METRIC = ["active_publisher", ENV["SERVICE_NAME"], "publish_latency"].reject(&:nil?).join(".").freeze
|
10
|
+
PUBLISHED_METRIC = ["active_publisher", ENV["SERVICE_NAME"], "messages_published"].reject(&:nil?).join(".").freeze
|
11
|
+
QUEUE_SIZE_METRIC = ["active_publisher", ENV["SERVICE_NAME"], "async_queue_size"].reject(&:nil?).join(".").freeze
|
12
|
+
WAIT_METRIC = ["active_publisher", ENV["SERVICE_NAME"], "waiting_for_async_queue"].reject(&:nil?).join(".").freeze
|
11
13
|
|
12
|
-
::ActiveSupport::Notifications.subscribe "async_queue_size.active_publisher" do |_, _, _, _, async_queue_size|
|
13
|
-
|
14
|
-
end
|
14
|
+
::ActiveSupport::Notifications.subscribe "async_queue_size.active_publisher" do |_, _, _, _, async_queue_size|
|
15
|
+
::Harness.gauge QUEUE_SIZE_METRIC, async_queue_size
|
16
|
+
end
|
15
17
|
|
16
|
-
::ActiveSupport::Notifications.subscribe "message_dropped.active_publisher" do
|
17
|
-
|
18
|
-
end
|
18
|
+
::ActiveSupport::Notifications.subscribe "message_dropped.active_publisher" do
|
19
|
+
::Harness.increment DROPPED_METRIC
|
20
|
+
end
|
19
21
|
|
20
|
-
::ActiveSupport::Notifications.subscribe "message_published.active_publisher" do |*args|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
end
|
22
|
+
::ActiveSupport::Notifications.subscribe "message_published.active_publisher" do |*args|
|
23
|
+
event = ::ActiveSupport::Notifications::Event.new(*args)
|
24
|
+
message_count = event.payload.fetch(:message_count, 1)
|
25
|
+
::Harness.count PUBLISHED_METRIC, message_count
|
26
|
+
::Harness.timing LATENCY_METRIC, event.duration
|
27
|
+
end
|
26
28
|
|
27
|
-
::ActiveSupport::Notifications.subscribe "wait_for_async_queue.active_publisher" do |*args|
|
28
|
-
|
29
|
-
|
29
|
+
::ActiveSupport::Notifications.subscribe "wait_for_async_queue.active_publisher" do |*args|
|
30
|
+
event = ::ActiveSupport::Notifications::Event.new(*args)
|
31
|
+
::Harness.timing WAIT_METRIC, event.duration
|
32
|
+
end
|
33
|
+
end
|
30
34
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: harness-active_publisher
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Ries
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-12-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -42,16 +42,16 @@ dependencies:
|
|
42
42
|
name: bundler
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - "
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
47
|
+
version: '0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - "
|
52
|
+
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
54
|
+
version: '0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rake
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|