Cobalt is a system for collecting metrics from Fuchsia devices, sending metric observations to servers running in the cloud, aggregating and analyzing the collected observations and generating useful reports and visualizations. Cobalt emphasizes the preservation of user privacy while collecting high-quality, useful analytics.
As of this writing, the way to use Cobalt to collect metrics when added noise for privacy preservation is not desired is to pick one of the existing privacy preserving encodings and use an encoding configuration in which the noise level is set to zero, e.g. randomized response with p=0.0 and q=1.0. This approach leads to a more awkward interface than one might like. We will soon have new more convenient and powerful encodings which will make this situation better.
Report Configuration A specification of a collection of Observations and a manner of aggregating them into a report, e.g. A histogram of the number of times that events E, F and G occurred yesterday.
Config Registration. To use Cobalt from within Fuchsia, you must have a project, and one or more metrics, encoding configs and report configs registered with Cobalt's configuration system.
In the current version of Cobalt, config registration consists of entries in files checked into source control:
//third_party/cobalt/config/production. Since the Cobalt servers also read these files, for now it is necessary to coordinate with firstname.lastname@example.org in order to register additional projects, metrics, encodings and reports. We plan to build an online self-registration system in the future.
You have two options. One option is to send an e-mail to email@example.com (or contact one of us personally if you prefer) and describe what new data you are trying to collect. We would be happy to discuss with you the different options for how to accomplish what you want and then add the additional configuration ourselves. This is probably the right choice for you for your initial couple of interactions with Cobalt.
If you prefer you may instead edit some files in source control yourself and send us a CL.
//third_party/cobalt/config/productionmake the appropriate changes to
If you are not sure what the appropriate changes are then use the first option mentioned above--ask firstname.lastname@example.org to do it for you.
These files are consumed by the Cobalt servers and so after the CL is committed, the Cobalt team needs to push the changes to the servers.
WARNING: One potentially confusing issue is that the Fuchsia Jiri manifests pull a pinned commit of Cobalt rather than pulling Cobalt at head. This is configured via the “revision” property of the “cobalt” |project| entry in the file //manifest/cobalt_client. This means that after committing changes to the above files, if you then delete your local Cobalt branch and do a
jiri update then your local copy of //third_party/cobalt will not contain the edits you just committed. This actually doesn‘t matter because the files you just changed are not consumed by Fuchsia’s Cobalt client. They are only consumed by the server.
//apps/cobalt_client/src/config.hcopy your changes from above. This file contains some C++ string literals that are copies of the contents of the files you changed above. This is what is consumed by Fuchsia's Cobalt client. This hacky mechanism will be replaced by something more sensible in due course.
Cobalt employs different types of encodings and for some encodings some amount of pre-registration of values may be required. We plan to develop additional encodings where pre-registration will not be necessary. Here we mention a few cases that are relevant to teams currently using Cobalt:
After registration, Fuchsia code uses Cobalt through it's FIDL interface. See
//apps/cobalt_client/services/cobalt.fidl. Also see
//apps/cobalt_client/src/cobalt_testapp.cc for example usage of the FIDL API.
We are working on building an online site for running and visualizing reports. For now we offer a command-line client.
Run the python script
download_report_client.py. This will detect the platform on which you are running and download a pre-built binary from Google Cloud storage. The script will check the sha1 of the downloaded file.
If we do not have a pre-built binary for your platform you may be able to build the binary yourself. The Go source code is located in the Cobalt repo. You will have to follow the instructions in the README.md file their for building Cobalt. The resulting binary will be located at
You invoke the report_client as follows:
./report_client -report_master_uri=22.214.171.124:7001 -project_id=<project_id>
This will enter an interactive command line interface. In order to run a report for report config 1 over the two day period consisting of two-days-ago and yesterday you enter the command:
run range -2 -1 1
You can also run in a non-interactive mode and generate a CSV file as follows:
./report_client -report_master_uri=126.96.36.199:7001 \ -project_id=<project_id> -interactive=false -first_day=-2 -last_day=-1 \ -report_config_id=1 -csv_file=report.csv