Commit graph

16 commits

Author SHA1 Message Date
Bertrand SIMONNET
6c9fbb9a3a metricsd: Replace scoped_ptr with unique_ptr.
scoped_ptr are a chromism. We should use unique_ptr instead.

Bug: 25958769
Test: unit tests.

Change-Id: Ie23ae2ef42f66dcc76f45a9dafa66c8ceb0a2d90
2015-12-22 09:18:04 -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
Bertrand SIMONNET
b13527d14e metricsd: Allows introspecting the metrics.
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
2015-12-04 13:14:58 -08:00
Bertrand SIMONNET
f2297eeb1f metrics: Remove user action logic.
User actions are no longer reported anywhere, we can remove the logic.

Bug: 25818567
Change-Id: Ie8fee841bda6503a3f5781d73b0f879babe99b03
2015-12-04 13:04:23 -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
Nathan Bullock
adc1c23537 metricsd: add SendBoolToUMA to metrics interface
Bug: 25561571
Change-Id: I698d2408e2f462865f6512b7be17ff0851a1f97c
2015-11-06 14:45:49 -05:00
Bertrand SIMONNET
a5b40d077f metricsd: Don't cache the metrics status in the daemon.
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
2015-10-05 09:58:16 -07:00
Bertrand SIMONNET
3598d951a6 metricsd: Fix race condition in the tests.
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
2015-09-28 15:02:00 -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
630e05b6af Merge "metricsd: move timer.h into include/metrics/" 2015-09-16 18:24:15 +00: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
4c8a8ad3bf metricsd: Add test case for the upload service.
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
2015-09-14 13:55:33 -07:00
Bertrand SIMONNET
2765d0abcc metricsd: Use the metrics directory everywhere.
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
2015-09-14 13:55:28 -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
52e5b99983 metricsd: Relicense as Apache 2.
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
2015-08-10 15:57:47 -07:00
Bertrand SIMONNET
da21ac0751 metricsd: Rename metrics to metricsd.
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
2015-08-10 15:26:01 -07:00