feat: Linux introspection plugins (procfs, systemd, container)#263
feat: Linux introspection plugins (procfs, systemd, container)#263
Conversation
21fbcce to
5c20726
Compare
There was a problem hiding this comment.
Pull request overview
Adds a new Linux introspection plugin package and accompanying tests/docs to expose OS-level metadata (procfs, systemd, container/cgroup) through vendor extension REST endpoints and plugin capabilities in the ros2_medkit gateway.
Changes:
- Introduces
ros2_medkit_linux_introspection(procfs/systemd/container plugins + shared Linux utilities + unit tests). - Extends gateway plugin context with Component→App traversal to support aggregation endpoints.
- Adds integration tests (launch_testing + Docker-based) and documentation for the new vendor extension endpoints.
Reviewed changes
Copilot reviewed 35 out of 35 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| src/ros2_medkit_integration_tests/test/features/test_procfs_introspection.test.py | Launch_testing coverage for procfs endpoints + component aggregation/capabilities. |
| src/ros2_medkit_integration_tests/test/features/test_combined_introspection.test.py | Validates multiple plugins can coexist and routes remain isolated. |
| src/ros2_medkit_integration_tests/test/docker/introspection/test_systemd_introspection.py | External pytest tests against systemd-based Docker environment. |
| src/ros2_medkit_integration_tests/test/docker/introspection/test_container_introspection.py | External pytest tests against containerized + resource-limited Docker environment. |
| src/ros2_medkit_integration_tests/test/docker/introspection/run_docker_tests.sh | Helper script to build/run docker compose stacks and execute pytest. |
| src/ros2_medkit_integration_tests/test/docker/introspection/docker-compose.systemd.yml | Compose stack for systemd-in-container test environment. |
| src/ros2_medkit_integration_tests/test/docker/introspection/docker-compose.container.yml | Compose stack for container/cgroup test environment with resource limits. |
| src/ros2_medkit_integration_tests/test/docker/introspection/Dockerfile.systemd | Multi-stage image for systemd plugin integration testing. |
| src/ros2_medkit_integration_tests/test/docker/introspection/Dockerfile.container | Multi-stage image for container plugin integration testing. |
| src/ros2_medkit_gateway/src/plugins/plugin_context.cpp | Implements PluginContext::get_child_apps() using the thread-safe cache. |
| src/ros2_medkit_gateway/include/ros2_medkit_gateway/plugins/plugin_context.hpp | Adds get_child_apps() to plugin API for component aggregation. |
| src/ros2_medkit_gateway/CMakeLists.txt | Exports symbols for dlopen’d plugins + installs/exports gateway headers. |
| src/ros2_medkit_gateway/CHANGELOG.rst | Notes addition of Linux introspection plugins feature. |
| src/ros2_medkit_discovery_plugins/ros2_medkit_linux_introspection/CMakeLists.txt | Builds static utils + 3 MODULE plugins + GTest targets, optional systemd build. |
| src/ros2_medkit_discovery_plugins/ros2_medkit_linux_introspection/package.xml | Declares dependencies for linux introspection plugin package. |
| src/ros2_medkit_discovery_plugins/ros2_medkit_linux_introspection/include/ros2_medkit_linux_introspection/systemd_utils.hpp | Unit-name escaping helper for systemd DBus object paths. |
| src/ros2_medkit_discovery_plugins/ros2_medkit_linux_introspection/include/ros2_medkit_linux_introspection/procfs_utils.hpp | ProcessInfo→JSON serialization helper for procfs plugin responses. |
| src/ros2_medkit_discovery_plugins/ros2_medkit_linux_introspection/include/ros2_medkit_linux_introspection/proc_reader.hpp | Procfs reader APIs + TTL-based thread-safe PID cache. |
| src/ros2_medkit_discovery_plugins/ros2_medkit_linux_introspection/include/ros2_medkit_linux_introspection/cgroup_reader.hpp | Cgroup v2 reader APIs for container ID/runtime/limits. |
| src/ros2_medkit_discovery_plugins/ros2_medkit_linux_introspection/include/ros2_medkit_linux_introspection/container_utils.hpp | CgroupInfo→JSON serialization helper for container plugin responses. |
| src/ros2_medkit_discovery_plugins/ros2_medkit_linux_introspection/src/linux_utils/proc_reader.cpp | Implements /proc parsing, PID lookup, and PID cache refresh/lookup. |
| src/ros2_medkit_discovery_plugins/ros2_medkit_linux_introspection/src/linux_utils/cgroup_reader.cpp | Implements cgroup path parsing + resource limit reads (memory.max/cpu.max). |
| src/ros2_medkit_discovery_plugins/ros2_medkit_linux_introspection/src/procfs_plugin.cpp | Procfs plugin routes + aggregation endpoint implementation. |
| src/ros2_medkit_discovery_plugins/ros2_medkit_linux_introspection/src/systemd_plugin.cpp | Systemd plugin routes + sd-bus property querying + aggregation endpoint. |
| src/ros2_medkit_discovery_plugins/ros2_medkit_linux_introspection/src/container_plugin.cpp | Container plugin routes + cgroup-based metadata + aggregation endpoint. |
| src/ros2_medkit_discovery_plugins/ros2_medkit_linux_introspection/test/test_proc_reader.cpp | Unit tests for proc reader parsing on real + synthetic /proc trees. |
| src/ros2_medkit_discovery_plugins/ros2_medkit_linux_introspection/test/test_pid_cache.cpp | Unit tests for TTL refresh and concurrency behavior of PID cache. |
| src/ros2_medkit_discovery_plugins/ros2_medkit_linux_introspection/test/test_cgroup_reader.cpp | Unit tests for container ID/runtime parsing + resource limits reading. |
| src/ros2_medkit_discovery_plugins/ros2_medkit_linux_introspection/test/test_procfs_plugin.cpp | Unit tests for procfs JSON serialization behaviors. |
| src/ros2_medkit_discovery_plugins/ros2_medkit_linux_introspection/test/test_systemd_plugin.cpp | Unit tests for systemd unit escaping helper. |
| src/ros2_medkit_discovery_plugins/ros2_medkit_linux_introspection/test/test_container_plugin.cpp | Unit tests for container JSON serialization + non-container detection. |
| docs/tutorials/linux-introspection.rst | New tutorial documenting plugins, config, endpoints, errors, and troubleshooting. |
| docs/tutorials/index.rst | Adds linux introspection tutorial to docs nav. |
| docs/api/rest.rst | Documents vendor extension endpoints in REST API reference. |
| .devcontainer/Dockerfile | Adds libsystemd-dev to devcontainer tooling image. |
src/ros2_medkit_gateway/include/ros2_medkit_gateway/plugins/plugin_context.hpp
Show resolved
Hide resolved
...os2_medkit_discovery_plugins/ros2_medkit_linux_introspection/src/linux_utils/proc_reader.cpp
Show resolved
Hide resolved
...os2_medkit_discovery_plugins/ros2_medkit_linux_introspection/src/linux_utils/proc_reader.cpp
Show resolved
Hide resolved
...os2_medkit_discovery_plugins/ros2_medkit_linux_introspection/src/linux_utils/proc_reader.cpp
Show resolved
Hide resolved
src/ros2_medkit_integration_tests/test/docker/introspection/docker-compose.container.yml
Outdated
Show resolved
Hide resolved
src/ros2_medkit_discovery_plugins/ros2_medkit_linux_introspection/package.xml
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Pull request overview
Adds a new Linux-specific introspection plugin package to enrich discovery with OS/process metadata and exposes it via x-medkit-* vendor extension endpoints, plus supporting gateway/plugin API changes, tests, and documentation.
Changes:
- Introduces
ros2_medkit_linux_introspectionwith procfs/systemd/container introspection plugins + shared/proc/cgroup utilities. - Extends gateway plugin API (
PluginContext::get_child_apps) and adjusts gateway build/export settings for downstream plugin builds. - Adds integration (launch_testing + Docker-based) tests and documents the new vendor extension endpoints.
Reviewed changes
Copilot reviewed 35 out of 35 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| src/ros2_medkit_integration_tests/test/features/test_procfs_introspection.test.py | Launch_testing coverage for procfs plugin endpoints and capabilities. |
| src/ros2_medkit_integration_tests/test/features/test_combined_introspection.test.py | Validates multiple plugins coexist and routes remain isolated. |
| src/ros2_medkit_integration_tests/test/docker/introspection/test_systemd_introspection.py | External pytest tests for systemd plugin against a systemd-in-container setup. |
| src/ros2_medkit_integration_tests/test/docker/introspection/test_container_introspection.py | External pytest tests for container plugin against a resource-limited container. |
| src/ros2_medkit_integration_tests/test/docker/introspection/run_docker_tests.sh | Script to build/launch Docker scenarios and run pytest suites. |
| src/ros2_medkit_integration_tests/test/docker/introspection/docker-compose.systemd.yml | Compose definition for privileged/systemd-based test environment. |
| src/ros2_medkit_integration_tests/test/docker/introspection/docker-compose.container.yml | Compose definition for container limits/cgroup-based tests. |
| src/ros2_medkit_integration_tests/test/docker/introspection/Dockerfile.systemd | Multi-stage image to run gateway + demo nodes under systemd. |
| src/ros2_medkit_integration_tests/test/docker/introspection/Dockerfile.container | Multi-stage image to run gateway + demo nodes without systemd. |
| src/ros2_medkit_gateway/src/plugins/plugin_context.cpp | Implements PluginContext::get_child_apps() using the thread-safe cache. |
| src/ros2_medkit_gateway/include/ros2_medkit_gateway/plugins/plugin_context.hpp | Extends plugin context interface with get_child_apps(). |
| src/ros2_medkit_gateway/CMakeLists.txt | Exports symbols for dlopen’d plugins and installs/exports gateway headers. |
| src/ros2_medkit_gateway/CHANGELOG.rst | Documents the new Linux introspection plugin feature. |
| src/ros2_medkit_discovery_plugins/ros2_medkit_linux_introspection/test/test_systemd_plugin.cpp | Unit tests for systemd DBus escaping helper. |
| src/ros2_medkit_discovery_plugins/ros2_medkit_linux_introspection/test/test_procfs_plugin.cpp | Unit tests for procfs JSON serialization behavior. |
| src/ros2_medkit_discovery_plugins/ros2_medkit_linux_introspection/test/test_proc_reader.cpp | Unit tests for /proc reader (real + synthetic proc trees). |
| src/ros2_medkit_discovery_plugins/ros2_medkit_linux_introspection/test/test_pid_cache.cpp | Unit tests for TTL-based PID cache + concurrency smoke test. |
| src/ros2_medkit_discovery_plugins/ros2_medkit_linux_introspection/test/test_container_plugin.cpp | Unit tests for container JSON serialization and non-container detection. |
| src/ros2_medkit_discovery_plugins/ros2_medkit_linux_introspection/test/test_cgroup_reader.cpp | Unit tests for cgroup parsing, runtime detection, and resource limits. |
| src/ros2_medkit_discovery_plugins/ros2_medkit_linux_introspection/src/systemd_plugin.cpp | Systemd introspection plugin implementation + routes + aggregation. |
| src/ros2_medkit_discovery_plugins/ros2_medkit_linux_introspection/src/procfs_plugin.cpp | Procfs introspection plugin implementation + routes + aggregation. |
| src/ros2_medkit_discovery_plugins/ros2_medkit_linux_introspection/src/linux_utils/proc_reader.cpp | /proc reading utilities + PID cache implementation. |
| src/ros2_medkit_discovery_plugins/ros2_medkit_linux_introspection/src/linux_utils/cgroup_reader.cpp | Cgroup v2 parsing + container detection + limit reading. |
| src/ros2_medkit_discovery_plugins/ros2_medkit_linux_introspection/src/container_plugin.cpp | Container introspection plugin implementation + routes + aggregation. |
| src/ros2_medkit_discovery_plugins/ros2_medkit_linux_introspection/package.xml | Declares the new plugin package and its dependencies. |
| src/ros2_medkit_discovery_plugins/ros2_medkit_linux_introspection/include/ros2_medkit_linux_introspection/systemd_utils.hpp | Utility to escape unit names for systemd DBus object paths. |
| src/ros2_medkit_discovery_plugins/ros2_medkit_linux_introspection/include/ros2_medkit_linux_introspection/procfs_utils.hpp | ProcessInfo → JSON helper for procfs responses. |
| src/ros2_medkit_discovery_plugins/ros2_medkit_linux_introspection/include/ros2_medkit_linux_introspection/proc_reader.hpp | Public API for proc reader + PID cache types. |
| src/ros2_medkit_discovery_plugins/ros2_medkit_linux_introspection/include/ros2_medkit_linux_introspection/container_utils.hpp | CgroupInfo → JSON helper for container responses. |
| src/ros2_medkit_discovery_plugins/ros2_medkit_linux_introspection/include/ros2_medkit_linux_introspection/cgroup_reader.hpp | Public API for cgroup reader types/utilities. |
| src/ros2_medkit_discovery_plugins/ros2_medkit_linux_introspection/CMakeLists.txt | Builds shared utils library + plugin modules + tests. |
| docs/tutorials/linux-introspection.rst | New tutorial documenting plugin setup, endpoints, and behavior. |
| docs/tutorials/index.rst | Adds the new tutorial page to the docs index. |
| docs/api/rest.rst | Documents vendor extension endpoints and security considerations. |
| .devcontainer/Dockerfile | Adds libsystemd-dev for plugin development in the devcontainer. |
...os2_medkit_discovery_plugins/ros2_medkit_linux_introspection/src/linux_utils/proc_reader.cpp
Show resolved
Hide resolved
...os2_medkit_discovery_plugins/ros2_medkit_linux_introspection/src/linux_utils/proc_reader.cpp
Show resolved
Hide resolved
src/ros2_medkit_integration_tests/test/docker/introspection/run_docker_tests.sh
Outdated
Show resolved
Hide resolved
src/ros2_medkit_integration_tests/test/docker/introspection/docker-compose.container.yml
Outdated
Show resolved
Hide resolved
src/ros2_medkit_discovery_plugins/ros2_medkit_linux_introspection/src/systemd_plugin.cpp
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Pull request overview
Adds a new ros2_medkit_linux_introspection plugin package that enriches gateway discovery with Linux OS/process metadata (procfs, systemd, container), plus accompanying gateway/plugin API changes, tests, and documentation.
Changes:
- Introduces three Linux introspection plugins (procfs/systemd/container) with shared Linux utility readers and unit tests.
- Extends the gateway plugin API/context to support Component→App aggregation and exports gateway headers for downstream plugins.
- Adds integration + docker-based tests and documents the new vendor-extension endpoints and usage.
Reviewed changes
Copilot reviewed 35 out of 35 changed files in this pull request and generated 9 comments.
Show a summary per file
| File | Description |
|---|---|
src/ros2_medkit_integration_tests/test/features/test_procfs_introspection.test.py |
Launch-testing coverage for procfs endpoint + component aggregation. |
src/ros2_medkit_integration_tests/test/features/test_combined_introspection.test.py |
Validates multiple plugins loaded simultaneously and route isolation. |
src/ros2_medkit_integration_tests/test/docker/introspection/test_systemd_introspection.py |
External pytest suite for systemd plugin inside systemd-enabled container. |
src/ros2_medkit_integration_tests/test/docker/introspection/test_container_introspection.py |
External pytest suite for container plugin and cgroup limit reporting. |
src/ros2_medkit_integration_tests/test/docker/introspection/run_docker_tests.sh |
Scripted runner for docker-based introspection tests. |
src/ros2_medkit_integration_tests/test/docker/introspection/docker-compose.systemd.yml |
Compose stack for privileged systemd-in-container scenario. |
src/ros2_medkit_integration_tests/test/docker/introspection/docker-compose.container.yml |
Compose stack for container/cgroup limit scenario. |
src/ros2_medkit_integration_tests/test/docker/introspection/Dockerfile.systemd |
Multi-stage build to run gateway + demo nodes under systemd. |
src/ros2_medkit_integration_tests/test/docker/introspection/Dockerfile.container |
Multi-stage build to run gateway + demo nodes in a container-limits scenario. |
src/ros2_medkit_gateway/src/plugins/plugin_context.cpp |
Implements PluginContext::get_child_apps() for component aggregation. |
src/ros2_medkit_gateway/include/ros2_medkit_gateway/plugins/plugin_context.hpp |
Adds new plugin context method for component→apps enumeration. |
src/ros2_medkit_gateway/CMakeLists.txt |
Exports symbols/includes needed for dlopen’d plugins and downstream headers. |
src/ros2_medkit_gateway/CHANGELOG.rst |
Notes addition of Linux introspection plugins. |
src/ros2_medkit_discovery_plugins/ros2_medkit_linux_introspection/CMakeLists.txt |
New plugin package build (utils lib + 3 MODULE plugins + tests). |
src/ros2_medkit_discovery_plugins/ros2_medkit_linux_introspection/package.xml |
Declares dependencies for the new plugin package. |
src/ros2_medkit_discovery_plugins/ros2_medkit_linux_introspection/src/procfs_plugin.cpp |
procfs vendor endpoints + discovery introspection provider. |
src/ros2_medkit_discovery_plugins/ros2_medkit_linux_introspection/src/systemd_plugin.cpp |
systemd vendor endpoints + sd-bus property querying. |
src/ros2_medkit_discovery_plugins/ros2_medkit_linux_introspection/src/container_plugin.cpp |
container vendor endpoints + cgroup detection/limits. |
src/ros2_medkit_discovery_plugins/ros2_medkit_linux_introspection/src/linux_utils/proc_reader.cpp |
/proc scanning/reading + TTL-based PID cache implementation. |
src/ros2_medkit_discovery_plugins/ros2_medkit_linux_introspection/src/linux_utils/cgroup_reader.cpp |
cgroup v2 parsing + resource limit reads. |
src/ros2_medkit_discovery_plugins/ros2_medkit_linux_introspection/include/ros2_medkit_linux_introspection/*.hpp |
Public utility headers for procfs/container/systemd helpers. |
src/ros2_medkit_discovery_plugins/ros2_medkit_linux_introspection/test/test_*.cpp |
Unit tests for utils and JSON serialization helpers. |
docs/tutorials/linux-introspection.rst |
New tutorial describing plugins, configuration, endpoints, and troubleshooting. |
docs/tutorials/index.rst |
Adds the new tutorial to docs navigation. |
docs/api/rest.rst |
Documents vendor-extension endpoints and security warning for procfs cmdline exposure. |
.devcontainer/Dockerfile |
Adds libsystemd-dev for local development builds. |
src/ros2_medkit_integration_tests/test/docker/introspection/run_docker_tests.sh
Outdated
Show resolved
Hide resolved
src/ros2_medkit_integration_tests/test/docker/introspection/docker-compose.container.yml
Outdated
Show resolved
Hide resolved
src/ros2_medkit_gateway/include/ros2_medkit_gateway/plugins/plugin_context.hpp
Show resolved
Hide resolved
src/ros2_medkit_discovery_plugins/ros2_medkit_linux_introspection/src/systemd_plugin.cpp
Outdated
Show resolved
Hide resolved
src/ros2_medkit_integration_tests/test/features/test_procfs_introspection.test.py
Show resolved
Hide resolved
src/ros2_medkit_integration_tests/test/features/test_combined_introspection.test.py
Show resolved
Hide resolved
...os2_medkit_discovery_plugins/ros2_medkit_linux_introspection/src/linux_utils/proc_reader.cpp
Show resolved
Hide resolved
src/ros2_medkit_discovery_plugins/ros2_medkit_linux_introspection/src/container_plugin.cpp
Show resolved
Hide resolved
...2_medkit_discovery_plugins/ros2_medkit_linux_introspection/src/linux_utils/cgroup_reader.cpp
Outdated
Show resolved
Hide resolved
- Add parse error logging in cgroup_reader catch blocks instead of silently swallowing exceptions - Extract duplicated configure() logic into shared parse_introspection_config() free function (plugin_config.hpp) - Install vendored tl::expected under namespaced path to prevent header conflicts with downstream packages - Document composable nodes PID resolution limitation in troubleshooting section
…ages Add install(DIRECTORY include/) and ament_export_include_directories() so external packages can find_package(ros2_medkit_gateway) and get plugin interface headers (GatewayPlugin, IntrospectionProvider, etc.) and vendored tl::expected.
…egation Add method to enumerate child Apps for a Component via entity cache. Needed by introspection plugins for Component-level vendor endpoints.
Add new ROS 2 package for Linux introspection plugins with: - Static utility library (medkit_linux_utils) - Three MODULE plugin targets (procfs, systemd, container) - Stub source files and tests - CMake config with fPIC, ccache, linting
- read_process_info: parse /proc/{pid}/stat, status, cmdline, exe
- find_pid_for_node: scan /proc for ROS 2 nodes by __node:= and __ns:= args
- Tests use both real /proc/self and synthetic /proc in tmpdir
- extract_container_id: Docker, podman, containerd cgroup path patterns - detect_runtime: identify container runtime from cgroup path - is_containerized: check if PID runs in a container - read_cgroup_info: cgroup v2 resource limits (memory.max, cpu.max) - All tests use synthetic cgroup filesystem in tmpdir
- Scans /proc for ROS 2 nodes by parsing cmdline args - Thread-safe with shared_mutex (concurrent reads, exclusive refresh) - Auto-refresh on TTL expiry during lookup - Tests with synthetic /proc in tmpdir - Move parse_ros_args out of anonymous namespace for PidCache access - Change TTL type to steady_clock::duration for sub-second precision
- IntrospectionProvider: detects containerized Apps via cgroup path analysis
- Supports Docker, podman, containerd runtime detection
- Reads cgroup v2 resource limits (memory.max, cpu.max)
- Vendor routes: GET /apps/{id}/x-medkit-container, GET /components/{id}/x-medkit-container
- 404 when node not containerized, Component aggregation by container ID
- PidCache stored as unique_ptr to avoid shared_mutex move-assignment issue
- IntrospectionProvider: maps Apps to PIDs, returns ProcessInfo metadata
- Vendor routes: GET /apps/{id}/x-medkit-procfs, GET /components/{id}/x-medkit-procfs
- Component aggregation: unique processes with node_ids lists
- PidCache for efficient /proc scanning with configurable TTL
- 503 on PID lookup failure (transient - node may have crashed)
- IntrospectionProvider: maps Apps to systemd units via sd_pid_get_unit
- Queries unit properties via sd-bus (ActiveState, SubState, NRestarts, WatchdogUSec)
- Vendor routes: GET /apps/{id}/x-medkit-systemd, GET /components/{id}/x-medkit-systemd
- 404 when node not in a systemd unit, Component aggregation by unit name
- Configuration, API reference with curl examples, requirements - Troubleshooting for PID lookup, permissions, systemd access - Added to tutorials toctree after plugin-system
Call the extracted function directly with controlled inputs. Verifies all JSON fields including new state, cpu_*_seconds, and uptime_seconds behavior (zero start time, negative clamping).
Test dot, hyphen, at-sign, slash, and empty string escaping. Move test outside if(SYSTEMD_FOUND) since it only uses header-only systemd_utils.hpp and no longer needs libsystemd.
Call the extracted function from container_utils.hpp directly. Test all fields set and optionals unset, verifying optional fields are omitted from JSON when not set.
Add REQ_INTEROP_003 traceability tags to all unit tests. Add multi-threaded PidCache test to verify no crashes or deadlocks under concurrent access with frequent TTL expiry.
Document all 6 x-medkit-procfs, x-medkit-systemd, and x-medkit-container endpoints with request/response schemas, error codes, and security warning about cmdline exposure.
Change memory_limit_bytes assertion from conditional to hard assertion since Docker compose sets known limits. Add REQ_INTEROP_003 traceability tags to all Docker integration tests.
Add note that paths are relative to colcon workspace root to prevent confusion when launching from a different directory.
- Bump PLUGIN_API_VERSION to 2 (ABI break from get_child_apps vtable change) - Use SCNu64 instead of %lu for portable uint64_t sscanf - Add ss.fail() check for truncated /proc/pid/stat files - Change libsystemd-dev from build_depend to depend in package.xml
PidCache::refresh() built FQN as node_ns + '/' + node_name, producing '//node' when __ns:=/. Gateway's effective_fqn() returns '/node', so cache lookups always missed for root-namespace nodes.
- Replace deploy.resources.limits with mem_limit/cpus (deploy block ignored by docker compose up without swarm mode) - Use Go template instead of JSON for health status parsing to avoid array vs dict ambiguity across Docker Compose versions
- Fix PID lookup error code from 503 to 404 (matches implementation) - Clarify each plugin has its own PID cache (not shared) - Fix metadata section: data is via vendor endpoints, not discovery responses
…quests Open one sd_bus_open_system() per request in handle_component_request() and introspect(), passing the connection to query_unit_info(). Falls back to per-call connection if shared bus is nullptr (handle_app_request).
The poll_endpoint_until lambda only waited for temp_sensor to appear before asserting rpm_sensor and pressure_sensor existed, causing intermittent failures on slower CI runners (Rolling) where nodes haven't all been discovered yet.
- Add parse error logging in cgroup_reader catch blocks instead of silently swallowing exceptions - Extract duplicated configure() logic into shared parse_introspection_config() free function (plugin_config.hpp) - Install vendored tl::expected under namespaced path to prevent header conflicts with downstream packages - Document composable nodes PID resolution limitation in troubleshooting section
…plugins The ros2_medkit_linux_introspection package uses tl::expected in its headers but the vendored include directory was not exported via ament_export_include_directories. Also add missing get_child_apps() override to FakePluginContext in graph provider tests after rebase.
560085c to
0340f64
Compare
- Add parse error logging in cgroup_reader catch blocks instead of silently swallowing exceptions - Extract duplicated configure() logic into shared parse_introspection_config() free function (plugin_config.hpp) - Install vendored tl::expected under namespaced path to prevent header conflicts with downstream packages - Document composable nodes PID resolution limitation in troubleshooting section
- Bump all 13 package.xml files from 0.3.0 to 0.4.0 - Update version.hpp fallback to 0.4.0 - Add 0.4.0 sections to all existing CHANGELOG.rst files - Create initial CHANGELOG.rst for new packages (ros2_medkit_cmake, ros2_medkit_linux_introspection, ros2_medkit_beacon_common, ros2_medkit_param_beacon, ros2_medkit_topic_beacon, ros2_medkit_graph_provider) - Fix gateway changelog: move post-0.3.0 items (#258, #263) from 0.3.0 section to new 0.4.0 section - Add scripts/release.sh for automated version bump and verification Refs: #278
- Bump all 13 package.xml files from 0.3.0 to 0.4.0 - Update version.hpp fallback to 0.4.0 - Add 0.4.0 sections to all existing CHANGELOG.rst files - Create initial CHANGELOG.rst for new packages (ros2_medkit_cmake, ros2_medkit_linux_introspection, ros2_medkit_beacon_common, ros2_medkit_param_beacon, ros2_medkit_topic_beacon, ros2_medkit_graph_provider) - Fix gateway changelog: move post-0.3.0 items (#258, #263) from 0.3.0 section to new 0.4.0 section - Add scripts/release.sh for automated version bump and verification Refs: #278
- Bump all 13 package.xml files from 0.3.0 to 0.4.0 - Update version.hpp fallback to 0.4.0 - Add 0.4.0 sections to all existing CHANGELOG.rst files - Create initial CHANGELOG.rst for new packages (ros2_medkit_cmake, ros2_medkit_linux_introspection, ros2_medkit_beacon_common, ros2_medkit_param_beacon, ros2_medkit_topic_beacon, ros2_medkit_graph_provider) - Fix gateway changelog: move post-0.3.0 items (#258, #263) from 0.3.0 section to new 0.4.0 section - Add scripts/release.sh for automated version bump and verification Refs: #278
Pull Request
Summary
Add three Linux introspection plugins that enrich gateway discovery with OS-level metadata. Each plugin implements
IntrospectionProviderand registers vendor REST endpoints on Apps and Components:libprocfs_introspection.so) - reads/procfor process info (PID, RSS, CPU ticks, threads, exe path, cmdline)libsystemd_introspection.so) - maps ROS 2 nodes to systemd units viasd_pid_get_unit(), queries properties via sd-buslibcontainer_introspection.so) - detects Docker/podman/containerd via cgroup path analysis, reads cgroup v2 resource limitsAlso includes:
libmedkit_linux_utils.awithproc_reader,cgroup_reader, andPidCache(TTL-based, thread-safe)PluginContext::get_child_apps()for Component-level aggregationlibsystemd-devadded to devcontainer DockerfileIssue
Type
Testing
Unit tests (31 new, all in
ros2_medkit_linux_introspection):test_proc_reader- real/proc/self+ synthetic/procin tmpdir (4 tests)test_cgroup_reader- container ID extraction, runtime detection, resource limits (10 tests)test_pid_cache- TTL refresh, auto-refresh, missing nodes, empty/nonexistent proc dirs (6 tests)test_procfs_plugin- JSON serialization (1 test)test_systemd_plugin- JSON serialization, graceful skip (2 tests)test_container_plugin- JSON serialization, not-containerized skip (2 tests)Integration tests (launch_testing):
test_procfs_introspection- live PID mapping, resource usage, Component aggregation, capabilities, 404test_combined_introspection- procfs + container route isolation (200 + 404 coexistence on host)Docker integration tests (standalone pytest):
test_systemd_introspection- unit info, restart count, watchdog, aggregationtest_container_introspection- container ID, runtime, memory/CPU limits, aggregationFull suite: 1302 unit tests pass, 2066 lint tests pass, 0 failures.
Checklist