This directory contains examples components using the Inspect libraries. For more details on Inspect, see component inspection
If these components are not present in your build, they can be added by appending --with //examples to your fx set command:
$ fx set core.x64 --with //examples --with //examples:tests $ fx build
If you do not already have one running, start a package server so the example components can be resolved from your device:
$ fx serve
To run one of the example components defined here, provide the full component URL to run, then bind to the client component:
C++
$ ffx component run /core/ffx-laboratory:echo_realm 'fuchsia-pkg://fuchsia.com/inspect-example-cpp#meta/echo_realm.cm' $ ffx component start '/core/ffx-laboratory:echo_realm/echo_client'
Rust
$ ffx component run /core/ffx-laboratory:echo_realm 'fuchsia-pkg://fuchsia.com/inspect-example-rust#meta/echo_realm.cm' $ ffx component start '/core/ffx-laboratory:echo_realm/echo_client'
This starts the echo_client component, which sends a request message to the echo_server for each argument. Each request is tracked by echo_server using Inspect.
Use ffx inspect show to review the metrics collected by echo_server:
$ ffx inspect show 'core/ffx-laboratory\:echo_realm/echo_server' core/ffx-laboratory\:echo_realm/echo_server: metadata: filename = fuchsia.inspect.Tree component_url = #meta/echo_server.cm timestamp = 2601204210478 payload: root: bytes_processed = 14 request_count = 1 fuchsia.inspect.Health: start_timestamp_nanos = 2169252928627 status = OK
You can run ffx component start multiple times to watch the server metrics increment with each request.
To run one of the test components defined here, provide the package name to fx test:
C++
$ fx test inspect-example-cpp-tests
Rust
$ fx test inspect-example-rust-tests
fuchsia_derive_inspect Rust crate.