History log of /frameworks/base/cmds/statsd/src/stats_log.proto
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
892f3d32293b8358c72da4a94633827abbda640b 02-May-2018 Yangster-mac <yanglu@google.com> Reset statsd and correctly record the dump reason when system
server restarts/crashes.

Test: statsd test
BUG: b/79161505
Change-Id: I0646c764964f6eafde91f9ae0179a1c837af320d
/frameworks/base/cmds/statsd/src/stats_log.proto
9def8e3995b1034d943a0fd22b6e512bfacdab77 17-Apr-2018 Yangster-mac <yanglu@google.com> Reduce statsd log data size.

1. Hash the strings in metric dimensions.
2. Optimize the timestamp encoding in bucket.
Use bucket num for full bucket and millis for
partial bucket.
3. Encode the dimension path per metric and avoid
deduping it across dimensons.

Test: statsd test
Change-Id: I18f69654de85edb21a9c835c73edead756295e05
BUG: b/77813755
/frameworks/base/cmds/statsd/src/stats_log.proto
e36018b2724b5ae40180f956b16c3e276855b99b 17-Apr-2018 Chenjie Yu <cjyu@google.com> add dump report reason to reports

+ also change uidmapping version numbers to int64_t

Bug: 78132855
Change-Id: Iac7ea93e4bf651bd65bd03383e7ab4971af4fc29
Fix: 78132855
Test: gts test
/frameworks/base/cmds/statsd/src/stats_log.proto
81245fd53a0bd627fa87e3a69dd667c7d6696ede 12-Apr-2018 David Chen <dwchen@google.com> Adds option to drop small buckets for statsd.

We notice that some of the pulled metrics have a ton of data, and
during app upgrades, we're forming partial buckets that represent
small periods of time but require many bytes of data. We now have an
option to drop these buckets that are too short. Note that we still
have to pull the data to keep the metrics for the next bucket
correct. We include a new field in the value and gauge metric outputs
so that it's easy to tell when a bucket was dropped.

We drop the partial buckets also from anomaly detection since we
should be computing anomalies from the same data that is reported.

Test: Added unit-tests for value and gauge metrics.
Bug: 77925710
Change-Id: Ic370496377c6afd380e02278a6c1ed8b521a2731
/frameworks/base/cmds/statsd/src/stats_log.proto
163d2602dbc79133096b3dec7920ee157ff1a88b 10-Apr-2018 Yao Chen <yaochen@google.com> Handle logd reconnect.

When statsd reconnects to logd, statsd will read all logs from buffer again. To prevent us from
reprocessing old events, we do the following:

1. At any given moment, record the largest timestamp(T_max) and last timestamp (check point) that
we've seen before.
2. When reconnection happens, we look for the check point until we see a new log with a timestamp
larger than T_max.
-> If we found the CP, resume after the CP. Success
-> If we can't find CP, there is definitely log loss. We reset all configs.

Note:
1. Logd has an API to read logs after a certain timestamp. But this api is vulnerable to
time changes from Settings. So we cannot rely on it.

2. If logd inserts a new log (with older timestamp) before CP, we cannot detect it. It's not
possible to detect it without record all timestamps we have seen.

Test: statsd_test
Bug: 77813113

Change-Id: Ic3fdb47230807606ab11dc994cb162194adb8448
/frameworks/base/cmds/statsd/src/stats_log.proto
15f6bbc24f4d7a3d4481d90a18df33d402ddacba 08-Apr-2018 Yangster-mac <yanglu@google.com> Flush the bucket when creating the metric producer.
Use int64 for value field.
E2e test for gauge/value metric.

BUG: b/74445671

Test: statsd test.
Change-Id: I823a0bade8f89834bdfb9cf48864852a47d7b63b
/frameworks/base/cmds/statsd/src/stats_log.proto
e68f3a5811209eeab71976bc583c6075d9a5979a 04-Apr-2018 Yangster-mac <yanglu@google.com> Flush the partial bucket when startd shuts down or config updated.

Test: statsd test

