Skip to content

Commit

Permalink
fix: incorrect code label
Browse files Browse the repository at this point in the history
  • Loading branch information
shumkov committed Apr 26, 2024
1 parent d867fe1 commit 6f2a13e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion packages/rs-drive-abci/src/metrics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ pub fn query_duration_metric(endpoint: &str) -> HistogramTiming {

/// Create a label for the response code.
pub fn response_code_metric_label(code: Code) -> Label {
Label::new(LABEL_RESPONSE_CODE, format!("{}", code).to_lowercase())
Label::new(LABEL_RESPONSE_CODE, format!("{:?}", code).to_lowercase())
}

/// Create a label for the endpoint.
Expand Down
5 changes: 3 additions & 2 deletions packages/rs-drive-abci/src/query/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ impl QueryService {
Ok(_) => Code::Ok,
Err(status) => status.code(),
};
let code_label = format!("{:?}", code).to_lowercase();

match code {
// User errors
Expand All @@ -192,7 +193,7 @@ impl QueryService {
request = request_debug,
elapsed_time,
endpoint_name,
code = code.to_string().to_lowercase(),
code = code_label,
"query '{}' executed with code {:?} in {} secs",
endpoint_name,
code,
Expand All @@ -214,7 +215,7 @@ impl QueryService {
tracing::error!(
request = request_debug,
endpoint_name,
code = code.to_string().to_lowercase(),
code = code_label,
"query '{}' execution failed with code {:?}",
endpoint_name,
code
Expand Down

0 comments on commit 6f2a13e

Please sign in to comment.