1use lazy_static::lazy_static;
16use prometheus::*;
17
18pub const TABLE_TYPE_PHYSICAL: &str = "physical";
19pub const TABLE_TYPE_LOGICAL: &str = "logical";
20pub const ERROR_TYPE_RETRYABLE: &str = "retryable";
21pub const ERROR_TYPE_EXTERNAL: &str = "external";
22pub const STATS_TYPE_NO_REGION_METADATA: &str = "no_region_metadata";
23pub const STATS_TYPE_REGION_NOT_OPEN: &str = "region_not_open";
24
25lazy_static! {
26 pub static ref METRIC_META_TXN_REQUEST: HistogramVec = register_histogram_vec!(
27 "greptime_meta_txn_request",
28 "meta txn request",
29 &["target", "op"]
30 )
31 .unwrap();
32 pub static ref METRIC_META_CREATE_CATALOG: Histogram =
33 register_histogram!("greptime_meta_create_catalog", "meta create catalog").unwrap();
34 pub static ref METRIC_META_CREATE_CATALOG_COUNTER: IntCounter = register_int_counter!(
35 "greptime_meta_create_catalog_counter",
36 "meta create catalog"
37 )
38 .unwrap();
39 pub static ref METRIC_META_CREATE_SCHEMA: Histogram =
40 register_histogram!("greptime_meta_create_schema", "meta create schema").unwrap();
41 pub static ref METRIC_META_CREATE_SCHEMA_COUNTER: IntCounter =
42 register_int_counter!("greptime_meta_create_schema_counter", "meta create schema").unwrap();
43 pub static ref METRIC_META_PROCEDURE_CREATE_TABLE: HistogramVec = register_histogram_vec!(
44 "greptime_meta_procedure_create_table",
45 "meta procedure create table",
46 &["step"]
47 )
48 .unwrap();
49 pub static ref METRIC_META_PROCEDURE_CREATE_VIEW: HistogramVec = register_histogram_vec!(
50 "greptime_meta_procedure_create_view",
51 "meta procedure create view",
52 &["step"]
53 )
54 .unwrap();
55 pub static ref METRIC_META_PROCEDURE_CREATE_FLOW: HistogramVec = register_histogram_vec!(
56 "greptime_meta_procedure_create_flow",
57 "meta procedure create flow",
58 &["step"]
59 )
60 .unwrap();
61 pub static ref METRIC_META_PROCEDURE_DROP_FLOW: HistogramVec = register_histogram_vec!(
62 "greptime_meta_procedure_drop_flow",
63 "meta procedure drop flow",
64 &["step"]
65 )
66 .unwrap();
67 pub static ref METRIC_META_PROCEDURE_DROP_VIEW: HistogramVec = register_histogram_vec!(
68 "greptime_meta_procedure_drop_view",
69 "meta procedure drop view",
70 &["step"]
71 )
72 .unwrap();
73 pub static ref METRIC_META_PROCEDURE_CREATE_TABLES: HistogramVec = register_histogram_vec!(
74 "greptime_meta_procedure_create_tables",
75 "meta procedure create tables",
76 &["step"]
77 )
78 .unwrap();
79 pub static ref METRIC_META_PROCEDURE_DROP_TABLE: HistogramVec = register_histogram_vec!(
80 "greptime_meta_procedure_drop_table",
81 "meta procedure drop table",
82 &["step"]
83 )
84 .unwrap();
85 pub static ref METRIC_META_PROCEDURE_ALTER_TABLE: HistogramVec = register_histogram_vec!(
86 "greptime_meta_procedure_alter_table",
87 "meta procedure alter table",
88 &["step"]
89 )
90 .unwrap();
91 pub static ref METRIC_META_PROCEDURE_TRUNCATE_TABLE: HistogramVec = register_histogram_vec!(
92 "greptime_meta_procedure_truncate_table",
93 "meta procedure truncate table",
94 &["step"]
95 )
96 .unwrap();
97 pub static ref CACHE_CONTAINER_CACHE_GET: IntCounterVec = register_int_counter_vec!(
99 "greptime_meta_cache_container_cache_get",
100 "cache container cache get",
101 &["name"]
102 )
103 .unwrap();
104 pub static ref CACHE_CONTAINER_CACHE_MISS: IntCounterVec = register_int_counter_vec!(
106 "greptime_meta_cache_container_cache_miss",
107 "cache container cache miss",
108 &["name"]
109 )
110 .unwrap();
111 pub static ref CACHE_CONTAINER_LOAD_CACHE: HistogramVec = register_histogram_vec!(
113 "greptime_meta_cache_container_load_cache",
114 "cache container load cache",
115 &["name"]
116 )
117 .unwrap();
118 pub static ref RDS_SQL_EXECUTE_ELAPSED: HistogramVec = register_histogram_vec!(
119 "greptime_meta_rds_pg_sql_execute_elapsed_ms",
120 "rds pg sql execute elapsed",
121 &["backend", "result", "op", "type"]
122 )
123 .unwrap();
124 pub static ref METRIC_META_RECONCILIATION_LIST_REGION_METADATA_DURATION: HistogramVec =
125 register_histogram_vec!(
126 "greptime_meta_reconciliation_list_region_metadata_duration",
127 "reconciliation list region metadata duration",
128 &["table_type"]
129 )
130 .unwrap();
131 pub static ref METRIC_META_RECONCILIATION_RESOLVED_COLUMN_METADATA: IntCounterVec =
132 register_int_counter_vec!(
133 "greptime_meta_reconciliation_resolved_column_metadata",
134 "reconciliation resolved column metadata",
135 &["strategy"]
136 )
137 .unwrap();
138 pub static ref METRIC_META_RECONCILIATION_STATS: IntCounterVec =
139 register_int_counter_vec!(
140 "greptime_meta_reconciliation_stats",
141 "reconciliation stats",
142 &["procedure_name", "table_type", "type"]
143 )
144 .unwrap();
145 pub static ref METRIC_META_RECONCILIATION_PROCEDURE: HistogramVec =
146 register_histogram_vec!(
147 "greptime_meta_reconciliation_procedure",
148 "reconcile table procedure",
149 &["procedure_name", "step"]
150 )
151 .unwrap();
152 pub static ref METRIC_META_RECONCILIATION_PROCEDURE_ERROR: IntCounterVec =
153 register_int_counter_vec!(
154 "greptime_meta_reconciliation_procedure_error",
155 "reconciliation procedure error",
156 &["procedure_name", "step", "error_type"]
157 )
158 .unwrap();
159}