more data
This commit is contained in:
		@@ -100,6 +100,8 @@ impl Fairing for MetricsState {
 | 
				
			|||||||
        let method = req.method().as_str();
 | 
					        let method = req.method().as_str();
 | 
				
			||||||
        let status = res.status().to_string();
 | 
					        let status = res.status().to_string();
 | 
				
			||||||
        let query = req.query_fields().map(|f| format!("{}={},", f.name, f.value)).collect::<String>();
 | 
					        let query = req.query_fields().map(|f| format!("{}={},", f.name, f.value)).collect::<String>();
 | 
				
			||||||
 | 
					        let ip = req.client_ip().map_or_else(|| "N/A".to_string(), |ip| ip.to_string());
 | 
				
			||||||
 | 
					        let agent = req.headers().get_one("USER-AGENT").unwrap_or("N/A").to_owned();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        self.counter.add(
 | 
					        self.counter.add(
 | 
				
			||||||
            1, &[
 | 
					            1, &[
 | 
				
			||||||
@@ -107,6 +109,8 @@ impl Fairing for MetricsState {
 | 
				
			|||||||
                KeyValue::new("Method", method),
 | 
					                KeyValue::new("Method", method),
 | 
				
			||||||
                KeyValue::new("Status", status),
 | 
					                KeyValue::new("Status", status),
 | 
				
			||||||
                KeyValue::new("Query", query),
 | 
					                KeyValue::new("Query", query),
 | 
				
			||||||
 | 
					                KeyValue::new("IP", ip),
 | 
				
			||||||
 | 
					                KeyValue::new("User-Agent", agent),
 | 
				
			||||||
            ], );
 | 
					            ], );
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user