1use lazy_static::lazy_static;
16use prometheus::*;
17
18pub const LOGSTORE_LABEL: &str = "logstore";
20pub const OPTYPE_LABEL: &str = "optype";
22pub const TOPIC_LABEL: &str = "topic";
24pub const PARTITION_LABEL: &str = "partition";
26
27lazy_static! {
28 pub static ref METRIC_LOGSTORE_OP_BYTES_TOTAL: IntCounterVec = register_int_counter_vec!(
30 "greptime_logstore_op_bytes_total",
31 "logstore operation bytes total",
32 &[LOGSTORE_LABEL, OPTYPE_LABEL],
33 )
34 .unwrap();
35 pub static ref METRIC_KAFKA_APPEND_BATCH_BYTES_TOTAL: IntCounter = METRIC_LOGSTORE_OP_BYTES_TOTAL.with_label_values(
37 &["kafka", "append_batch"],
38 );
39 pub static ref METRIC_KAFKA_READ_BYTES_TOTAL: IntCounter = METRIC_LOGSTORE_OP_BYTES_TOTAL.with_label_values(
41 &["kafka", "read"],
42 );
43 pub static ref METRIC_RAFT_ENGINE_APPEND_BATCH_BYTES_TOTAL: IntCounter = METRIC_LOGSTORE_OP_BYTES_TOTAL.with_label_values(
45 &["raft-engine", "append_batch"],
46 );
47 pub static ref METRIC_RAFT_ENGINE_READ_BYTES_TOTAL: IntCounter = METRIC_LOGSTORE_OP_BYTES_TOTAL.with_label_values(
49 &["raft-engine", "read"],
50 );
51
52 pub static ref METRIC_LOGSTORE_OP_ELAPSED: HistogramVec = register_histogram_vec!(
54 "greptime_logstore_op_elapsed",
55 "logstore operation elapsed",
56 &[LOGSTORE_LABEL, OPTYPE_LABEL],
57 )
58 .unwrap();
59 pub static ref METRIC_KAFKA_APPEND_BATCH_ELAPSED: Histogram = METRIC_LOGSTORE_OP_ELAPSED.with_label_values(&["kafka", "append_batch"]);
61 pub static ref METRIC_KAFKA_READ_ELAPSED: Histogram = METRIC_LOGSTORE_OP_ELAPSED.with_label_values(&["kafka", "read"]);
64 pub static ref METRIC_RAFT_ENGINE_APPEND_BATCH_ELAPSED: Histogram = METRIC_LOGSTORE_OP_ELAPSED.with_label_values(&["raft-engine", "append_batch"]);
66 pub static ref METRIC_RAFT_ENGINE_READ_ELAPSED: Histogram = METRIC_LOGSTORE_OP_ELAPSED.with_label_values(&["raft-engine", "read"]);
69
70 pub static ref METRIC_KAFKA_CLIENT_BYTES_TOTAL: IntCounterVec = register_int_counter_vec!(
71 "greptime_logstore_kafka_client_bytes_total",
72 "kafka logstore's bytes traffic total",
73 &[LOGSTORE_LABEL, PARTITION_LABEL],
74 )
75 .unwrap();
76 pub static ref METRIC_KAFKA_CLIENT_TRAFFIC_TOTAL: IntCounterVec = register_int_counter_vec!(
77 "greptime_logstore_kafka_client_traffic_total",
78 "kafka logstore's request count traffic total",
79 &[LOGSTORE_LABEL, PARTITION_LABEL],
80 )
81 .unwrap();
82 pub static ref METRIC_KAFKA_CLIENT_PRODUCE_ELAPSED: HistogramVec = register_histogram_vec!(
83 "greptime_logstore_kafka_client_produce_elapsed",
84 "kafka logstore produce operation elapsed",
85 &[LOGSTORE_LABEL, PARTITION_LABEL],
86 )
87 .unwrap();
88}