feat(xanthous/server): Add simple prometheus metrics
Add a prometheus exporter and some simple prometheus metrics, so that I can look at dashboards and get alerts for things like lots of connections Change-Id: Ic1e0568200299dc852b74da647a6354267ee7576 Reviewed-on: https://cl.tvl.fyi/c/depot/+/3811 Reviewed-by: grfn <grfn@gws.fyi> Tested-by: BuildkiteCI
This commit is contained in:
		
							parent
							
								
									77f0d62a2c
								
							
						
					
					
						commit
						5327d238e3
					
				
					 4 changed files with 589 additions and 11 deletions
				
			
		
							
								
								
									
										24
									
								
								users/grfn/xanthous/server/src/metrics.rs
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										24
									
								
								users/grfn/xanthous/server/src/metrics.rs
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,24 @@ | |||
| pub use ::metrics::*; | ||||
| 
 | ||||
| pub mod reported { | ||||
|     /// Counter: Connections accepted on the TCP listener
 | ||||
|     pub const CONNECTIONS_ACCEPTED: &str = "ssh.connections.accepted"; | ||||
| 
 | ||||
|     /// Histogram: Connection duration
 | ||||
|     pub const CONNECTION_DURATION: &str = "ssh.connections.duration"; | ||||
| 
 | ||||
|     /// Gauge: Currently active connections
 | ||||
|     pub const ACTIVE_CONNECTIONS: &str = "ssh.connections.active"; | ||||
| 
 | ||||
|     /// Gauge: Currently running xanthous processes
 | ||||
|     pub const RUNNING_PROCESSES: &str = "ssh.child.processes"; | ||||
| } | ||||
| 
 | ||||
| pub fn register() { | ||||
|     use reported::*; | ||||
| 
 | ||||
|     register_counter!(CONNECTIONS_ACCEPTED); | ||||
|     register_histogram!(CONNECTION_DURATION); | ||||
|     register_gauge!(ACTIVE_CONNECTIONS); | ||||
|     register_gauge!(RUNNING_PROCESSES); | ||||
| } | ||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue