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
Instead of crashing when the build target id is missing, simply print a
useful warning and discard the log.
BUG: 23351227
Change-Id: I3abf3063d6440b07103db29938eec5071ea8f60b
libchromeos was updated to set the certificates path correctly, we can
enable https by default.
BUG: 23016355
Change-Id: I88393df4a6892055f4865d86de78ba3a2a5b45e8
This init script creates the metrics data directory (/data/misc/metrics)
and starts the daemon.
BUG: 22953527
Change-Id: I21cd36f38a7a3550bc755cef5699e9a6ac3dfb94
libchromeos (dependency of metricsd) is only defined for linux.
All metrics target must only be defined on mac too or the build system
will complain.
BUG: 22879597
Change-Id: I5bee816e001518a8053d1dfc7b39cca81a4314fd
MODULE_LICENSE_BSD and NOTICE were removed as the license is no longer
different from the rest of system/core.
BUG: 23086670
Change-Id: I1e83ef2ecb9c721150f8aab283c9ff960337da8c
This builds:
* metrics_client: command line interface to log metrics.
* libmetrics: shared library used by services to log metrics.
* metrics_daemon: background daemon responsible for aggregating the
metrics log and upload it periodically.
BUG: 22879597
Change-Id: I79adc4953d5bfd541df955fbc77d3549f5bbd26b
This makes the import path less confusing:
* metrics/metrics_library.h is imported from the exported headers.
* metricsd/* for includes by the metrics daemon itself.
BUG: 22879597
Change-Id: I9f44ea3a548cae39d4546fcd724e8007f6dd4bd0