|
14 | 14 |
|
15 | 15 | use std::collections::HashSet; |
16 | 16 | use std::net::SocketAddr; |
17 | | -use std::sync::{LazyLock, Weak}; |
| 17 | +use std::sync::Weak; |
18 | 18 | use std::time::Duration; |
19 | 19 |
|
20 | 20 | use chitchat::{Chitchat, ChitchatId}; |
21 | | -use quickwit_metrics::{Counter, Gauge, counter, gauge}; |
| 21 | +use quickwit_metrics::{LazyCounter, LazyGauge, lazy_counter, lazy_gauge}; |
22 | 22 | use tokio::sync::Mutex; |
23 | 23 |
|
24 | 24 | use crate::member::NodeStateExt; |
25 | 25 |
|
26 | | -pub(crate) static LIVE_NODES: LazyLock<Gauge> = LazyLock::new(|| { |
27 | | - gauge!( |
| 26 | +pub(crate) static LIVE_NODES: LazyGauge = lazy_gauge!( |
28 | 27 | name: "live_nodes", |
29 | 28 | description: "The number of live nodes observed locally.", |
30 | 29 | subsystem: "cluster", |
31 | | - ) |
32 | | -}); |
| 30 | +); |
33 | 31 |
|
34 | | -pub(crate) static READY_NODES: LazyLock<Gauge> = LazyLock::new(|| { |
35 | | - gauge!( |
| 32 | +pub(crate) static READY_NODES: LazyGauge = lazy_gauge!( |
36 | 33 | name: "ready_nodes", |
37 | 34 | description: "The number of ready nodes observed locally.", |
38 | 35 | subsystem: "cluster", |
39 | | - ) |
40 | | -}); |
| 36 | +); |
41 | 37 |
|
42 | | -pub(crate) static ZOMBIE_NODES: LazyLock<Gauge> = LazyLock::new(|| { |
43 | | - gauge!( |
| 38 | +pub(crate) static ZOMBIE_NODES: LazyGauge = lazy_gauge!( |
44 | 39 | name: "zombie_nodes", |
45 | 40 | description: "The number of zombie nodes observed locally.", |
46 | 41 | subsystem: "cluster", |
47 | | - ) |
48 | | -}); |
| 42 | +); |
49 | 43 |
|
50 | | -pub(crate) static DEAD_NODES: LazyLock<Gauge> = LazyLock::new(|| { |
51 | | - gauge!( |
| 44 | +pub(crate) static DEAD_NODES: LazyGauge = lazy_gauge!( |
52 | 45 | name: "dead_nodes", |
53 | 46 | description: "The number of dead nodes observed locally.", |
54 | 47 | subsystem: "cluster", |
55 | | - ) |
56 | | -}); |
| 48 | +); |
57 | 49 |
|
58 | | -pub(crate) static CLUSTER_STATE_SIZE_BYTES: LazyLock<Gauge> = LazyLock::new(|| { |
59 | | - gauge!( |
| 50 | +pub(crate) static CLUSTER_STATE_SIZE_BYTES: LazyGauge = lazy_gauge!( |
60 | 51 | name: "cluster_state_size_bytes", |
61 | 52 | description: "The size of the cluster state in bytes.", |
62 | 53 | subsystem: "cluster", |
63 | | - ) |
64 | | -}); |
| 54 | +); |
65 | 55 |
|
66 | | -pub(crate) static NODE_STATE_KEYS: LazyLock<Gauge> = LazyLock::new(|| { |
67 | | - gauge!( |
| 56 | +pub(crate) static NODE_STATE_KEYS: LazyGauge = lazy_gauge!( |
68 | 57 | name: "node_state_keys", |
69 | 58 | description: "The number of keys in the node state.", |
70 | 59 | subsystem: "cluster", |
71 | | - ) |
72 | | -}); |
| 60 | +); |
73 | 61 |
|
74 | | -pub(crate) static NODE_STATE_SIZE_BYTES: LazyLock<Gauge> = LazyLock::new(|| { |
75 | | - gauge!( |
| 62 | +pub(crate) static NODE_STATE_SIZE_BYTES: LazyGauge = lazy_gauge!( |
76 | 63 | name: "node_state_size_bytes", |
77 | 64 | description: "The size of the node state in bytes.", |
78 | 65 | subsystem: "cluster", |
79 | | - ) |
80 | | -}); |
| 66 | +); |
81 | 67 |
|
82 | | -pub(crate) static GOSSIP_RECV_MESSAGES_TOTAL: LazyLock<Counter> = LazyLock::new(|| { |
83 | | - counter!( |
| 68 | +pub(crate) static GOSSIP_RECV_MESSAGES_TOTAL: LazyCounter = lazy_counter!( |
84 | 69 | name: "gossip_recv_messages_total", |
85 | 70 | description: "Total number of gossip messages received.", |
86 | 71 | subsystem: "cluster", |
87 | | - ) |
88 | | -}); |
| 72 | +); |
89 | 73 |
|
90 | | -pub(crate) static GOSSIP_RECV_BYTES_TOTAL: LazyLock<Counter> = LazyLock::new(|| { |
91 | | - counter!( |
| 74 | +pub(crate) static GOSSIP_RECV_BYTES_TOTAL: LazyCounter = lazy_counter!( |
92 | 75 | name: "gossip_recv_bytes_total", |
93 | 76 | description: "Total amount of gossip data received in bytes.", |
94 | 77 | subsystem: "cluster", |
95 | | - ) |
96 | | -}); |
| 78 | +); |
97 | 79 |
|
98 | | -pub(crate) static GOSSIP_SENT_MESSAGES_TOTAL: LazyLock<Counter> = LazyLock::new(|| { |
99 | | - counter!( |
| 80 | +pub(crate) static GOSSIP_SENT_MESSAGES_TOTAL: LazyCounter = lazy_counter!( |
100 | 81 | name: "gossip_sent_messages_total", |
101 | 82 | description: "Total number of gossip messages sent.", |
102 | 83 | subsystem: "cluster", |
103 | | - ) |
104 | | -}); |
| 84 | +); |
105 | 85 |
|
106 | | -pub(crate) static GOSSIP_SENT_BYTES_TOTAL: LazyLock<Counter> = LazyLock::new(|| { |
107 | | - counter!( |
| 86 | +pub(crate) static GOSSIP_SENT_BYTES_TOTAL: LazyCounter = lazy_counter!( |
108 | 87 | name: "gossip_sent_bytes_total", |
109 | 88 | description: "Total amount of gossip data sent in bytes.", |
110 | 89 | subsystem: "cluster", |
111 | | - ) |
112 | | -}); |
| 90 | +); |
113 | 91 |
|
114 | | -pub(crate) static GRPC_GOSSIP_ROUNDS_TOTAL: LazyLock<Counter> = LazyLock::new(|| { |
115 | | - counter!( |
| 92 | +pub(crate) static GRPC_GOSSIP_ROUNDS_TOTAL: LazyCounter = lazy_counter!( |
116 | 93 | name: "grpc_gossip_rounds_total", |
117 | 94 | description: "Total number of gRPC gossip rounds performed with peer nodes.", |
118 | 95 | subsystem: "cluster", |
119 | | - ) |
120 | | -}); |
| 96 | +); |
121 | 97 |
|
122 | 98 | pub(crate) fn spawn_metrics_task( |
123 | 99 | weak_chitchat: Weak<Mutex<Chitchat>>, |
|
0 commit comments