Add error code in prometheus metrics and add X-SMG-Error-Code header (#15036)
This commit is contained in:
@@ -275,7 +275,7 @@ pub fn init_metrics() {
|
||||
);
|
||||
describe_counter!(
|
||||
"sgl_router_http_responses_total",
|
||||
"Total number of HTTP responses by status code"
|
||||
"Total number of HTTP responses by status code and error code"
|
||||
);
|
||||
}
|
||||
|
||||
@@ -593,9 +593,10 @@ impl RouterMetrics {
|
||||
counter!("sgl_router_http_requests_total").increment(1);
|
||||
}
|
||||
|
||||
pub fn record_http_status_code(status_code: u16) {
|
||||
pub fn record_http_status_code(status_code: u16, error_code: &str) {
|
||||
counter!("sgl_router_http_responses_total",
|
||||
"status_code" => status_code.to_string()
|
||||
"status_code" => status_code.to_string(),
|
||||
"error_code" => error_code.to_string()
|
||||
)
|
||||
.increment(1);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user