1use lazy_static::lazy_static;
16use prometheus::*;
17
18lazy_static! {
19 pub static ref METRIC_META_KV_REQUEST_ELAPSED: HistogramVec = register_histogram_vec!(
21 "greptime_meta_kv_request_elapsed",
22 "meta kv request",
23 &["target", "op"]
24 )
25 .unwrap();
26 pub static ref METRIC_META_HEARTBEAT_CONNECTION_NUM: IntGauge = register_int_gauge!(
28 "greptime_meta_heartbeat_connection_num",
29 "meta heartbeat connection num"
30 )
31 .unwrap();
32 pub static ref METRIC_META_HANDLER_EXECUTE: HistogramVec =
34 register_histogram_vec!("greptime_meta_handler_execute", "meta handler execute", &["name"]).unwrap();
35 pub static ref METRIC_META_INACTIVE_REGIONS: IntGauge =
37 register_int_gauge!("greptime_meta_inactive_regions", "meta inactive regions").unwrap();
38 pub static ref METRIC_META_LEADER_CACHED_KV_LOAD_ELAPSED: HistogramVec =
40 register_histogram_vec!("greptime_meta_leader_cache_kv_load", "meta load cache", &["prefix"])
41 .unwrap();
42 pub static ref METRIC_META_KV_CACHE_HIT: IntCounterVec =
44 register_int_counter_vec!("greptime_meta_kv_cache_hit", "meta kv cache hit", &["op"]).unwrap();
45 pub static ref METRIC_META_KV_CACHE_MISS: IntCounterVec =
47 register_int_counter_vec!("greptime_meta_kv_cache_miss", "meta kv cache miss", &["op"]).unwrap();
48 pub static ref METRIC_META_HEARTBEAT_RECV: IntCounterVec =
50 register_int_counter_vec!("greptime_meta_heartbeat_recv", "heartbeats received by metasrv", &["pusher_key"]).unwrap();
51 pub static ref METRIC_META_REGION_MIGRATION_EXECUTE: HistogramVec =
53 register_histogram_vec!("greptime_meta_region_migration_execute", "meta region migration execute", &["state"]).unwrap();
54 pub static ref METRIC_META_REGION_MIGRATION_ERROR: IntCounterVec =
56 register_int_counter_vec!("greptime_meta_region_migration_error", "meta region migration abort", &["state", "error_type"]).unwrap();
57 pub static ref METRIC_META_REGION_MIGRATION_DATANODES: IntCounterVec =
59 register_int_counter_vec!("greptime_meta_region_migration_stat", "meta region migration stat", &["datanode_type", "datanode_id"]).unwrap();
60 pub static ref METRIC_META_REGION_MIGRATION_FAIL: IntCounter =
62 register_int_counter!("greptime_meta_region_migration_fail", "meta region migration fail").unwrap();
63 pub static ref METRIC_META_HEARTBEAT_STAT_MEMORY_SIZE: Histogram =
65 register_histogram!("greptime_meta_heartbeat_stat_memory_size", "meta heartbeat stat memory size", vec![
66 100.0, 500.0, 1000.0, 1500.0, 2000.0, 3000.0, 5000.0, 10000.0, 20000.0
67 ]).unwrap();
68 pub static ref METRIC_META_HEARTBEAT_RATE: IntCounter =
70 register_int_counter!("greptime_meta_heartbeat_rate", "meta heartbeat arrival rate").unwrap();
71 pub static ref METRIC_META_REMOTE_WAL_PRUNE_EXECUTE: IntCounterVec =
73 register_int_counter_vec!("greptime_meta_remote_wal_prune_execute", "meta remote wal prune execute", &["topic_name"]).unwrap();
74 pub static ref METRIC_META_REGION_MIGRATION_STAGE_ELAPSED: HistogramVec = register_histogram_vec!(
76 "greptime_meta_region_migration_stage_elapsed",
77 "meta region migration stage elapsed",
78 &["stage"],
79 exponential_buckets(0.01, 10.0, 7).unwrap(),
81 )
82 .unwrap();
83 pub static ref METRIC_META_TRIGGERED_REGION_FLUSH_TOTAL: IntCounterVec =
85 register_int_counter_vec!("meta_triggered_region_flush_total", "meta triggered region flush total", &["topic_name"]).unwrap();
86
87 pub static ref METRIC_META_TRIGGERED_REGION_CHECKPOINT_TOTAL: IntCounterVec =
89 register_int_counter_vec!("meta_triggered_region_checkpoint_total", "meta triggered region checkpoint total", &["topic_name"]).unwrap();
90 pub static ref METRIC_META_TOPIC_ESTIMATED_REPLAY_SIZE: IntGaugeVec =
92 register_int_gauge_vec!("meta_topic_estimated_replay_size", "meta topic estimated replay size", &["topic_name"]).unwrap();
93
94 pub static ref METRIC_META_GC_SCHEDULER_CYCLES_TOTAL: IntCounter = register_int_counter!(
96 "greptime_metasrv_gc_scheduler_cycles_total",
97 "Total GC scheduler cycles",
98 )
99 .unwrap();
100
101 pub static ref METRIC_META_GC_SCHEDULER_DURATION_SECONDS: Histogram = register_histogram!(
103 "greptime_metasrv_gc_scheduler_duration_seconds",
104 "Time for a full GC scheduler cycle",
105 vec![0.1, 0.5, 1.0, 2.0, 5.0, 10.0, 30.0, 60.0, 120.0, 300.0],
106 )
107 .unwrap();
108
109 pub static ref METRIC_META_GC_CANDIDATE_REGIONS: IntGauge = register_int_gauge!(
111 "greptime_metasrv_gc_candidate_regions",
112 "Number of GC candidate regions",
113 )
114 .unwrap();
115
116 pub static ref METRIC_META_GC_DATANODE_CALLS_TOTAL: IntCounterVec = register_int_counter_vec!(
118 "greptime_metasrv_gc_datanode_calls_total",
119 "Calls to datanodes for GC",
120 &["operation", "status"],
121 )
122 .unwrap();
123
124 pub static ref METRIC_META_GC_FAILED_REGIONS_TOTAL: IntCounter = register_int_counter!(
126 "greptime_metasrv_gc_failed_regions_total",
127 "Total regions that failed GC",
128 )
129 .unwrap();
130}