-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathyabeda_configurer.rb
91 lines (78 loc) · 3.04 KB
/
yabeda_configurer.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
# frozen_string_literal: true
module Sbmt
module KafkaConsumer
class YabedaConfigurer
SIZE_BUCKETS = [1, 10, 100, 1000, 10_000, 100_000, 1_000_000].freeze
LATENCY_BUCKETS = [0.0001, 0.001, 0.01, 0.1, 1.0, 10, 100, 1000].freeze
DELAY_BUCKETS = [1, 3, 10, 30, 100, 300, 1000, 3000, 10_000, 30_000].freeze
def self.configure
Yabeda.configure do
group :kafka_api do
counter :calls,
tags: %i[client broker api],
comment: "API calls"
histogram :latency,
tags: %i[client broker api],
buckets: LATENCY_BUCKETS,
comment: "API latency"
histogram :request_size,
tags: %i[client broker api],
buckets: SIZE_BUCKETS,
comment: "API request size"
histogram :response_size,
tags: %i[client broker api],
buckets: SIZE_BUCKETS,
comment: "API response size"
counter :errors,
tags: %i[client broker api],
comment: "API errors"
end
group :kafka_consumer do
counter :consumer_group_rebalances,
tags: %i[client group_id state],
comment: "Consumer group rebalances"
counter :process_messages,
tags: %i[client group_id topic partition],
comment: "Messages consumed"
counter :process_message_errors,
tags: %i[client group_id topic partition],
comment: "Messages failed to process"
histogram :process_message_latency,
tags: %i[client group_id topic partition],
buckets: LATENCY_BUCKETS,
comment: "Consumer latency"
gauge :offset_lag,
tags: %i[client group_id topic partition],
comment: "Consumer offset lag"
gauge :time_lag,
tags: %i[client group_id topic partition],
comment: "Consumer time lag"
counter :process_batch_errors,
tags: %i[client group_id topic partition],
comment: "Messages failed to process"
histogram :process_batch_latency,
tags: %i[client group_id topic partition],
buckets: LATENCY_BUCKETS,
comment: "Consumer batch latency"
histogram :batch_size,
tags: %i[client group_id topic partition],
buckets: SIZE_BUCKETS,
comment: "Consumer batch size"
counter :leave_group_errors,
tags: %i[client group_id],
comment: "Consumer group leave errors"
gauge :pause_duration,
tags: %i[client group_id topic partition],
comment: "Consumer pause duration"
counter :inbox_consumes,
tags: %i[
client group_id topic partition
inbox_name event_name status
],
comment: "Inbox item consumes"
end
end
end
end
end
end