Inspect examples

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 'fuchsia-pkg://'
    $ ffx component start '/core/ffx-laboratory:echo_realm/echo_client'
  • Rust

    $ ffx component run 'fuchsia-pkg://'
    $ 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'
    filename = fuchsia.inspect.Tree
    component_url = #meta/
    timestamp = 2601204210478
      bytes_processed = 14
      request_count = 1
        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

Additional Inspect examples

  • Inspect codelab: Interactive codelab demonstrating additional Inspect concepts.
  • Inspect Dart: A simple module that demonstrates Inspect usage from within Flutter/Dart.
  • Ergonomic Inspect: Demonstration of the fuchsia_derive_inspect Rust crate.