ros2: support client/service instrumentation #127
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This adds support for the new client/service (i.e., RPC) instrumentation in ROS 2, see ros2/ros2_tracing#145.
There is one limitation. Normal message publications and message takes have instrumentation that provides a "start time." For example, for message publications, the
ros2:rclcpp_publish
tracepoint is the start and theros2:rmw_publish
tracepoint is the end of a message publication. This allows us to attribute a duration to the publication and therefore display a time graph state. However, we only have a single tracepoint for client/service-related publication/take instances, so we do not have any duration data. For now, just hardcode a 5000 ns duration so that time graph states are visible enough.Example:
(trace: 2024-11-23__test_tracetools__test_service_pingpong__service-e2e.zip)
Clients (S↗️ ) and services (S↘️ ) are displayed under nodes (🔲) on the left. Chronological explanation:
/ping
client under the/test_service_ping
node sends a request (short-ish time graph state from which the outgoing arrow starts)/ping
service under the/test_service_pong
node receives (takes) the request (thinner time graph state that the incoming arrow points to, right before the long time graph state)/ping
service calls executes a callback for the request (long time graph state)/ping
service sends a response inside the request callback (time at which the outgoing arrow starts)/ping
client receives (takes) the request (thinner time graph state that the incoming arrow points to)