-
Notifications
You must be signed in to change notification settings - Fork 4
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The general approach looks good, but I think some refactoring would be beneficial to improve the testeability of the code, and to avoid to repeat ourselves by moving code to the common package
this->min_log_severity_ = min_log_severity; | ||
} | ||
|
||
void LogNode::RecordLogs(const rcl_interfaces::msg::Log::SharedPtr log_msg) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This method looks exactly the same as LogNode::RecordLogs
in the ROS 1 version, but taking const rcl_interfaces::msg::Log::SharedPt
instead of const rosgraph_msgs::Log::ConstPtr &
. This code duplication is not very nice, instead we could work on moving this to cloudwatch_logs_common
, for example which a simple type to represent logs, and a method RecordLogs
that uses a conversion method of function from a ROS message into that log type. We could for example use the template method or the strategy pattern for the conversion function
cloudwatch_logger/src/log_node.cpp
Outdated
} | ||
} | ||
|
||
void LogNode::TriggerLogPublisher() { this->log_manager_->Service(); } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is also a duplicate of the ROS 1 node https://github.com/aws-robotics/cloudwatchlogs-ros1/blob/master/cloudwatch_logger/src/log_node.cpp#L61
cloudwatch_logger/src/log_node.cpp
Outdated
return log_severity_level >= this->min_log_severity_; | ||
} | ||
|
||
const std::string LogNode::FormatLogs(const rcl_interfaces::msg::Log::SharedPtr & log_msg) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a slight variant of LogNode::FormatLogs
of ROS 1 but we could also arrange the code to avoid repetition in several ways, for example converting to a ROS inpendent ROS type so we can have a single method FormatLogs
that works on the conversion of a ROS 1 or ROS 2 message
cloudwatch_logger/src/log_client.cpp
Outdated
constexpr double kNodePublishFrequencyDefaultValue = 5.0; | ||
constexpr bool kNodeSubscribeToRosoutDefaultValue = true; | ||
|
||
Aws::AwsError ReadPublishFrequency( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The ROS 1 version of this node also has something similar to this, I personally prefer a param helper like in the Lex node for parameter handling. However Avishay commented once that he thinks that these methods are somewhat redundant, and that are duplicating what the parameter reader does. So I'd check with him to try to avoid this, ideally replacing all the ReadX
methods for straightforward usages of ParameterReaderInterface
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be nice to move some of this to the common libs as the params are specific to the client config. It would be nice to break out non-AWS config components and maybe we can avoid code duplication between each implementation.
@juanrh has done a fantastic job summarizing changes that should be done before this goes into master. Since this PR is in an org public branch, let's keep this PR open and revisit it when re prioritizing. |
Signed-off-by: Miaofei <[email protected]>
Signed-off-by: Miaofei <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see any obvious issues, especially if it's working well.
Unfortunately, this is not working at all right now because of ros2/rmw_fastrtps#265. I have not yet succeeded in getting the workaround ( |
Signed-off-by: Miaofei <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Haven't made it through everything yet, but here are some initial comments.
README.md
Outdated
Send logs in a ROS system to AWS CloudWatch Logs service. | ||
|
||
#### Subscribed Topics | ||
- **`/rosout_agg`** |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Outdated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the /other_topics
part actually presenting correct information?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The way it's presented seems a bit odd, but it does have the ability to subscribe to whatever topics you define in the list in your config file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's saying all topics named /cloudwatch_logger/*
are implicitly subscribed to. Is this information correct, @dabonnie?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's saying all topics named
/cloudwatch_logger/*
are implicitly subscribed to. Is this information correct, @dabonnie?
If I read this (https://github.com/aws-robotics/cloudwatchlogs-ros1), it doesn't appear to match what you're saying.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Then explain to me what the sentence "The cloudwatch_logger subscribes to other topics if the parameter server has the topic names in cloudwatch_logger namespace" means.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, don't bother explaining, just say if that sentence presents correct information or not.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know the answer and would have to dig into ROS2 logging (https://index.ros.org/doc/ros2/Concepts/Logging/). Not sure if this is what @nburek was referencing when mentioning outdated.
As part of porting the application you might want to verify that the behavior detailed in the ROS1 README matches this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you know if it applies to ROS1 logging? Because that sentence is from the ROS1 CloudWatch Logs README.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, if you look at the "topics" config param and the ReadSubscriberList method, the doc appears to be accurate.
from launch_ros.actions import Node | ||
|
||
|
||
def generate_launch_description(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The ros1 CE had a lot more in its launch file that was meant as a way to provide automated integration with RoboMaker (such as detecting environment variables and such). Is this not possible in ROS2 launch files or did we decide not to support that anymore?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@AAlon, can you comment on this?
Signed-off-by: Miaofei <[email protected]>
Signed-off-by: Miaofei <[email protected]>
Signed-off-by: Miaofei <[email protected]>
Signed-off-by: Miaofei <[email protected]>
|
||
bool LogNode::checkIfOnline(std_srvs::srv::Trigger::Request & request, std_srvs::srv::Trigger::Response & response) | ||
{ | ||
// AWS_LOGSTREAM_DEBUG(__func__, "received request " << request); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why commented out?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's no operator<<()
for std_srvs::srv::Trigger::Request
for some reason.
ss << log_msg->level << " "; | ||
} | ||
ss << "[node name: " << log_msg->name << "] "; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this missing the topics section from the ROS1 code?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not available in rcl_interfaces::msg::Log.
Signed-off-by: Miaofei <[email protected]>
DO NOT MERGE.
This pull request is currently incomplete. It is missing
Description of changes:
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.