BUG: b/77556036
Change-Id: Ie4a04ace55e07c4529cdff5906ba874f8815f620
/frameworks/base/cmds/statsd/src/stats_log.proto
203bbbf942e8675338b88ab67d49481d2bfcf904 06-Apr-2018 David Chen <dwchen@google.com> Merge "Fix uid map to be simpler and fix partial bucket." into pi-dev
bd12527c90d55eefa657e6a71cfdd287ecdb4ab3 05-Apr-2018 David Chen <dwchen@google.com> Fix uid map to be simpler and fix partial bucket.

The previous scheme captured periodic snapshots for each config with
complex logic that's unnecessary and wasted memory. We actually don't
need to store any snapshots since we just convert the current state
into a snapshot and also include the deltas (change events) since the
previous report until now.

To make the system more robust, we also include up to 100 of the
deleted apps in the uid map.

Also, fix the wiring of the partial buckets so the metric producers
form partial buckets on both app upgrade and removal, but not on
installation of a new app.

Also, we update StatsCompanionService to also include disabled apps.

Bug: 77607583
Test: Verified unit-tests pass and added new e2e tests.
Change-Id: I98e1f544d6e6571545ae1581c4cebab807596f51
/frameworks/base/cmds/statsd/src/stats_log.proto
b8382a10a0dca8ff50b0afc35071e47440ecf86c 04-Apr-2018 Yangster-mac <yanglu@google.com> Retry logs write when it fails.
Report skipped event in statsd.

Test: manual test
BUG: b/77222120
Change-Id: I257f5e76d557893c4eb4a8e8a13396d8b5d1afc0
/frameworks/base/cmds/statsd/src/stats_log.proto
b142cc8add29c8c97f6134d35873d23db666027c 31-Mar-2018 Yangster-mac <yanglu@google.com> Statsd config TTL

Roughly check the config every hour to see whether the ttl expired.
If so, read the config from disk and recreate the metric manager.

Test: statsd test

BUG: b/77274363

Change-Id: I16838afe5bbe966c3a0f638869751f9b59a5a259
/frameworks/base/cmds/statsd/src/stats_log.proto
faa1af535bf6ede5fcab2e0bad5f6c16908916a9 31-Mar-2018 David Chen <dwchen@google.com> Includes annotations with statsd reports.

It's tricky to determine the source of the metrics on a device
currently since we can take the union of multiple configs and send
only one giant statsd_config into statsd. We will use the int64 field
to track the sub config id's and the int32 field to track the version
for each sub config, but the fields are named more generically as
annotations.

The annotations are available in both the reports and metadata.

Test: Check that all unit-tests pass on marlin-eng
Bug: 77327261
Change-Id: Ic37c549c8b2991676f69948c515156765c9f5108
/frameworks/base/cmds/statsd/src/stats_log.proto
306ccc2d6bbb396e53f1a250da32003989a24b42 24-Mar-2018 Yangster-mac <yanglu@google.com> Guardrail for dimension in condition in duration tracker.

Test: statsd test

BUG: b/74437017
Change-Id: I349528e419ede817904f1e3884260c06651c6d0b
/frameworks/base/cmds/statsd/src/stats_log.proto
f384b900498b552c776931c8873e4bd03af36fe5 15-Mar-2018 David Chen <dwchen@google.com> Removes stats_log proto from uid map in statsd.

We don't need to parse the proto of uid map, so we use the
ProtoOutputStreame class to generate the binary form of the proto
output that's needed for parsing the uid map data.

Test: Verified unit-tests still pass.
Bug: 74010813
Change-Id: Ia2f7572f3b78bb6f7b60e8b14cf5d65428469ab6
/frameworks/base/cmds/statsd/src/stats_log.proto
3fa5d7fb236f263125bc6364ea693e5e9f122976 11-Mar-2018 Yangster-mac <yanglu@google.com> Add wall clock timestamp for ConfigMetricsReport and gauge atoms.

Fix the bug when serializing multiple atoms in gauge metric

BUG: b/74159560

Test: new test for ALL_CONDITION_CHANGES sampling method.
Change-Id: I6d33c1efbac92b6e13be2d64c323e090cb1f84aa
/frameworks/base/cmds/statsd/src/stats_log.proto
20e9e6231a1aba79b4e5ae47f3ccfb066920e60f 28-Feb-2018 Yao Chen <yaochen@google.com> Reduce statsd binary size from 730KB-> 664KB

