1use lazy_static::lazy_static;
18use prometheus::*;
19
20lazy_static! {
21 pub static ref METRIC_FLOW_TASK_COUNT: IntGauge =
22 register_int_gauge!("greptime_flow_task_count", "flow task count").unwrap();
23 pub static ref METRIC_FLOW_INPUT_BUF_SIZE: IntGauge =
24 register_int_gauge!("greptime_flow_input_buf_size", "flow input buf size").unwrap();
25 pub static ref METRIC_FLOW_INSERT_ELAPSED: HistogramVec = register_histogram_vec!(
26 "greptime_flow_insert_elapsed",
27 "flow insert elapsed",
28 &["table_id"]
29 )
30 .unwrap();
31 pub static ref METRIC_FLOW_BATCHING_ENGINE_QUERY_TIME: HistogramVec = register_histogram_vec!(
32 "greptime_flow_batching_engine_query_time_secs",
33 "flow batching engine query time(seconds)",
34 &["flow_id"],
35 vec![0.0, 5., 10., 20., 40., 80., 160., 320., 640.,]
36 )
37 .unwrap();
38 pub static ref METRIC_FLOW_BATCHING_ENGINE_SLOW_QUERY: HistogramVec = register_histogram_vec!(
39 "greptime_flow_batching_engine_slow_query_secs",
40 "flow batching engine slow query(seconds)",
41 &["flow_id", "peer"],
42 vec![60., 2. * 60., 3. * 60., 5. * 60., 10. * 60.]
43 )
44 .unwrap();
45 pub static ref METRIC_FLOW_BATCHING_ENGINE_QUERY_WINDOW_CNT: HistogramVec =
46 register_histogram_vec!(
47 "greptime_flow_batching_engine_query_window_cnt",
48 "flow batching engine query time window count",
49 &["flow_id"],
50 vec![0.0, 5., 10., 20., 40.]
51 )
52 .unwrap();
53 pub static ref METRIC_FLOW_BATCHING_ENGINE_QUERY_WINDOW_SIZE: HistogramVec =
54 register_histogram_vec!(
55 "greptime_flow_batching_engine_query_window_size_secs",
56 "flow batching engine query window size(seconds)",
57 &["flow_id"],
58 vec![60., 4. * 60., 16. * 60., 64. * 60., 256. * 60.]
59 )
60 .unwrap();
61 pub static ref METRIC_FLOW_BATCHING_ENGINE_STALLED_WINDOW_SIZE: HistogramVec =
62 register_histogram_vec!(
63 "greptime_flow_batching_engine_stalled_window_size_secs",
64 "flow batching engine stalled window size(seconds)",
65 &["flow_id"],
66 vec![60., 4. * 60., 16. * 60., 64. * 60., 256. * 60.]
67 )
68 .unwrap();
69 pub static ref METRIC_FLOW_BATCHING_ENGINE_BULK_MARK_TIME_WINDOW: GaugeVec =
70 register_gauge_vec!(
71 "greptime_flow_batching_engine_bulk_mark_time_window",
72 "flow batching engine query time window count marked by bulk inserts",
73 &["flow_id"],
74 )
75 .unwrap();
76 pub static ref METRIC_FLOW_BATCHING_ENGINE_START_QUERY_CNT: IntCounterVec =
77 register_int_counter_vec!(
78 "greptime_flow_batching_start_query_count",
79 "flow batching engine started query count",
80 &["flow_id"],
81 )
82 .unwrap();
83 pub static ref METRIC_FLOW_BATCHING_ENGINE_ERROR_CNT: IntCounterVec =
84 register_int_counter_vec!(
85 "greptime_flow_batching_error_count",
86 "flow batching engine error count per flow id",
87 &["flow_id"],
88 )
89 .unwrap();
90 pub static ref METRIC_FLOW_RUN_INTERVAL_MS: IntGauge =
91 register_int_gauge!("greptime_flow_run_interval_ms", "flow run interval in ms").unwrap();
92 pub static ref METRIC_FLOW_ROWS: IntCounterVec = register_int_counter_vec!(
93 "greptime_flow_processed_rows",
94 "Count of rows flowing through the system.",
95 &["direction"]
96 )
97 .unwrap();
98 pub static ref METRIC_FLOW_PROCESSING_TIME: HistogramVec = register_histogram_vec!(
99 "greptime_flow_processing_time",
100 "Time spent processing requests",
101 &["type"]
102 )
103 .unwrap();
104 pub static ref METRIC_FLOW_ERRORS: IntCounterVec = register_int_counter_vec!(
105 "greptime_flow_errors",
106 "Count of errors in flow processing",
107 &["code"]
108 )
109 .unwrap();
110}