|
1 | 1 | use lazy_static::lazy_static;
|
2 |
| -use rivet_metrics::prometheus::*; |
| 2 | +use rivet_metrics::{prometheus::*, REGISTRY}; |
3 | 3 |
|
4 | 4 | lazy_static! {
|
5 |
| - pub static ref ACTOR_REQUEST_TOTAL: IntCounterVec = register_int_counter_vec!( |
6 |
| - "actor_request_total", |
| 5 | + // MARK: Internal |
| 6 | + pub static ref ROUTE_CACHE_SIZE: IntGauge = register_int_gauge_with_registry!( |
| 7 | + "guard_route_cache_size", |
| 8 | + "Number of entries in the route cache", |
| 9 | + *REGISTRY, |
| 10 | + ).unwrap(); |
| 11 | + pub static ref RATE_LIMITERS_COUNT: IntGauge = register_int_gauge_with_registry!( |
| 12 | + "guard_rate_limiters_count", |
| 13 | + "Number of active rate limiters", |
| 14 | + *REGISTRY, |
| 15 | + ).unwrap(); |
| 16 | + pub static ref IN_FLIGHT_COUNTERS_COUNT: IntGauge = register_int_gauge_with_registry!( |
| 17 | + "guard_in_flight_counters_count", |
| 18 | + "Number of active in-flight counters", |
| 19 | + *REGISTRY, |
| 20 | + ) |
| 21 | + .unwrap(); |
| 22 | + |
| 23 | + // MARK: TCP |
| 24 | + pub static ref TCP_CONNECTION_TOTAL: IntCounter = register_int_counter_with_registry!( |
| 25 | + "guard_request_total", |
| 26 | + "Total number of TCP connections ever", |
| 27 | + *REGISTRY, |
| 28 | + ) |
| 29 | + .unwrap(); |
| 30 | + pub static ref TCP_CONNECTION_PENDING: IntGauge = register_int_gauge_with_registry!( |
| 31 | + "guard_tcp_connection_pending", |
| 32 | + "Total number of open TCP connections", |
| 33 | + *REGISTRY, |
| 34 | + ) |
| 35 | + .unwrap(); |
| 36 | + pub static ref TCP_CONNECTION_DURATION: Histogram = register_histogram_with_registry!( |
| 37 | + "guard_tcp_connection_duration", |
| 38 | + "TCP connection duration in seconds", |
| 39 | + *REGISTRY, |
| 40 | + ) |
| 41 | + .unwrap(); |
| 42 | + |
| 43 | + // MARK: Requests |
| 44 | + pub static ref REQUEST_TOTAL: IntCounterVec = register_int_counter_vec_with_registry!( |
| 45 | + "guard_request_total", |
| 46 | + "Total number of requests processed", |
| 47 | + &["method"], |
| 48 | + *REGISTRY, |
| 49 | + ) |
| 50 | + .unwrap(); |
| 51 | + pub static ref REQUEST_PENDING: IntGaugeVec = register_int_gauge_vec_with_registry!( |
| 52 | + "guard_request_pending", |
| 53 | + "Total number of active requests being processed", |
| 54 | + &["method"], |
| 55 | + *REGISTRY, |
| 56 | + ) |
| 57 | + .unwrap(); |
| 58 | + pub static ref REQUEST_DURATION: HistogramVec = register_histogram_vec_with_registry!( |
| 59 | + "guard_request_duration", |
| 60 | + "Request duration in seconds", |
| 61 | + &["method", "status_code"], |
| 62 | + *REGISTRY, |
| 63 | + ) |
| 64 | + .unwrap(); |
| 65 | + |
| 66 | + // MARK: Actors |
| 67 | + pub static ref ACTOR_REQUEST_TOTAL: IntCounterVec = register_int_counter_vec_with_registry!( |
| 68 | + "guard_actor_request_total", |
7 | 69 | "Total number of requests to actor",
|
8 |
| - &["actor_id", "server_id", "method", "path"] |
| 70 | + &["actor_id", "server_id", "method", "path"], |
| 71 | + *REGISTRY, |
9 | 72 | )
|
10 | 73 | .unwrap();
|
11 |
| - pub static ref ACTOR_REQUEST_PENDING: IntGaugeVec = register_int_gauge_vec!( |
12 |
| - "actor_request_pending", |
| 74 | + pub static ref ACTOR_REQUEST_PENDING: IntGaugeVec = register_int_gauge_vec_with_registry!( |
| 75 | + "guard_actor_request_pending", |
13 | 76 | "Number of pending requests to actor",
|
14 |
| - &["actor_id", "server_id", "method", "path"] |
| 77 | + &["actor_id", "server_id", "method", "path"], |
| 78 | + *REGISTRY, |
15 | 79 | )
|
16 | 80 | .unwrap();
|
17 |
| - pub static ref ACTOR_REQUEST_DURATION: HistogramVec = register_histogram_vec!( |
18 |
| - "actor_request_duration_seconds", |
| 81 | + pub static ref ACTOR_REQUEST_DURATION: HistogramVec = register_histogram_vec_with_registry!( |
| 82 | + "guard_actor_request_duration", |
19 | 83 | "Request duration in seconds",
|
20 |
| - &["actor_id", "server_id", "status"] |
| 84 | + &["actor_id", "server_id", "status"], |
| 85 | + *REGISTRY, |
21 | 86 | )
|
22 | 87 | .unwrap();
|
23 |
| - pub static ref ACTOR_REQUEST_ERRORS: IntCounterVec = register_int_counter_vec!( |
24 |
| - "actor_request_errors_total", |
| 88 | + pub static ref ACTOR_REQUEST_ERRORS: IntCounterVec = register_int_counter_vec_with_registry!( |
| 89 | + "guard_actor_request_errors_total", |
25 | 90 | "Total number of errors when proxying requests to actor",
|
26 |
| - &["actor_id", "server_id", "error_type"] |
| 91 | + &["actor_id", "server_id", "error_type"], |
| 92 | + *REGISTRY, |
27 | 93 | )
|
28 | 94 | .unwrap();
|
29 | 95 | }
|
0 commit comments