1. StatsdStats does not use the proto object in memory anymore.
2. lite_static -> lite
3. don't use sstream

Bug: 72129300
Test: statsd_test

Change-Id: I8a5adaf222d4d5034e8bf115215fb6dd5f042cac
/frameworks/base/cmds/statsd/src/stats_log.proto
932ececa1674c59a8da9f3e32d2651e781b86fc4 01-Feb-2018 Yangster-mac <yanglu@google.com> Alarm: wakes up statsd and notifies the subscribers.

Test: manually tested it.
Change-Id: Id796a68976aeb1611183023ba4e9c6a8b8c44bb8
/frameworks/base/cmds/statsd/src/stats_log.proto
9c1debe330006b2b4d5c08a55905789c57369609 19-Feb-2018 Yao Chen <yaochen@google.com> Add annotation to atoms that represent a state change in atoms.proto

+ A state change atom can have one exclusive state field, and any
number of primary key fields.

When there is primary key in the atom, it means the state belongs to the primary key.
For example,
message UidProcessStateChanged {
optional int32 uid = 1 [(stateFieldOption).option = PRIMARY];
optional android.app.ProcessStateEnum state = 2 [(stateFieldOption).option = EXCLUSIVE];
}

When there is no primary key fields in the atom, the state is global.
For example,
message ScreenStateChanged {
optional android.view.DisplayStateEnum state = 1 [(stateFieldOption).option = EXCLUSIVE];
}

+ The annotation is consumed by stats_log_api_gen to generate a static map from the state
atoms to its primary fields, and exclusive fields

+ stats_log.proto is splitted into 2 proto files, because statsd needs proto lite, and c++
lite proto library cannot properly ignore the field options which requires full proto.

This CL doesn't change any logic in the statsd yet. A separate CL will use the field option
information to correctly track the state.

Test: added unit tests in stats_log_api_gen_test. and statsd_test pases.
Change-Id: I9e8a979fe81ba60efd4d854bb7087ce4b2b147ec
/frameworks/base/cmds/statsd/src/stats_log.proto
330af58f2b8582b855085655fae553cdfaf44e6c 09-Feb-2018 Yangster-mac <yanglu@google.com> Use elapsed realtime instead of times based on wall clock, which can jump around and go backwards.

Test: statsd unit test passed

Change-Id: Ib541df99231e171b3be2a24f75632693e36da90e
/frameworks/base/cmds/statsd/src/stats_log.proto
16049578001364e1fcb0f10d6f94868081e57316 02-Feb-2018 David Chen <dwchen@google.com> Modifies statsd output for start and end times.

We include the start of when the last dump occurred and the current
timestamp. These timestamps are shared across all metrics, so
there's no advantage in duplicating these numbers across all metrics.

Also, we should use elapsed realtime instead of times based on wall
clock, which can jump around and go backwards.

Test: Test that statsd can still build and
adb shell cmd stats dump-report doesn't crash.
Change-Id: I819e5643cee75dfa3e78a58f94c9d61ededa78d7
/frameworks/base/cmds/statsd/src/stats_log.proto
34ea1103a0faa0e01df0e2b0ac1ce98e7ec3e3f1 29-Jan-2018 Yangster-mac <yanglu@google.com> Extend gauge metric to support memory metric.

Test: statd unit test passed.

Test: statsd unit test passed
Change-Id: I2e3f26563678ae77d44afe168454b6d1ea449f3a
/frameworks/base/cmds/statsd/src/stats_log.proto
884c8c130fde0d02ada1316f7c27f0f55e7e48b9 26-Jan-2018 Yao Chen <yaochen@google.com> Add more statsd's debugging info to dumpsys.

+ Bugreport will use the non-verbose mode
+ Reuse the log_msg object in LogReader
+ Add logd errors to StatsdStats

Bug: 72383073

Test: manual + statsd_test

Change-Id: Id5a8b103074d034f5ece3c9831c740d44a5df9cd
/frameworks/base/cmds/statsd/src/stats_log.proto
b84e8b1fcfb69c058c18b70bbfb76e37cd4e23cd 23-Jan-2018 Yangster <yanglu@google.com> Sync statsd google3 protos to aosp.

Test: statsd unit tests passed
Change-Id: I66b05478b7c5b0f9fdd6386b2e2ba7c38a3f9b88
/frameworks/base/cmds/statsd/src/stats_log.proto
16fc72f006976d2dc453782e9bf5369d885c74a0 18-Jan-2018 Yangster-mac <yanglu@google.com> Update the dimension_in_what/condition field number.

Test: statsd unit test passed.

Change-Id: I11aa8a5cfc3bce703cf5ed0d9696d1949df449f0
/frameworks/base/cmds/statsd/src/stats_log.proto
468ff04fd4cb43a384a3d4948cccd4438be7202a 17-Jan-2018 Yangster-mac <yanglu@google.com> Proto change for dimension from condition.

Test: all statsd unit tests and cts tests passed.

Change-Id: I955143aca7c76e2e22a10d7ba42eb797bd32e147
/frameworks/base/cmds/statsd/src/stats_log.proto
b038b709566c191164bd23539175df8aadeb2f94 19-Dec-2017 Chenjie Yu <cjyu@google.com> pullers now cache data to throttle frequent pull requests.
all pullers have a default 1s cool down before next pull.
We can adjust these later.
Also add puller stats in StatsdStats

Test: unit test
Change-Id: I71894a24c41e059d841591312dbb852f54387b7d
/frameworks/base/cmds/statsd/src/stats_log.proto
d19bcae42df300c080415a1a91df53c4e28ea4d5 05-Jan-2018 Yangster-mac <yanglu@google.com> Move Field proto out of stats_log.proto to keep it clean.

Test: statsd unit test passed.

Change-Id: I31ffea40cf1b82c16bf37c706969bfb159639c7b
/frameworks/base/cmds/statsd/src/stats_log.proto
94e197cceb2ba7df13ff8de04f60bfeec64015d9 03-Jan-2018 Yangster-mac <yanglu@google.com> 1/ Change all "name" to id in statsD.
2/ Handle Subscription for alert.
3/ Support no_report_metric

Bug: 69522276
Test: all statsd unit tests passed.
Change-Id: I851b235f2d149b8602b0cad632d5bf541962f40a
/frameworks/base/cmds/statsd/src/stats_log.proto
2087716f2bdca90c7c3034d556ac12911bd8018e 23-Dec-2017 Yangster-mac <yanglu@google.com> 1/ Support nested message and repeated fields in statsd.
2/ Filter gauge fields by FieldMatcher.
3/ Wire up wakelock attribution chain.
4/ e2e test: wakelock duration metric with aggregated predicate dimensions.
5/ e2e test: count metric with multiple metric condition links for 2 predicates and 1 non-sliced predicate.

Test: statsd unit test passed.

Change-Id: I89db31cb068184a54e0a892fad710966d3127bc9
/frameworks/base/cmds/statsd/src/stats_log.proto
d9dfda76e0aa8b8aa4d2562a7ff4259f4500e355 12-Dec-2017 Chenjie Yu <cjyu@google.com> add feature: GaugeMetricProducer now takes repeated list of fields
bug fix: GaugeMetricProducer now works better with pulled events.
unit test also includes GaugeMetricProducer_test

Test: unit test
Change-Id: Ic60f09342d14cfb107be2130d445b323a56909e0
/frameworks/base/cmds/statsd/src/stats_log.proto
c9f1a9e3dd214b167a49ac4560382e2e98084ff6 14-Dec-2017 Joe Onorato <joeo@google.com> Merge "Fix how we build the statsd protos."
62c220b20b3fc431c27feac29a71d040fc8e2626 19-Nov-2017 Joe Onorato <joeo@google.com> Fix how we build the statsd protos.

This lets us include frameworks protos, and use the constants
and messages from them.

Change-Id: I609d6e524f780e6a5beea543a68561bede47813e
Test: make
/frameworks/base/cmds/statsd/src/stats_log.proto
e1d143a0589f22876f17fcb2f892fd9a39a3ebd9 14-Dec-2017 Bookatz <bookatz@google.com> StatsdStats alerts -rename alerted_times

Renaming declared_times to alerted_times.

