ROS 2 Rolling removes topic statistics and libstatistics_collector from rclcpp
The ROS 2 core is stripping built-in topic statistics in favor of more efficient tracepoint-based instrumentation.
Summary
Open Robotics has implemented a significant API removal in the ROS 2 Rolling distribution, which will carry forward into the Makoa Mata-mata release scheduled for May 2027. The update removes built-in topic statistics from the rclcpp client library and eliminates libstatistics_collector from the ROS 2 core repository.
This decision follows observations that the feature saw minimal real-world usage and imposed unnecessary overhead on every subscription. By moving away from integrated statistics, the project aims to reduce code complexity and improve compilation performance for robotics developers.
Technical changes and performance gains
- API Deprecation: Several C++ interfaces have been removed, including NodeOptions::enable_topic_statistics(), SubscriptionOptions::topic_stats_options, and the rclcpp::TopicStatisticsState class.
- Build Optimization: Removing the dependency on libstatistics_collector and statistics_msgs reduces template overhead, resulting in a measured 22% reduction in compilation time for simple nodes (from 6.32s to 4.91s on a Ryzen 9900X).
- Code Reduction: The cleanup removes approximately 2,400 lines of code across rclcpp, rclcpp_lifecycle, and rclcpp_components.
- Alternative Instrumentation: Developers are encouraged to migrate to ros2_tracing and tracetools, which utilize existing tracepoints to collect message rates, periods, and latencies without adding runtime cost to individual nodes.
- Data Availability: The /statistics topic will no longer receive automated broadcasts, though the statistics_msgs package remains available in rcl_interfaces for compatibility with existing message definitions.
Why it matters
Robotics engineers using the C++ topic statistics API must refactor their code to avoid compilation failures in Rolling and future Makoa Mata-mata releases. While the change improves system efficiency and build speeds, users of dashboards or monitoring tools relying on the /statistics topic will need to transition to tools like ros2_pulse that leverage tracepoints.
Original reference: discourse.openrobotics.org →