tree: 60800b082816cc1131e87a2811b1798c7fceb5df [path history] [tgz]
  1. build/
  2. src/
  3. test_data/

Triage (fx triage)

Reviewed on: 2019-12-08

Triage analyzes bugreports for out-of-range values. The analysis is specified by configuration files.


To add this project to your build, append --with //src/diagnostics/triage in the fx set invocation.

For example:

fx set core.chromebook-x64 --with '//topaz/bundles:buildbot' --with //src/diagnostics/triage


To fetch and analyze a fresh bugreport from the default device:

fx triage

To analyze an existing bugreport:

fx triage --inspect /path/to/

To specify config files to use:

fx triage --config path/file1 --config path/file2 --config "path/with/globs/*.triage"

Note that the triage command, not the OS, must expand the globs, so put the path in quotes.

TODO(cphoenix): Should these paths be relative to tree-root, or CWD?

Config file format is described in Configuring ‘fx triage’. It includes:

  • Selector metrics which specify the data to extract from the inspect.json produced by
  • Eval metrics which specify calculations
  • Actions to take if a condition is true (currently, only “print a warning”)
  • Tests to ensure your actions trigger (or not) appropriately with sample data you supply.


Use --with //src/diagnostics/triage:tests for all tests.

Unit tests for the Rust code are linked into CQ/CI. There are also a series of integration tests which live in the file which are run in CQ/CI as well. To run them manually:

fx test triage_lib_tests

Source layout

  • //tools/devshell/contrib/triage - A bash script which implements the entry point to the “fx triage” command.
    • By default, it invokes //src/diagnostics/triage/src/ to analyze a bugreport.
    • With the --test argument, it dispatches an integration test by invoking //src/diagnostics/triage/ test/src/
  • //src/diagnostics/triage/src/
    • - Entry point of the main “triage” program. It reads command line arguments, loads the config files and inspect.json file that they specify, and then processes the actions and self-tests specified in the config files.
    • - Data structures and calculation engine for metrics.
      • metrics/ - Business logic to read values from the inspect.json file.
    • - Data structures and business logic to store and carry out actions.
    • - The data structures and business logic to store and evaluate the self-tests specified in the config files.
    • - Loads configuration information from *.triage files.
      • config/ - A nom-based parser for Eval metrics.
  • //src/diagnostics/triage/test_data/ - Data which is used in integration testing.
  • //src/diagnostics/triage/build
    • triage_config_test.gni defines a gn target to run config tests in CQ.
    • triage_config_test_runner defines a binary which executes the tests for the triage_config_test.gni target.