Test: still compiles and passes tests
Change-Id: Ib7c890a21bb91a7185c6d3a098b1bec8bd868ad5
/frameworks/base/cmds/statsd/src/stats_log.proto
8f2f3d82053693b0dac828e848e2bb238e1db2d2 07-Dec-2017 Bookatz <bookatz@google.com> Anomaly Alert declarations in StatsdStats

StatsdStats now tracks the number of times an anomaly is detected (per
config, per alert name).

Also adds a configKey to AnomalyTracker, which is needed, not only for
statsdstats, but also (in the future) for reporting the header
information to incidentd.

Bug: 67978682
Test: adb shell data/nativetest64/statsd_test/statsd_test
Change-Id: Ib254db7e1edb4f0f193f4772d17f14934cdf7e30
/frameworks/base/cmds/statsd/src/stats_log.proto
1d0136d322899cd9db4416c22873ee7ed01d843a 01-Dec-2017 Bookatz <bookatz@google.com> Anomaly detection statsdstats

Adds statsdstats for tracking the number of anomaly alarms registered.

Test: adb shell data/nativetest64/statsd_test/statsd_test
Bug: 67978682
Change-Id: I4aa0539a13c60ccb3b7fd2a4f41c4ad867f3a4ea
/frameworks/base/cmds/statsd/src/stats_log.proto
3accca05ddcad9d0b1b313eae49f273e39121d3c 20-Sep-2013 Dianne Hackborn <hackbod@google.com> Add major version code to platform.

It turns the version code into almost a 64-bit integer, with the
new major part being the upper 32 bits.

The only tricky part about this is the backup manager, since it
stored 32-bit version codes in its backup data sets. This is dealt
with by, when the major version code is not 0, writing MIN_INT as
the version code and following that by the full long version code,
which we can detect when reading. Note that this makes backup sets
containing apps with major version codes incompatible with older
versions of the platform.

Bug: 64459786
Test: Added in Change-Id: Iab8a682b62103babd6c16a56b8dc1e97d7078658
Change-Id: Ibfffe235bbfcf358b3741abd3f7197fdb063d3f3
/frameworks/base/cmds/statsd/src/stats_log.proto
c136f45aee2c193e954c107f35109ccc8b1146b3 27-Nov-2017 David Chen <dwchen@google.com> Adds guardrail for memory usage for statsd uid map.

Checks if current memory usage of uid map is above a configured limit
and if so, we start deleting snapshots. If there are no more
snapshots, we begin deleting two of the deltas. Also records stats
in the guardrail StatsdStats. Also fixes an edge case where a config
is added after the snapshots are added. We request a snapshot of all
installed uid's at that moment. Finally, adds the uid map memory size
when determining if we should send a broadcast to trigger collection.

Test: Added unit-tests and check they pass on marlin.
Change-Id: Id5d86378bd1efe12a06b409164c777c0c6f4e3ab
/frameworks/base/cmds/statsd/src/stats_log.proto
69f1baf7dd3d6e595abdae000adf0f197558d0ea 28-Nov-2017 Yao Chen <yaochen@google.com> Some fixes in StatsdStats, and add some unit tests

+ Add timestamp for when metric data is reported.

Test: statsd_test

Change-Id: Ief5ec5172feed4ec74b7422b77cf69ec8361ef2f
/frameworks/base/cmds/statsd/src/stats_log.proto
b356151e63140085cb96fa16804ee18b3862a4fc 22-Nov-2017 Yao Chen <yaochen@google.com> Add StatsdStats and guardrail.

+ StatsdStats is the global class that tracks the stats about statsd.

+ Added guardrail for classes that have a map which could potentially grow
unboundedly with the number of logs.

TODO: add unit tests & CTS for StatsdStats, and guardrail
add stats for pulled atoms.

Test: statsd_test

Change-Id: I0ea562de4dd3f6162f7923a9c193420b482c1d51
/frameworks/base/cmds/statsd/src/stats_log.proto
947fbce521d9e8377df03e3c1c31884ed5577f32 16-Nov-2017 yro <yro@google.com> Captures metrics on disk when devices reboot and shutdown. Specifically,

