more data
This commit is contained in:
parent
aeb2801b56
commit
7de9830f66
@ -100,6 +100,8 @@ impl Fairing for MetricsState {
|
||||
let method = req.method().as_str();
|
||||
let status = res.status().to_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(
|
||||
1, &[
|
||||
@ -107,6 +109,8 @@ impl Fairing for MetricsState {
|
||||
KeyValue::new("Method", method),
|
||||
KeyValue::new("Status", status),
|
||||
KeyValue::new("Query", query),
|
||||
KeyValue::new("IP", ip),
|
||||
KeyValue::new("User-Agent", agent),
|
||||
], );
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user