promenade 0.9.0 → 0.10.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +2 -2
- data/lib/promenade/version.rb +1 -1
- data/lib/promenade/waterdrop/error_subscriber.rb +27 -0
- data/lib/promenade/waterdrop/message_subscriber.rb +48 -0
- data/lib/promenade/waterdrop/statistics_subscriber.rb +94 -0
- data/lib/promenade/waterdrop/subscriber.rb +8 -0
- data/lib/promenade/waterdrop.rb +3 -0
- metadata +8 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 74c2f57f687ffba42cadfb976e0132ff7396568802cdafe06cd3386dc824be6d
|
4
|
+
data.tar.gz: 021cea56c7dacde62e90c2b638796dfb995b95ea64e6a9dd811c1f8e656f3a02
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aa1e090da77fc3546b24dd57f6494beed29c11641cae29acc6f914e04140d06c058d00f2eb20a39e37a6c510a3451f4fd2b229267cd9835f8d3d204632f513b2
|
7
|
+
data.tar.gz: 90b71c399a0d107ee01334a011f0a253acbb5d71ad3fedd809cb7956587e241f4dfceb728077799665e08365c396ef0a9e7072828ac1c5bbabc1b8fcdaf37fcb
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
promenade (0.
|
4
|
+
promenade (0.10.0)
|
5
5
|
actionpack
|
6
6
|
activesupport (> 6.0, < 8.0)
|
7
7
|
prometheus-client-mmap (~> 0.16.0)
|
@@ -123,7 +123,7 @@ GEM
|
|
123
123
|
ast (~> 2.4.1)
|
124
124
|
prometheus-client-mmap (0.16.2)
|
125
125
|
racc (1.6.2)
|
126
|
-
rack (2.2.6.
|
126
|
+
rack (2.2.6.3)
|
127
127
|
rack-test (2.0.2)
|
128
128
|
rack (>= 1.3)
|
129
129
|
rails (7.0.4.2)
|
data/lib/promenade/version.rb
CHANGED
@@ -0,0 +1,27 @@
|
|
1
|
+
require "promenade/waterdrop/subscriber"
|
2
|
+
|
3
|
+
module Promenade
|
4
|
+
module Waterdrop
|
5
|
+
class ErrorSubscriber < Subscriber
|
6
|
+
attach_to "error.waterdrop"
|
7
|
+
|
8
|
+
Promenade.counter :waterdrop_errors_total do
|
9
|
+
doc "Count of Waterdrop errors"
|
10
|
+
end
|
11
|
+
|
12
|
+
def occurred(event)
|
13
|
+
labels = get_labels(event)
|
14
|
+
|
15
|
+
Promenade.metric(:waterdrop_errors_total).increment(labels)
|
16
|
+
end
|
17
|
+
|
18
|
+
private
|
19
|
+
|
20
|
+
def get_labels(event)
|
21
|
+
{
|
22
|
+
error_type: event.payload[:type],
|
23
|
+
}
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
require "promenade/waterdrop/subscriber"
|
2
|
+
|
3
|
+
module Promenade
|
4
|
+
module Waterdrop
|
5
|
+
class MessageSubscriber < Subscriber
|
6
|
+
attach_to "message.waterdrop"
|
7
|
+
|
8
|
+
Promenade.counter :waterdrop_producer_messages_total do
|
9
|
+
doc "Number of messages written to Kafka producer"
|
10
|
+
end
|
11
|
+
|
12
|
+
Promenade.counter :waterdrop_producer_ack_messages_total do
|
13
|
+
doc "Count of the number of messages Acked by Kafka"
|
14
|
+
end
|
15
|
+
|
16
|
+
def produced_async(event)
|
17
|
+
Promenade.metric(
|
18
|
+
:waterdrop_producer_messages_total,
|
19
|
+
).increment(get_labels(event).merge(producer_type: "async"))
|
20
|
+
end
|
21
|
+
|
22
|
+
def produced_sync(event)
|
23
|
+
Promenade.metric(
|
24
|
+
:waterdrop_producer_messages_total,
|
25
|
+
).increment(get_labels(event).merge(producer_type: "sync"))
|
26
|
+
end
|
27
|
+
|
28
|
+
def acknowledged(event)
|
29
|
+
labels = {
|
30
|
+
client: event.payload[:producer_id],
|
31
|
+
}
|
32
|
+
|
33
|
+
Promenade.metric(:waterdrop_producer_ack_messages_total).increment(labels)
|
34
|
+
end
|
35
|
+
|
36
|
+
private
|
37
|
+
|
38
|
+
def get_labels(event)
|
39
|
+
payload = event.payload
|
40
|
+
|
41
|
+
{
|
42
|
+
client: payload[:producer_id],
|
43
|
+
topic: event.payload[:message][:topic],
|
44
|
+
}
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
@@ -0,0 +1,94 @@
|
|
1
|
+
require "promenade/waterdrop/subscriber"
|
2
|
+
require "active_support/core_ext/hash"
|
3
|
+
|
4
|
+
module Promenade
|
5
|
+
module Waterdrop
|
6
|
+
class StatisticsSubscriber < Subscriber
|
7
|
+
attach_to "statistics.waterdrop"
|
8
|
+
|
9
|
+
Promenade.histogram :waterdrop_producer_message_size do
|
10
|
+
doc "Historgram of message sizes written to Kafka producer"
|
11
|
+
buckets :memory
|
12
|
+
end
|
13
|
+
|
14
|
+
Promenade.counter :waterdrop_producer_delivered_messages do
|
15
|
+
doc "A count of the total messages delivered to Kafka"
|
16
|
+
end
|
17
|
+
|
18
|
+
Promenade.histogram :waterdrop_producer_delivery_attempts do
|
19
|
+
doc "A count of the total message deliveries attempted"
|
20
|
+
buckets [0, 6, 12, 18, 24, 30]
|
21
|
+
end
|
22
|
+
|
23
|
+
Promenade.histogram :waterdrop_producer_ack_latency_seconds do
|
24
|
+
doc "Delay between message being produced and Acked in seconds"
|
25
|
+
buckets :network
|
26
|
+
end
|
27
|
+
|
28
|
+
Promenade.gauge :waterdrop_async_producer_queue_size do
|
29
|
+
doc "Size of Kafka async producer queue"
|
30
|
+
end
|
31
|
+
|
32
|
+
Promenade.gauge :waterdrop_async_producer_max_queue_size do
|
33
|
+
doc "Max size of Kafka async producer queue"
|
34
|
+
end
|
35
|
+
|
36
|
+
Promenade.gauge :waterdrop_async_producer_queue_fill_ratio do
|
37
|
+
doc "Size of Kafka async producer queue"
|
38
|
+
end
|
39
|
+
|
40
|
+
Promenade.counter :waterdrop_async_producer_dropped_messages do
|
41
|
+
doc "Count of dropped messages"
|
42
|
+
end
|
43
|
+
|
44
|
+
def emitted(event)
|
45
|
+
statistics = event.payload[:statistics].with_indifferent_access
|
46
|
+
labels = get_labels(statistics)
|
47
|
+
|
48
|
+
report_root_metrics(statistics, labels)
|
49
|
+
report_broker_metrics(statistics[:brokers], labels)
|
50
|
+
end
|
51
|
+
|
52
|
+
private
|
53
|
+
|
54
|
+
def report_root_metrics(statistics, labels)
|
55
|
+
queue_size = statistics[:msg_cnt]
|
56
|
+
max_queue_size = statistics[:msg_max]
|
57
|
+
message_size = statistics[:msg_size]
|
58
|
+
delivered_messages = statistics[:txmsgs]
|
59
|
+
queue_fill_ratio = queue_size.to_f / max_queue_size
|
60
|
+
|
61
|
+
Promenade.metric(:waterdrop_async_producer_queue_size).set(labels, queue_size)
|
62
|
+
Promenade.metric(:waterdrop_async_producer_max_queue_size).set(labels, max_queue_size)
|
63
|
+
Promenade.metric(:waterdrop_async_producer_queue_fill_ratio).set(labels, queue_fill_ratio)
|
64
|
+
Promenade.metric(:waterdrop_producer_message_size).observe(labels, message_size)
|
65
|
+
Promenade.metric(:waterdrop_producer_delivered_messages).increment(labels, delivered_messages)
|
66
|
+
end
|
67
|
+
|
68
|
+
def report_broker_metrics(brokers, labels)
|
69
|
+
brokers.map do |broker_name, broker_values|
|
70
|
+
next if broker_values[:nodeid] == -1
|
71
|
+
|
72
|
+
attempts = broker_values[:txretries]
|
73
|
+
ack_latency = convert_microseconds_to_seconds(broker_values[:rtt][:avg])
|
74
|
+
broker_labels = {
|
75
|
+
broker_id: broker_name,
|
76
|
+
}
|
77
|
+
|
78
|
+
Promenade.metric(:waterdrop_producer_delivery_attempts).observe(labels.merge(broker_labels), attempts)
|
79
|
+
Promenade.metric(:waterdrop_producer_ack_latency_seconds).observe(labels, ack_latency)
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
def get_labels(statistics)
|
84
|
+
{
|
85
|
+
client: statistics[:client_id],
|
86
|
+
}
|
87
|
+
end
|
88
|
+
|
89
|
+
def convert_microseconds_to_seconds(time_in_microseconds)
|
90
|
+
time_in_microseconds / 1_000_000.to_f
|
91
|
+
end
|
92
|
+
end
|
93
|
+
end
|
94
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: promenade
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.10.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ed Robinson
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-03-
|
11
|
+
date: 2023-03-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: actionpack
|
@@ -297,6 +297,11 @@ files:
|
|
297
297
|
- lib/promenade/railtie.rb
|
298
298
|
- lib/promenade/setup.rb
|
299
299
|
- lib/promenade/version.rb
|
300
|
+
- lib/promenade/waterdrop.rb
|
301
|
+
- lib/promenade/waterdrop/error_subscriber.rb
|
302
|
+
- lib/promenade/waterdrop/message_subscriber.rb
|
303
|
+
- lib/promenade/waterdrop/statistics_subscriber.rb
|
304
|
+
- lib/promenade/waterdrop/subscriber.rb
|
300
305
|
- promenade.gemspec
|
301
306
|
homepage: https://github.com/errm/promenade
|
302
307
|
licenses:
|
@@ -318,7 +323,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
318
323
|
- !ruby/object:Gem::Version
|
319
324
|
version: '0'
|
320
325
|
requirements: []
|
321
|
-
rubygems_version: 3.
|
326
|
+
rubygems_version: 3.2.32
|
322
327
|
signing_key:
|
323
328
|
specification_version: 4
|
324
329
|
summary: Promenade makes it simple to instrument Ruby apps for prometheus scraping
|