1. Create intent receiver in StatsCompanionService to listen to shutdown
events.
2. Create StatsWriter class to handle disk writes and deleting files.
3. Update StatsLogProcessor, ConfigManager, and StatsService to handle
files on disk using StatsWriter.
4. Add a wrapper for ConfigMetricsReport.

Still TODO is to be able to add a guardrail to prevent accumulating
excessive amount files on disk, which will be followed up by another
change.

Test: statsd, statsd_test
Change-Id: Ia0b3af315af545daa8b0078b3700c600aa7c285f
/frameworks/base/cmds/statsd/src/stats_log.proto
9f089f60eba28c1e6b107c260623ab99567d1e4f 22-Nov-2017 Colin Cross <ccross@android.com> Merge "Revert "Add a wrapper ConfigMetricReportList to hold multiple ConfigMetricReports""
741d0002cdd062d949a88b5b81a3dba7d3115198 22-Nov-2017 Colin Cross <ccross@android.com> Revert "Add a wrapper ConfigMetricReportList to hold multiple ConfigMetricReports"

This reverts commit 24904b845f6257f3d6be5374a1e11d67715034c6.

Broke the build when combined with Ia58d215d30ed7570c0aa1b0627d3b88f8355d425.

Change-Id: Ie54a62ec7471e0183fc2627e06648efda0129a7a
/frameworks/base/cmds/statsd/src/stats_log.proto
52c4cf38ae980a431175c9d4354134537177d3fc 22-Nov-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Statsd test app."
1ff4f4325882d812ded4f75ee6c2b6d352a85c9e 17-Nov-2017 Yao Chen <yaochen@google.com> Statsd test app.

Features:
+ Push baseline config to statsd
+ Have buttons to write events to StatsLog (plug/unplug, screen on/off, wake locks)
+ Dump stats log report, and display it on screen (currently support DurationMetricData display).

Test: manual

Change-Id: Ia58d215d30ed7570c0aa1b0627d3b88f8355d425
/frameworks/base/cmds/statsd/src/stats_log.proto
24904b845f6257f3d6be5374a1e11d67715034c6 21-Nov-2017 yro <yro@google.com> Add a wrapper ConfigMetricReportList to hold multiple
ConfigMetricReports

Test: statsd, statsd_test
Change-Id: Ic1ec6e5a31aebb36a1f39a4836e82d97c8be0dfc
/frameworks/base/cmds/statsd/src/stats_log.proto
ae2df01aae2ee7076af875c04e991140f685f733 14-Nov-2017 Stefan Lafon <stlafon@google.com> Rename "stats_events" as "atom".

Also make atom WakelockStateChanged use the "Type" enum instead of int32.

Test: Unittests are passing. Statsd is working.

Change-Id: I0909e2d97297f78996a81366d66aae62d5bf5ce1
/frameworks/base/cmds/statsd/src/stats_log.proto
b3dda41a5a48ddfa44dc8fa939ab495926a0195d 24-Oct-2017 Chenjie Yu <cjyu@google.com> reretry ValueMetric implementation and pulling mechanism

Note:
This is for value metric. The default operations is sum the diffs.
The test uses kernel wake lock, which also needs dimension by kernel
wake lock name.

The test is a bit cumbersome as it needs StatsCompanionService to do
the alarm, which is not exact alarm.

The internal state of a slice of bucket would look something like this:

4:ipc0000005e_727_android.hardwar
0 0
4:SensorService_wakelock
40 64
4:ipc0000005c_727_android.hardwar
...

Test: manual test on device.
Change-Id: I2ed0ac7d3c5fcba8b7611d46f38a38ffd8bdc92a
/frameworks/base/cmds/statsd/src/stats_log.proto
d6896898912eb1fc2c8976dce4340ab8d4e8d22f 25-Oct-2017 David Chen <dwchen@google.com> Updates uidmap to update snapshots and upload.

We send a snapshot of all installed apps with their uids every time
a user is added or removed and when statsd is started.
We keep track of the latest timestamp when a config key has retrieved
the UID map data. This allows us to remove older data when we're
guaranteed that all config sources have retrieved the old data.

