Hi everyone,
Heads-up about an API removal that recently landed in Rolling and will be part of ROS 2 Makoa Mata-mata (May 23, 2027): built-in topic statistics have been removed from rclcpp, and libstatistics_collector is no longer part of the ROS 2 core.
What changed
The following PRs were merged on October 5, 2026:
- ros2/rclcpp#3203: removes the topic statistics implementation from
rclcpp,rclcpp_lifecycleandrclcpp_components - ros2/ros2#1878: removes
libstatistics_collectorfromros2.repos - ros2/demos#812: removes the
topic_statistics_demopackage - ros2/examples#476: removes the
MinimalSubscriberWithTopicStatisticsexample - ros2/ros2_documentation#7245: removes the topic statistics tutorial and concept pages from the Rolling docs
Why
- Hardly anyone was using it. Recent bug reports suggested the feature saw very little real-world use.
- There’s a better way to get this data. At ROSCon we discussed providing an interface so a third-party package could plug the old behavior back in. We decided not to: tooling that hooks into the existing tracepoints (
tracetools/ ros2_tracing) can collect the same information without adding code and cost to every subscription. - Faster builds.
rclcppno longer depends onlibstatistics_collectorandstatistics_msgs, and fewer templates end up in every subscription. Compiling a simple node with one publisher and one subscription went from 6.32 s to 4.91 s (about 22% faster, measured on a Ryzen 9900X).
Overall, the change removes around 2,400 lines of code.
Am I affected?
Only if you use the C++ topic statistics API. In that case your code will no longer compile against Rolling. These are removed:
| Removed | Where |
|---|---|
NodeOptions::enable_topic_statistics() (getter and setter) |
rclcpp/node_options.hpp |
SubscriptionOptions::topic_stats_options (TopicStatisticsOptions: state, publish_topic, publish_period, qos) |
rclcpp/subscription_options.hpp |
rclcpp::TopicStatisticsState |
rclcpp/topic_statistics_state.hpp |
rclcpp::topic_statistics::SubscriptionTopicStatistics |
rclcpp/topic_statistics/subscription_topic_statistics.hpp |
NodeBaseInterface::get_enable_topic_statistics_default(), and the enable_topic_statistics_default argument of the NodeBase constructor |
rclcpp/node_interfaces/ |
The enable_topic_statistics extra argument when loading a component |
rclcpp_components |
Note that the last two items also affect you if you implement your own NodeBaseInterface, or if your launch files pass enable_topic_statistics as an extra argument to a composable node.
Also, nothing publishes on the /statistics topic anymore. Tools or dashboards that subscribe to it will stop receiving data.
The statistics_msgs message package itself is not removed. It lives in rcl_interfaces, so existing tools that use those messages keep building.
How to migrate
- Remove the API calls listed above. For most users that’s deleting
options.topic_stats_options.state = rclcpp::TopicStatisticsState::Enable;(or.enable_topic_statistics(true)) and the related includes. - Collect statistics from tracepoints instead.
rclcppalready emits tracepoints on every publish and every subscription callback, which give you message rates, periods and latencies without changing your nodes:- ros2_tracing to record traces and analyze them offline.
- Community tools built on the same instrumentation are already appearing. For example, ros2_pulse reports live topic rates, can export to Prometheus and Grafana, and can even publish
statistics_msgson/statisticsif you have tooling that depends on it.
- Need it on older distros? Nothing changes for Humble, Jazzy, Kilted or Lyrical: topic statistics are still there. The removal only applies to Rolling and to Makoa Mata-mata onwards.
Feedback welcome
During review, @tomoyafujita raised good points: whether this should have gone through a deprecation period first, and whether a longer-term statistics hook should live at the rcl level, so rclpy and other client libraries, plus services and actions, could share one mechanism.
We went with a direct removal because the feature had so few users and we’re early in the Makoa cycle, which leaves plenty of time to react before the release. If you depend on topic statistics in production, please reply here. We’d like to hear what you’re using it for, so we can point you to the right replacement or document a migration path.
Thanks to @jmachowinski for driving this cleanup, and to everyone who reviewed it and joined the discussion at ROSCon.
Alejandro