Skip to content

Commit 2453254

Browse files
authored
chore: remove todo messages in call_v3.rs (dfinity#3617)
The todo messages are completed in a PR that adds alerts/slack notifications.
1 parent ac12ab0 commit 2453254

File tree

2 files changed

+14
-15
lines changed

2 files changed

+14
-15
lines changed

rs/http_endpoints/public/src/call/call_v3.rs

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ use crate::{
1111
CALL_V3_EARLY_RESPONSE_DUPLICATE_SUBSCRIPTION,
1212
CALL_V3_EARLY_RESPONSE_INGRESS_WATCHER_NOT_RUNNING,
1313
CALL_V3_EARLY_RESPONSE_MESSAGE_ALREADY_IN_CERTIFIED_STATE,
14-
CALL_V3_EARLY_RESPONSE_SUBSCRIPTION_TIMEOUT,
14+
CALL_V3_EARLY_RESPONSE_SUBSCRIPTION_TIMEOUT, CALL_V3_STATUS_IS_INVALID_UTF8,
15+
CALL_V3_STATUS_IS_NOT_LEAF,
1516
},
1617
HttpError,
1718
};
@@ -224,16 +225,11 @@ async fn call_sync_v3(
224225
.await
225226
{
226227
Ok(Ok(message_subscriber)) => Ok(message_subscriber),
227-
Ok(Err(SubscriptionError::DuplicateSubscriptionError)) => {
228-
// TODO: At this point we could return early without submitting the ingress message.
229-
Err((
230-
"Duplicate request. Message is already being tracked and executed.",
231-
CALL_V3_EARLY_RESPONSE_DUPLICATE_SUBSCRIPTION,
232-
))
233-
}
228+
Ok(Err(SubscriptionError::DuplicateSubscriptionError)) => Err((
229+
"Duplicate request. Message is already being tracked and executed.",
230+
CALL_V3_EARLY_RESPONSE_DUPLICATE_SUBSCRIPTION,
231+
)),
234232
Ok(Err(SubscriptionError::IngressWatcherNotRunning { error_message })) => {
235-
// TODO: Send a warning or notification.
236-
// This probably means that the ingress watcher panicked.
237233
error!(
238234
every_n_seconds => LOG_EVERY_N_SECONDS,
239235
log,
@@ -302,7 +298,6 @@ async fn call_sync_v3(
302298
);
303299
};
304300

305-
// Log the status of the message.
306301
let status_label = match parsed_message_status(&tree, &message_id) {
307302
ParsedMessageStatus::Known(status) => status,
308303
ParsedMessageStatus::Unknown => "unknown".to_string(),
@@ -333,11 +328,12 @@ fn parsed_message_status(tree: &MixedHashTree, message_id: &MessageId) -> Parsed
333328

334329
match tree.lookup(&status_path) {
335330
LookupStatus::Found(MixedHashTree::Leaf(status)) => ParsedMessageStatus::Known(
336-
String::from_utf8(status.clone()).unwrap_or_else(|_| "invalid_utf8_status".to_string()),
331+
String::from_utf8(status.clone())
332+
.unwrap_or_else(|_| CALL_V3_STATUS_IS_INVALID_UTF8.to_string()),
337333
),
338-
// This should never happen. Otherwise the tree is not following the spec.
339-
// TODO: Log as error.
340-
LookupStatus::Found(_) => ParsedMessageStatus::Known("Status not a leaf".to_string()),
334+
LookupStatus::Found(_) => {
335+
ParsedMessageStatus::Known(CALL_V3_STATUS_IS_NOT_LEAF.to_string())
336+
}
341337
LookupStatus::Absent | LookupStatus::Unknown => ParsedMessageStatus::Unknown,
342338
}
343339
}

rs/http_endpoints/public/src/metrics.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,16 @@ pub const LABEL_HEALTH_STATUS_AFTER: &str = "after";
1717
pub const LABEL_CALL_V3_CERTIFICATE_STATUS: &str = "status";
1818

1919
// Call v3 labels
20+
// !!! Be careful to update alert queries in k8s repo if changing these constants.!!!
2021
pub const LABEL_CALL_V3_EARLY_RESPONSE_TRIGGER: &str = "trigger";
2122
pub const CALL_V3_EARLY_RESPONSE_INGRESS_WATCHER_NOT_RUNNING: &str = "ingress_watcher_not_running";
2223
pub const CALL_V3_EARLY_RESPONSE_DUPLICATE_SUBSCRIPTION: &str = "duplicate_subscription";
2324
pub const CALL_V3_EARLY_RESPONSE_SUBSCRIPTION_TIMEOUT: &str = "subscription_timeout";
2425
pub const CALL_V3_EARLY_RESPONSE_CERTIFICATION_TIMEOUT: &str = "certification_timeout";
2526
pub const CALL_V3_EARLY_RESPONSE_MESSAGE_ALREADY_IN_CERTIFIED_STATE: &str =
2627
"message_already_in_certified_state";
28+
pub const CALL_V3_STATUS_IS_NOT_LEAF: &str = "not_leaf";
29+
pub const CALL_V3_STATUS_IS_INVALID_UTF8: &str = "is_invalid_utf8";
2730

2831
/// Placeholder used when we can't determine the appropriate prometheus label.
2932
pub const LABEL_UNKNOWN: &str = "unknown";

0 commit comments

Comments
 (0)