Test: Added more unit tests to UidMap_test and passed on marlin-eng.
Change-Id: I34a3d61e75eedec44b98d896d7f6db0bc383f46a
/frameworks/base/cmds/statsd/src/stats_log.proto
fa28aec361198e5f9cd8ce1d2aa863b3b3bc5dfc 30-Oct-2017 Yangster <yanglu@google.com> Sync gauge metric proto to AOSP.

Test: manually run all the tests.

Change-Id: I81a282c6253d4b4577d8aea31490bb011988435c
/frameworks/base/cmds/statsd/src/stats_log.proto
729093df0dd7d7038ad43b16ecdb59a1404f3b50 16-Oct-2017 Yao Chen <yaochen@google.com> Add support for dimension, and link with condition and added DurationMetric

Now we support following metrics:
<Duration> of [app holding a wake lock], while [*this app*] is [in background] [AND] [screen is off]
[Slice] the output by [app name, wake lock name], with bucket size [30sec]

+ Also added onDumpReport() api in MetricsManager, it can be called from client to fetch the data from
statsd

+ Also added command line tool to dump the StatsLogReport from all metrics for debugging.

+ Synced proto from google3. with a pending cl (cr/172359050)

TODO: We need to add tons of tests to test the Metrics. I will work on it after this CL so people
can be unblocked.

I locally test the duration metric with wake lock with an app that generates StatsLog events.

Test: statsd_test

and manual test, and run:

adb shell cmd stats dump-report
We have a default config, which contains a metrics to count PROCESS_START event sliced by
package name.

Change-Id: I4838cc6cf025c143b7e84f43040703a78121fd25
/frameworks/base/cmds/statsd/src/stats_log.proto
70b986376189bf64706924a614d2d44e5702ed9c 17-Oct-2017 Yao Chen <yaochen@google.com> Fix build error.

Test: builds successfully.

Change-Id: I9ffefa28f37830319864e7b98d32340f59df0a62
/frameworks/base/cmds/statsd/src/stats_log.proto
caf339d004fad667748b68912c254df4e75cdc5a 07-Oct-2017 Yao Chen <yaochen@google.com> More complete implementation for condition and log matchers in statsd.

+ also synced proto from google3 to fix the LogEntryMatcher proto

+ MetricsManager represents StatsdConfig, it's responsible for initializing and managing all
LogEntryMatcher, Condition, and Metrics. Start review from here.

+ Added more complete StatsdConfig initialization, including building the map for:
LogEntryMatcher -> Metrics
LogEntryMatcher -> Condition
Condition -> Metrics.

All the maps use index(int). The extra amount of memory for storing mappings help us
quickly process log events.

The StatsdConfig initialization process detects malformed config
- Circle dependency
- Missing definition
etc.

And once we detect ANY error, statsd will reject the config. And the resources related to this
config will be released.

Test: Added unit tests
Change-Id: I2c4aefdbf3e2aa1701eacbb2fb5e653819ec1fbb
/frameworks/base/cmds/statsd/src/stats_log.proto
cdb1a0ed959818b0c3822e114c0456833769bade 28-Sep-2017 Stefan Lafon <stlafon@google.com> Check in new protos and constants.
Test: Started statsd and verified it outputs data. Also ran statsd tests.

Change-Id: I2a438b2ddfcb1576e21acb6159bea607fed7caaa
/frameworks/base/cmds/statsd/src/stats_log.proto
00698daf3c6c184bb20eb8e9d2c17eb92b567062 15-Sep-2017 yro <yro@google.com> Translate Android log entries to stats_log proto
Test: tested on local device

Change-Id: If9a779a96d31cefaffb1e4424629c14b08e1fc57
/frameworks/base/cmds/statsd/src/stats_log.proto
ab273e2e13f87d57f66395c52df424710b8066e1 06-Sep-2017 Yao Chen <yaochen@google.com> Add a DropboxWriter in statsd.

+ The DropboxWriter keeps data in cache, and flush to files once the
size exceeds the maximum value.

+ Different components should create their owner DropboxWriter with
different tags, e.g., anomly detection, experiment metrics, etc.

+ Copied stats_log related protos from g3

Test: run statsd, and adb shell dumpsys dropbox
Will add unit tests.

Change-Id: If06e9a9953be32082252b340a97124d732656b40
/frameworks/base/cmds/statsd/src/stats_log.proto