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}