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
use ore::{
metric,
metrics::{IntCounterVec, MetricsRegistry, UIntGaugeVec},
};
#[derive(Clone)]
pub struct KafkaBaseMetrics {
pub(crate) messages_sent_counter: IntCounterVec,
pub(crate) message_send_errors_counter: IntCounterVec,
pub(crate) message_delivery_errors_counter: IntCounterVec,
pub(crate) rows_queued: UIntGaugeVec,
}
impl KafkaBaseMetrics {
pub(crate) fn register_with(registry: &MetricsRegistry) -> Self {
Self {
messages_sent_counter: registry.register(metric!(
name: "mz_kafka_messages_sent_total",
help: "The number of messages the Kafka producer successfully sent for this sink",
var_labels: ["topic", "sink_id", "worker_id"],
)),
message_send_errors_counter: registry.register(metric!(
name: "mz_kafka_message_send_errors_total",
help: "The number of times the Kafka producer encountered an error on send",
var_labels: ["topic", "sink_id", "worker_id"],
)),
message_delivery_errors_counter: registry.register(metric!(
name: "mz_kafka_message_delivery_errors_total",
help: "The number of messages that the Kafka producer could not deliver to the topic",
var_labels: ["topic", "sink_id", "worker_id"],
)),
rows_queued: registry.register(metric!(
name: "mz_kafka_sink_rows_queued",
help: "The current number of rows queued by the Kafka sink operator (note that one row can generate multiple Kafka messages)",
var_labels: ["topic", "sink_id", "worker_id"],
)),
}
}
}
#[derive(Clone)]
pub struct SinkBaseMetrics {
pub(crate) kafka: KafkaBaseMetrics,
}
impl SinkBaseMetrics {
pub(crate) fn register_with(registry: &MetricsRegistry) -> Self {
Self {
kafka: KafkaBaseMetrics::register_with(registry),
}
}
}