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
We cached the enabled status for metrics as a static field in the
metrics library. This field is not reset in between tests which treats
the metrics as enabled if they were enabled previously.
None of the users rely on the caching being static so the cached status
was changed into a field.
Also enabled the metrics in upload_service_test.cc after verifying that
the test failed consistently.
BUG: 24473349
TEST: unit tests.
Change-Id: If05fdca644016d923aa7b1978db5e74ada563c1a
We can use the LOCAL_INIT_RC variable for init.rc files.
Also, switch to use <service>.rc for the filename, since this is what
Android does now.
Bug: 24465893
Change-Id: Ibf4715c3b0352422b98afc04abfd68a42a46149c
Instead of using daily, weekly, the daily/weekly metrics should use
.PerDay and .PerWeek to be consistent with other metrics' names.
BUG: 24412660
Change-Id: I05541c8de269a717a8d3f2d74b7633c3949df3f1
We decided to change the name of this identifier to "product id", the
system property where it is stored will also be named
ro.product.product_id.
BUG: 24302729
Change-Id: I0d2f0867b364de98367f0072d216acec76401c33
metricsd should report the stateful partition's usage, both in MB and as
a percentage of the available space.
This measure will be reported every 15 minutes.
BUG: 24132871
Change-Id: I1cd8d651a980f90a57be9cc2a5baf6ed59794470
Move metrics_library_mock.h and timer_mock.h into the include/metrics/
folder since some source files in shill need to include these header files.
Adjust the include paths in metricsd source files accordingly, and add
the -frtti flag to the libmetrics target so that classes including
these mock headers can determine the type information of the underlying
class being mocked at run-time.
BUG: 22956441
Change-Id: I19820c0d3097c9c4c2b93730d1988ccec563db23
TEST: "mma" in metricsd folder succeeds.
Rename some metrics for more consistency:
* *.PerMinute and *.PerSecond instead of the obscur Long and Short
suffix.
* *.Percent for metrics reporting a percentage.
BUG: 24206661
Change-Id: Ib25f864e5e8bf5287ada2a361737def1b7821135
When logging, libchrome will extract the program's name from the command
line. If the command line helpers have not been initialized, the logging
call will fail and the program will abort.
BUG: 24262190
TEST: unit tests.
Change-Id: Ie7982d5491f8373dc06ba44b69b518ff8673b568
This fixes three things:
* name of the metrics: the metrics does not represent the daily use.
* arithmetic error: we collect the use time in seconds so no need to
divide by 1000 to get seconds.
* the metrics should not be reset daily.
This CL also renames the Send* helper methods to be more explicit about
resetting the counters.
This was also committed in Chrome OS at:
https://chromium-review.googlesource.com/#/c/300059/.
BUG:24131693
TEST: unit tests.
Change-Id: I712baa1fd639b9b0df60906d94a0904d8c6760aa
Move timer.h into the include/metrics/ folder since some
source files in shill need to include this header file.
Adjust the timer.h include paths in the metricsd accordingly.
BUG: None
Change-Id: Id2f5e079d3a095f40d0f4d4e0d438bd22f1274ff
TEST: "mma" in metricsd folder succeeds.
This test case ensures that we can log a metric with the metrics library
and upload it with the upload service.
BUG: 22879646
TEST: unit tests.
Change-Id: Idf4a1240d41745ebf7835089230608082eed19f5
If the metrics server is unreachable, we may need to resend a metrics
report later. Instead of keeping the staged report in memory, save it to
disk to avoid loosing data if the system restarts or crashes.
BUG: 23033262
TEST: unit tests.
Change-Id: Idd14964e40f022952469f47d675d8cda9586d7cd
Instead of passing different filenames around, only rely on the metrics
directory and infer the filepath from it. This makes testing easier.
BUG: 23939404
TEST: unit tests.
Change-Id: I79086acc3a546464114fa8ec4656ec04e1c43e35
The format of the metrics dump is rudimentary just yet. Here is an example:
Metrics from /data/misc/metrics/uma-events
name: hello type: USER_ACTION
name: world type: USER_ACTION
This required the following changes:
* Added -d option to metrics_client
* Refactored file handling in SerializationUtils
- Factored out file opening and log parsing into helper methods
- Added ReadMetricsFromFile which is read-only so does not truncate the file
Change-Id: I6032d74242c79c678ec42a14e78fccc54e7af455
Collect memory usage and disk IO statistics periodically.
Also update the Android.mk file to use clang by default.
BUG: 22953719
TEST: builds on external and internal branches.
Change-Id: I1ee3683d014586cf7f711d2e090a99429752063c
When running the metrics_daemon in verbose mode, log the histogram name
along with the hash name.
This is useful when debugging as the protobuf message only contains the
hash of the name.
Change-Id: Ifea7edce55d62d30994ec7b75bb8728f6a0c40e8
This CL:
* removes dead code.
* converts constants static fields into proper constants.
* converts to C++/libchrome some of the parsing logic.
BUG: 22953719
Change-Id: Ief01178c6c268f8ae3690ad9deef42cfb43b2b75
This cleans up the unit tests and update them to pass.
Cleaned up:
* removed the irrelevant bits.
* Used ScopedTempDir for all test specific files (instead of the current
directory).
* Update some objects to make them more easily testable.
* Group all the test in a single binary and use bionic's test runner.
BUG: 23682444
Change-Id: I289e3a5ff89968fdecd4a156e93bc38bbc25f58b
Instead of using /etc/lsb-release to store the version, channel and
build_target_id, use the Android system properties.
BUG: 22879642
Change-Id: Ic79e74bd14bf8e2c55549c08963a66700b49b544
Since crash_reporter gets run as root, in order to use metrics_lib
it has to use group permissions to interact with metrics files.
Bug: 23406290
Change-Id: Ie9556233105312f973c0a3e018fc0305a466148d