Without this setting, arguments passed to a function can be packed in
more than one line, with more than one argument per line.
For example, the following code will be formated as this without the
BinPackArguments:
CallMyFunction(
with_more_than_one, argument_per_line,
event_they_dont_fit_in_a_single_line);
On the other hand, with BinPackArguments: false, that code will be
split in:
CallMyFunction(
with_more_than_one,
argument_per_line,
event_they_dont_fit_in_a_single_line);
or all the arguments in the same line if they all fit.
Bug: None
TEST=None
Change-Id: I48627e66e2a841f89418c0763e7fe6c3e6ea7387
This CL adds two more checks:
* When populating a closed log with the metadata, make sure the
SystemProfileSetter is not null.
* When using the update engine client library, check if the update
engine client object was created correctly. The returning object can
be null if update engine's binder service is not running.
Bug: 26731548
Change-Id: I8a615c87f33e15a163d56ccfa3a932a0908aac5f
The new libchrome has been ported from Chromium and some APIs have
changed. Make necessary changes at call sites.
Change-Id: I9e45975cdef43913270b82e3fca2c027e614a464
This will allow the tests to be run by the continuous builder.
Bug: 26571398
Change-Id: I7eae2761603e83e3d1f003cb3b06582abc4ed24f
Test: Build an eng build. The tests are installed.
When metricsd receives a SIGTERM signal (on system shutdown for
example), save the metrics to disk before exiting.
Bug: 26184202
Test: Start metricsd. Log a metric sample. Stop metricsd. The metric is
saved to disk.
Change-Id: Ib224efa8837130393fac5d06fa80d320263cfc84
Every now and then (5 minutes by default), the uploader will persist the
current metrics to disk to avoid losing them in case we exit
unexpectedly (reboot or crash).
When starting up, metricsd will load the previously saved log and resume
the metrics collection from there.
Bug: 25670584
Test: Unit tests.
Test: manual: restart metricsd. The saved log is detected and parsed
correctly.
Test: manual: Send a sample to metricsd, send SIGTERM to metricsd, the
log is saved to disk, metricsd restarts and picks up the log where it
left.
Change-Id: I4cefc62c7ea1fa51333d84d8a7ba0a2e9c7fd58f
metricsd should shutdown cleanly when receiving a TERM signal:
* stop the binder watcher.
* wait for the thread to quit.
* Exit cleanly.
Note: This is not directly used as we don't send SIGTERM on shutdown or
when stopping services yet.
Bug: 25670584
Change-Id: I878d1e67474c72d24790f3540470e37a23112a95
weaved::Service::AddCommandHandler() and SetStateProperty() now
expect the trait name as a separate argument.
BUG: 26443877
Change-Id: I2ad587d984375a7ebd70c7dc804b446b66d6be1b
Now that weaved provides a binder interface for its IPC, switch
to using it instead.
BUG: 23782171
Change-Id: Ic3c485f99580fe41e287eaf238f033149787f181
This fixes the documentation for UploadService and the README file:
* stop mentioning Chrome OS as we forked the code.
* update the histogram declaration workflow. It is not tied to Chrome's
histograms.xml file anymore.
* update the architecture explanation of metricsd. We split
metrics_daemon into two daemons and are now using binder to log
metrics.
* convert README to markdown to make it prettier when viewed in gitiles.
Bug: 26314417
Change-Id: I1e492f1211c1784e65dd4d3e473bb9aacefc3b5d
/data/misc/metricsd only needs to be accessed by metricsd.
/data/misc/metrics_collector only needs to be accessed by
metrics_collector.
/data/misc/metrics needs to be writable by metrics_collector
and readable by metricsd. Make it 0750 metrics_collector:system
and keep running metricsd as group 'system' to allow reading.
Bug: 26337609
Change-Id: I169573cc547f154daa8b65c5f13bdc20964a3f2c
IMetricsCollectorService implementation moved from libmetricscollectorservice
to metrics_collector executable, which means it needs to be compiled into test
main as well.
Bug: None
Change-Id: I29b0a3ae6164d2256366d61c3a3639d22b943a69
No longer needed to trampoline between RTTI and non-RTTI compiles.
Move the service impl from libmetricscollector service to the
metrics_collector executable, now that RTTI is no longer used (and the impl
is not used by binder clients).
Other fixups, including:
* Move service registration and binder watcher to metrics_collector main.
* Compile libmetricscollectorservice with clang just because.
Bug: 26292405
Change-Id: Iae8115c13b203ff03d49bf7678d5eb3ede30e855
There is no longer a reliance on RTTI in libbrillo, so disable RTTI
in the rest of Brillo codebase.
Bug: 26292405
Change-Id: I2751a2ac973a74741a82f5cd949fc0adaf2449a6
The new server push enabled component/trait validation rules. This
allows us to use the new schema that does not require vendor commands,
parameters and state to start with underscore ("_").
Also fixed a few minor errors in schema definition.
Change-Id: I184dd8e4c69c05e0dd1b0dddb1f9a7b0aef78841
Switch user crash event notification from D-Bus to this Binder service.
Add a trampoline as a go-between for the -frtti and -fno-rtti sources.
Add MetricsCollectorServiceClient for crash_reporter to use, hiding the
binder proxy details.
Remove D-Bus message filtering from metrics_collector.
Bug: 25929888
Change-Id: Idcdd60ac476340fb11602fc9afab6cd87843e529
Assert abort metricsd if binder service registration fails.
If the addService() call fails (for reasons that at least include an SELinux
policy denial), the call to joinThreadPool() apparently processes a stale
pending weak dereference that triggers an abort on a probable double-free:
F libc : Invalid address 0xbe8bfa30 passed to free: value not allocated
F libc : Fatal signal 6 (SIGABRT), code -6 in tid 609 (metricsd)
Since metricsd is severely hobbled if registration fails, abort and see if
things work better the next time. If not, the crash loop will hopefully
attract attention to the problem.
Change-Id: I520d0eafb9cb25ee225d589bfd87df4e51f6b181
Removed command and state definitions and use trait definitions
instead. Also, create "metrics" component for weave.
BUG: 25916429, 25916428, 25917426
Change-Id: Icc02d1c46c371d3afa8e4723852f182992c62bf2
This CL adds a dump command to metrics_client that will dump the
histograms, aggregated by metricsd since it started, in a human readable
format.
This is useful for developers to ensure that their code uses libmetrics
correctly and the reported values are correct.
Sample output (redacted to fit the commit message):
$ metrics_client -d
Histogram: hello recorded 5 samples, average = 54.8 (flags = 0x1)
0 ...
9 --------O (1 = 20.0%) {0.0%}
16 O (0 = 0.0%) {20.0%}
29 --------O (1 = 20.0%) {20.0%}
54 ------------------------O (3 = 60.0%) {40.0%}
100 O (0 = 0.0%) {100.0%}
$
Bug: 25817310
Test: * Send a histogram with metrics_client.
* `metrics_client -d` shows it.
Change-Id: Id186dc5463403ca9181ee9eef8f46b5e809b8714
This CL converts metricsd, libmetrics and metrics_collector to use
Binder to pass metrics samples.
Bug: 25670685
Change-Id: I657faecdf4ed1226ab30ce69e062028463437e7b
This will make it easier to catch formatting nits.
This style is based on the Google style guide (well known publicly) and
follows the Chromium style changes we have adopted.
Bug: 25887990
Change-Id: If9562223752dfe611a32c341e703338f806bcc0f
Instead of using a single directory for both the internal data of
metricsd and metrics_collector and the shared files (metrics samples log
file and the metrics enabled file), we should use separate directory to
allow for a finer access control.
The new structure will be:
* /data/misc/metrics for the files accessible to all daemons reporting
metrics, metricsd and metrics_collector.
* /data/misc/metricsd for the private files of metricsd.
* /data/misc/metrics_collector for the private files of
metrics_collector.
Bug: 25886951
Test: Unit tests.
Test: Manual: metricsd and metrics_collector run without errors.
Change-Id: I006d19f45f5f419d2b08744126c2e2a0b899c9fa
Instead of using a global directory for persistent integers, specify the
directory to use in the constructor.
This will make changing the backing directory easier.
Bug: 25886951
Change-Id: I590816b195fa81b179a5ec78b9cdf41bc86353dc
This CL splits metrics_daemon into two independent daemons: metricsd and
metrics_collector.
* metricsd will be responsible for reading the metrics from disk and
periodically uploading them to the server.
* metrics_collector will be responsible for gathering generic metrics
from the system and managing the weave state for metrics.
This refactoring is necessary to prepare the migration of metricsd to
log over binder.
Bug: 25670908
Test: Unit tests.
Test: manual: both daemons run. Metrics are logged, uploaded and the
weave interaction works.
Change-Id: Ib00e1772bb7eec87cbcdcd912c30b555d79d7074
If the product id is not set, the product_id file might exist but be
empty. In this case, to try to update the metrics.
Bug: 25745391
Change-Id: I3942afaf38921b44ddb7e5a29d5d0e4fb6d48d94
Test: Unit tests.
We don't report the cpu frequency, we can remove that part of the code.
Bug: 25693224
Test: unit tests.
Change-Id: I510654a74261dbd66b7183ea54eef1e1eadc4d91
libupdate_engine_client returns the channel as "stable-channel",
"dev-channel" or "beta-channel". This CL updates the parsing logic to
match this format.
Bug: 25669566
Test: unit tests
Test: manual: The reported channel matches what update_engine_client
--show_channel reports.
Change-Id: Ic6e52df892ae0b438f58fc05b178d5844d6674d0
metricsd should only log to a single location (stderr or syslog):
* standard error if --logtostderr is set or metricsd runs in the
foreground.
* syslog if --logtosyslog is set or metricsd is daemonized.
Bug: 25472752
Change-Id: Idb918714e1b6975d79682f22495a7ca708d4d97d
Collect a new histogram (Platform.CpuUsage.Percent), collecting the
average cpu usage in percent of the total cpu usage possible (across all
cpus).
This measurement is collected every minute.
Bug: 25231576
Test: unit tests.
Test: Manual testing.
Change-Id: I1c63486c177f0c2d4bd361eb9e351a7ca25b80d9
When the model manifest id is defined in weave, report it.
Bug: 25386505
Test: the model manifest id is uploaded when defined.
Test: If weaved.conf is not defined, metricsd uploads the default value.
Change-Id: Ic895671621fda9ce5cdeacdbdba58aa73a6887fc
So that this daemon doesn't change on every build, use the system build
date from libchrome (which reads ro.build.date). That way we don't have
to update this daemon for every OTA.
Bug: 24204119
Change-Id: I136d53e5e4ebb9430a57dace66198d8d704d7ca3
The /data directory isn't guaranteed to be mounted during the
"on boot" trigger, so switch them to using "on post-fs-data".
Bug: 24941965
Change-Id: Iee84ca0e934967cff7bc4d968d9939d398c73980
This stops relying on system properties to provide build time
configuration.
Product version and id will be stored in /etc/os-release.d.
Channel will be pulled from update engine.
BUG: 24947119
Change-Id: I0972d03cd83ef622846de3cce3dec1992fcc46cd
libchromeos is transitioning to libbrillo and chromeos namespaces
and include directory is changing to brillo.
Bug: 24872993
Change-Id: I797613a38c7444a113f12e38366a424388477276
Weave has changed some of D-Bus APIs and metrics needs to be updated
accrdingly. Command::Done is replaced with Complete(), Command::Abort
now takes error code and error messages, Command::category is removed
and Command::status is renamed to Command::state
Change-Id: Ifbfd6d852f4a328168e28484d1152a24b8c8b42b
We use product_id instead of build_target_id, the protobuffer should
rename that field too to be consistent.
The same change was made on the backend.
BUG: 24712895
Change-Id: Id9492e3debab986c9df7d4ec0caef8730eb14240
metrics_daemon will export _metrics._AnalyticsReportingState containing
"enabled"/"disabled" depending on the current state and two weave
commands (_metrics._{enable,disable}AnalyticsReporting) to update it.
BUG: 24386281
TEST: manual. Enabled and disabled metrics reporting.
`metrics_client -c` reports the correct answer.
Change-Id: Ic4a5ffc1e9f9cbc0b47ee34d3af83584d95da155
metrics_daemon should never get a stale answer on whether or not the
metrics are enabled.
This is important as metrics_daemon will be the "source of truth" for
other components.
BUG: 24386281
TEST: unit tests.
Change-Id: I573568abe5d1b840683cede2fdf32cdae028a81a
Instead of reporting the metrics over both a long and a short period,
collect and report only over a short period. This makes the code simpler
and the metrics easier to understand.
Also move the collection out of metrics_daemon and into a separate
collector to make it simpler to understand.
BUG: 24464945
Change-Id: I17e52536aaa75321a5e34f42ed488545c2c3efde