Commit Graph

35 Commits

Author SHA1 Message Date
Dan Willemsen 4e09dd8cce Remove Brillo-specific LOCAL_MODULE_TAGS
Replaced with PRODUCT_PACKAGES_ENG in brillo_base.mk

Change-Id: I66f467d95745aa6b1f3c81aa87a3f139a33dbebf
2016-07-31 18:45:14 -07:00
Jorge Lucangeli Obes 1e7592c9d5 Unit tests: Compile only on 'eng' builds.
metrics_collector_tests, metricsd_tests.

Bug: 26967770
Change-Id: I6d7e8fb6d3d98ab747d922bfeef05aa344b2179c
2016-02-04 14:17:46 -08:00
Alex Vakulenko eca14e3722 metricsd: Removing brillo::Any from weaved's public APIs
Weaved replaces brillo::Any with base::Value in its client library,
so need to update clients.

Also this removes last D-Bus dependencies from metrics_collector.

BUG: 26558300
Change-Id: I82d571d7e2bd17347daeb1b70f48ec05378894f0
2016-01-28 14:44:28 -08:00
Bertrand SIMONNET 30c174b7f9 metricsd: Add tests to the default debug build.
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.
2016-01-19 17:58:40 -08:00
Bertrand SIMONNET b6c77af499 metricsd: Cleanup on TERM signal.
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
2016-01-12 10:29:40 -08:00
Todd Poynor 4b50bf3a9a metrics_collector: Fix build of tests
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
2016-01-05 17:27:36 -08:00
Todd Poynor b77ae4506f Remove metrics collector service trampoline
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
2016-01-05 15:48:04 -08:00
Alex Vakulenko 2096029743 Disable RTTI in crash_reporter and metricsd
There is no longer a reliance on RTTI in libbrillo, so disable RTTI
in the rest of Brillo codebase.

Bug: 26292405
Change-Id: I2751a2ac973a74741a82f5cd949fc0adaf2449a6
2016-01-04 11:12:48 -08:00
Todd Poynor 694553d097 metrics_collector: add libmetricscollectorservice binder service
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
2015-12-10 13:34:10 -08:00
Alex Vakulenko 9fc597b750 metricsd: Update to use new component/trait APIs from weaved
Removed command and state definitions and use trait definitions
instead. Also, create "metrics" component for weave.

BUG: 25916429, 25916428, 25917426

Change-Id: Icc02d1c46c371d3afa8e4723852f182992c62bf2
2015-12-09 12:35:39 -08:00
Bertrand SIMONNET 6b8629a649 metricsd: Log over binder.
This CL converts metricsd, libmetrics and metrics_collector to use
Binder to pass metrics samples.

Bug: 25670685

Change-Id: I657faecdf4ed1226ab30ce69e062028463437e7b
2015-12-03 17:01:27 -08:00
Bertrand SIMONNET 608e428006 metricsd: Split into two daemons.
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
2015-11-18 09:54:16 -08:00
Bertrand SIMONNET 0ada2ca1dc metricsd: Collect average cpu usage information.
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
2015-11-04 12:14:13 -08:00
Alex Vakulenko 26aef373a6 core: Rename libchromeos into libbrillo
BUG: 24872993
Change-Id: Ia47ad51140f7e384822eea9d5de46c9f51ceda11
2015-10-27 11:46:37 -07:00
Bertrand SIMONNET eb697abf5e metricsd: Read build time values from etc/os-release.d.
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
2015-10-14 15:58:06 -07:00
Alex Vakulenko 82b02de5aa Update metrics to use weaved's client library
Do not use weave'd D-Bus proxies directly. Use the new client library.

Change-Id: I524d9c5c4c057bd1f82a280ec96848b8a8f4fe29
2015-10-09 20:07:47 -07:00
Bertrand SIMONNET 59890e2db9 metricsd: Expose the metrics status through weave.
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
2015-10-06 10:18:54 -07:00
Bertrand SIMONNET 7a9640559b metricsd: Only collect metrics over a short period.
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
2015-10-01 16:45:56 -07:00
Scott James Remnant 7c5d693fe9 metricsd: build on non-Linux hosts
Bug: 24073089
Change-Id: I94f12f0e30d150348429a959b7bd1c869f766603
2015-09-28 15:12:30 -07:00
Jorge Lucangeli Obes 9341286385 Simplify Makefile for metrics_daemon.
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
2015-09-28 11:31:58 -07:00
Bertrand Simonnet 843725bb3a Merge "metricsd: Report the data partition usage." 2015-09-24 23:24:11 +00:00
Bertrand SIMONNET 5658dc58aa metricsd: Report the data partition usage.
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
2015-09-24 15:38:36 -07:00
Samuel Tan 28a78b7210 metricsd: move timer_mock.h and metrics_library_mock.h into include/metrics/
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.
2015-09-23 18:12:37 -07:00
Samuel Tan 1c4d8f10da metricsd: move timer.h into include/metrics/
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.
2015-09-15 11:52:59 -07:00
Bertrand Simonnet eeedcc4150 Merge "metricsd: Collect generic stats about the system." 2015-09-14 18:44:24 +00:00
Bertrand SIMONNET ebbe35c2b5 metricsd: Collect generic stats about the system.
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
2015-09-08 13:40:48 -07:00
Dan Albert d83a26033c Drop unused LOCAL_STATIC_LIBRARIES.
This is ignored for BUILD_STATIC_LIBRARY.

Change-Id: Ib5553e0aeaa30cdb2b29f18a4d5d0b0bf1b8740a
2015-09-08 10:55:05 -07:00
Bill Yi 6d5822ed7b Revert "metricsd: Collect generic stats about the system."
This reverts commit 90b02cd46d.

Change-Id: I9950c688433e99b0bc4745f02e2f9ae66f3b5578
2015-09-03 19:18:56 +00:00
Bertrand SIMONNET 90b02cd46d metricsd: Collect generic stats about the system.
Collect memory usage and disk IO statistics periodically.

BUG: 22953719

Change-Id: I2e35d4800ddc684284969e6a58a6f50497086b69
2015-09-02 15:04:26 -07:00
Bertrand SIMONNET 1253186728 metricsd: Make the unit tests pass.
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
2015-09-02 13:30:48 -07:00
Bertrand SIMONNET 2699362a57 metricsd: Use system properties to store build time metadata.
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
2015-08-25 16:23:04 -07:00
Daniel Erat 69200d9191 Use __ANDROID__ instead of __BRILLO__.
__ANDROID__ is defined automatically by the toolchain.

Bug: 23358460
Change-Id: Ib122bfc86a7af6ab6b0b1fcc29dc671e44049524
2015-08-19 17:38:45 -06:00
Bertrand SIMONNET 73eaa46559 metrics: Add init script for metrics_daemon.
This init script creates the metrics data directory (/data/misc/metrics)
and starts the daemon.

BUG: 22953527

Change-Id: I21cd36f38a7a3550bc755cef5699e9a6ac3dfb94
2015-08-19 11:32:41 -07:00
Bertrand SIMONNET 0a94a3bf1c metricsd: Only define the targets on linux.
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
2015-08-11 11:45:05 -07:00
Bertrand SIMONNET ed6ca6f8c6 metricsd: Add Android.mk.
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
2015-08-10 15:57:39 -07:00