Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(topic_state_monitor): enrich error log message (#7236) #1340

Merged
merged 1 commit into from
Jun 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions system/topic_state_monitor/src/topic_state_monitor_core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,8 @@ void TopicStateMonitorNode::checkTopicStatus(diagnostic_updater::DiagnosticStatu
const auto print_warn = [&](const std::string & msg) {
RCLCPP_WARN_THROTTLE(get_logger(), *get_clock(), 3000, "%s", msg.c_str());
};
const auto print_debug = [&](const std::string & msg) {
RCLCPP_DEBUG_THROTTLE(get_logger(), *get_clock(), 3000, "%s", msg.c_str());
const auto print_info = [&](const std::string & msg) {
RCLCPP_INFO_THROTTLE(get_logger(), *get_clock(), 3000, "%s", msg.c_str());
};

// Judge level
Expand All @@ -166,19 +166,21 @@ void TopicStateMonitorNode::checkTopicStatus(diagnostic_updater::DiagnosticStatu
} else if (topic_status == TopicStatus::NotReceived) {
level = DiagnosticStatus::ERROR;
stat.add("status", "NotReceived");
print_debug(node_param_.topic + " has not received.");
print_info(node_param_.topic + " has not received. Set ERROR in diagnostics.");
} else if (topic_status == TopicStatus::WarnRate) {
level = DiagnosticStatus::WARN;
stat.add("status", "WarnRate");
print_warn(node_param_.topic + " topic rate has dropped to the warning level.");
print_warn(
node_param_.topic + " topic rate has dropped to the warning level. Set WARN in diagnostics.");
} else if (topic_status == TopicStatus::ErrorRate) {
level = DiagnosticStatus::ERROR;
stat.add("status", "ErrorRate");
print_warn(node_param_.topic + " topic rate has dropped to the error level.");
print_warn(
node_param_.topic + " topic rate has dropped to the error level. Set ERROR in diagnostics.");
} else if (topic_status == TopicStatus::Timeout) {
level = DiagnosticStatus::ERROR;
stat.add("status", "Timeout");
print_warn(node_param_.topic + " topic is timeout.");
print_warn(node_param_.topic + " topic is timeout. Set ERROR in diagnostics.");
}

// Add key-value
Expand Down
Loading