History log of /frameworks/base/cmds/statsd/src/StatsLogProcessor.cpp
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
1c58f04cd34291584b7bf2b45a54427e0ef650c8 18-May-2018 Yangster-mac <yanglu@google.com> Add a field in config to disable/enable the string hashing in metric report.

Statsd hashes (using its own hashing function) raw strings to reduce the
upload data size when there are duplicate strings in the report. And in cloud,
the clearcut translator would backfill the strings.

In a few droidfood users, we find the translator was unable to do that. While
debugging the root cause, we first decided to provide an option to disable
the hashing from the cloud.

Test: statsd unit test, CTS test, tested manually

BUG: b/79943763
Change-Id: If0359c8cf3f3cf83a2938db9ebf95ea7906f0b0c
/frameworks/base/cmds/statsd/src/StatsLogProcessor.cpp
021e25307d815452ceee7e189b36c7072b53c1df 16-May-2018 Chenjie Yu <cjyu@google.com> ValueMetric pushed events should check condition

+ fix unit test flakiness

Bug: 79873404
Change-Id: I15b52a79b18c05603640781e4450e7b62fac24ba
Fix: 79873404
Test: unit test
/frameworks/base/cmds/statsd/src/StatsLogProcessor.cpp
56ae0d9a48212c6e886e5887a6f9191f3020af40 12-May-2018 David Chen <dwchen@google.com> Fixes statsd reports missing strings and SCS.

Reports written to disk don't contain the strings used, which will
make this report unusable if there are strings that don't show up
again. We should always include the strings, so this option is
removed entirely.

Also, we hard-coded the wrong number of fields when pulling
ModemActivityInfo. There are actually 10 fields, not 6.

Bug: 79601503
Test: Tested unit-tests pass on marlin-eng.
Change-Id: I6834b096ced77418a9cc2ddd79b08d1c9c447fae
/frameworks/base/cmds/statsd/src/StatsLogProcessor.cpp
3f57b16deb78134cf4690819a844f4d941c01710 10-May-2018 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Skip writing metrics to disk if it's entirely composed of no_report_metric" into pi-dev
028091cb15f5e8290eed77a222582162d19a3d87 10-May-2018 yro <yro@google.com> Skip writing metrics to disk if it's entirely composed of
no_report_metric

Test: unit test, cts
Bug: 79488249
Change-Id: I3e13a6271cc36665a43d0f09d8663e5996224477
/frameworks/base/cmds/statsd/src/StatsLogProcessor.cpp
9e6dbbdadf8de3bcc58a6c26784219217cd35b53 08-May-2018 David Chen <dwchen@google.com> Fix statsd returning uidmap with empty reports.

We notice devices uploading a bunch of bytes for the uidmap even if
the device is running an empty config, so there are no actual metrics
to report. This hardcodes some logic to skip the inclusion of the
uidmap if there are exactly 0 metrics.

Bug: 79381210
Test: Tested unit-tests on marlin-eng
Change-Id: I96348235341a7faf15ff57d4d1eccac635a3a999
/frameworks/base/cmds/statsd/src/StatsLogProcessor.cpp
48944901f7e6334724efadda6c6b27d9e88fc9e2 03-May-2018 David Chen <dwchen@google.com> Fixes statsd returning too much data at once.

We observe a single ConfigMetricsReportList can be greater than the
safe size for the binder transaction buffer since we only check the
size of the current metrics in progress, but we also return the
previous reports stored on disk.

This change will attempt to send another ConfigMetricsReportList
as soon as possible if there's already a report on disk.

Also fixes a bug when trying to trigger data fetch before the client
has registered the corresponding dataFetchOperation.

Bug: 79201869
Test: Tested manually on marlin-eng
Change-Id: I2d3677162804a27e7a7a95d482d80c46bd994a67
/frameworks/base/cmds/statsd/src/StatsLogProcessor.cpp
a62ae51ba91bd6bd9dc4327aa8dd5e61f721faff 04-May-2018 Yao Chen <yaochen@google.com> Merge "Add cmd to let statsd print all logs it received for debugging." into pi-dev
ec41a069fd30d02de6d6b1db6aa150e94ade504d 04-May-2018 android-build-team Robot <android-build-team-robot@google.com> Merge "Reset statsd and correctly record the dump reason when system server restarts/crashes." into pi-dev
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/StatsLogProcessor.cpp
754e29edd76e2d927619e83c660c0d93e98211c8 02-May-2018 Yangster-mac <yanglu@google.com> Turns DEBUG to false in statsd.

Test: statsd test
BUG: b/79161505
Change-Id: Ic6eee527d625b10aa86b2beb4b4c4fc05b051c7d
/frameworks/base/cmds/statsd/src/StatsLogProcessor.cpp
876889cb760e99221c2fd77c7d67d5409bda0bc7 02-May-2018 Yao Chen <yaochen@google.com> Add cmd to let statsd print all logs it received for debugging.

It only works on eng build. And all code is behind a build flag, so the
code will be stripped out in production builds.

Bug: 78239479
Test: manual
Change-Id: I20ee51822d18e6c77ca324a5327712cbed09593e
/frameworks/base/cmds/statsd/src/StatsLogProcessor.cpp
493bb2b1195e71455a8df4dfe3aa46fd12001950 02-May-2018 Yang Lu <yanglu@google.com> Merge "Lock the pulling alarm handler." into pi-dev
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/StatsLogProcessor.cpp
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/StatsLogProcessor.cpp
d37bc23f5094ebb803abe93c9e3ca27698da35a9 13-Apr-2018 David Chen <dwchen@google.com> Adds a code when statsd sends intent to getData.

If the data receiver is experiencing delays, there may be a queue of
multiple intents to collect the same data. This timestamp makes it
easy in the receiver to de-dupe these requests to call getData.

Also, we update how StatsCompanionService gets the snapshot by
requesting data for all known apps. I notice that Keep seems to have
a uid active even when it appears uninstalled.

Bug: 77981668
Test: Flashed marlin-eng and manually verified.
Change-Id: I509e19383ec4a5da8746dd0c76ac71a948c6877d
/frameworks/base/cmds/statsd/src/StatsLogProcessor.cpp
6df5fcc12646b8695fe1dc9944af4df37cfe5bf5 12-Apr-2018 Yangster <yanglu@google.com> Lock the pulling alarm handler.

Test: statsd test

BUG: b/77906846

Change-Id: I414771a20babfb2324e47dd8ddbb44eaa088d199
/frameworks/base/cmds/statsd/src/StatsLogProcessor.cpp
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/StatsLogProcessor.cpp
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/StatsLogProcessor.cpp
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/StatsLogProcessor.cpp
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/StatsLogProcessor.cpp
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/StatsLogProcessor.cpp
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/StatsLogProcessor.cpp
c04feba805c5acde92638a062cc13030fc4d3308 02-Apr-2018 Yangster-mac <yanglu@google.com> Move forward the alarm timestamp when config is added to statsd.

Test: statsd test
BUG: b/77344187

Change-Id: Ieacffaa29422829b8956f2b3fcb2c647c8c3eed9
/frameworks/base/cmds/statsd/src/StatsLogProcessor.cpp
46eef8d0497d357e5fc2a3e63e7150f2b9372f03 31-Mar-2018 TreeHugger Robot <treehugger-gerrit@google.com> Merge "E2e test for periodic alarm." into pi-dev
1a0a941c20eb746868d0de52e3806f69c74d335f 28-Mar-2018 Chenjie Yu <cjyu@google.com> Fix StatsCompanionService pull on bucket ends

+ change StatsPullerManager internal time units to be consistent
+ use series of alarms for pullers, instead of use setRepeating

Bug: 76223345
Bug: 75970648
Test: cts test
Change-Id: I9e6ac0ce06541f5ceabd2a8fa444e13d40e36983
/frameworks/base/cmds/statsd/src/StatsLogProcessor.cpp
684d195227bf9eaeb21698cbdcf865afb570c454 25-Mar-2018 Yangster-mac <yanglu@google.com> E2e test for periodic alarm.

Test: new test

BUG: b/76281156
Change-Id: I60cb28baaeec6996e946a7cb3358ec8e0aca80e5
/frameworks/base/cmds/statsd/src/StatsLogProcessor.cpp
52b478b56a156f9c75329b7d25e6bd4583464400 27-Mar-2018 Yao Chen <yaochen@google.com> Update Guardrail.

+ Config count is 10 per uid
+ Update the limit for metrics, matchers, conditions, etc.

Test: statsd_test

Bug: 73122377

Change-Id: I3e1adfe318d1354a7c9d1bf484855661aa3a1fc8
/frameworks/base/cmds/statsd/src/StatsLogProcessor.cpp
4c6d97a1e4e3f758d8725a980af0679f57f95ac8 23-Mar-2018 David Chen <dwchen@google.com> Fix statsd dropping metrics data.

We can increase the buffer of metrics we store in statsd memory, but
we still request the clients to call getData when the metrics memory
exceeds 128 KB (previously was 90% of 128 KB).

Bug: 76171061
Test: Test that unit-tests still pass.
Change-Id: I901545b364ed313af8c033ce9b40d3cfadb93213
/frameworks/base/cmds/statsd/src/StatsLogProcessor.cpp
e51af37475a758d5d6ec024d79d9d2b3a7358f85 21-Mar-2018 Howard Ro <yro@google.com> Merge "Fix recovery of stats data from previous input while using ProtoOutputStream" into pi-dev
4beccbe3de7537365856bbd2a34be8d6f226b8b8 16-Mar-2018 yro <yro@google.com> Fix recovery of stats data from previous input while using
ProtoOutputStream

- Specify the length of message to avoid libprotoutil from thinking that
we are trying to write bool
- We only attach the previous dump file to the upload file where config
key matches
- Store ConfigMetricsReport (instead of ConfigMetricsReportList) onto
disk
- Stop use stack after scope in StorageManager
- Migrate UidMap to use ProtoOutputStream and renaming variables to
prevent confusion

Bug: 74021554
Bug: 75968524
Test: manual test, statsd_test, CTS tests
Change-Id: Iedf52633d7f5b985f5a934a3fb5a0c3c3b2e7fd1
/frameworks/base/cmds/statsd/src/StatsLogProcessor.cpp
c40a19d2e43d5de3e036e926bf070220c2c865e6 16-Mar-2018 Yao Chen <yaochen@google.com> Add uid field annotation in atoms.proto and statd memory usage optimization.

[memory]
statsd binary size from 664k -> 600k
memory usage 1978k -> 1813k (with no configs)
+ Avoid initialize any static map in statslog.h to avoid many copies of the map in each include.
- Do it in cpp so that it is initialized only in places that use them

[Uid annotation]
+ Uid annotation is needed for extracting uid from dimension for UidCpuPuller.
+ After the change, stand-alone uids don't need to be in field 1 anymore.
+ Also added exclusive bit annotation in AppDied
+ Currently only allow one uid field in an Atom. This is to keep things simple until
we find an exception.

Test: statsd_test
Bug: 73958484
Bug: 72129300

Change-Id: I8a916d5c00d5930e24ae7e0825a57dea19c0e744
/frameworks/base/cmds/statsd/src/StatsLogProcessor.cpp
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/StatsLogProcessor.cpp
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/StatsLogProcessor.cpp
1cf2ac5241b848ea160b65604bc894d08cba8518 08-Mar-2018 yro <yro@google.com> Write data to file when StatsCompanionSerivice (system_server) crashes

Bug: 73352867
Change-Id: Iecbb1ae3e29264975771155a878b368cfc2f50f0
Test: statsd_test
/frameworks/base/cmds/statsd/src/StatsLogProcessor.cpp
5ee0787024cc446a21008ff5710dec19c6afc834 06-Mar-2018 Yi Jin <jinyithu@google.com> Use uint64_t instead of long long as API type for consistent reason.

Bug: 74118023
Test: manual
Change-Id: Icd5f506c76d3a008a79cb6c9d2061962ca7fdd40
/frameworks/base/cmds/statsd/src/StatsLogProcessor.cpp
06dba5d79c096b02d3ba6fb73e64451ff12e388d 26-Jan-2018 Yao Chen <yaochen@google.com> Add API to let metrics directly drop data without writing to an output.

+ Metrics will do flushIfNeeded() to correctly move the clock and informing
AnomalyTracker the past bucket info, and then clear past buckets.

+ We will still keep the current bucket data for the validity of the future metrics.

Bug: 70571383
Test: statsd_test
Change-Id: Ib13c45574974e7b4e82bd8f305091dc93bda76f5
/frameworks/base/cmds/statsd/src/StatsLogProcessor.cpp
6158952c30497fa10bed5f7955cfb25c394e7593 28-Feb-2018 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Avoid reading logs that were processed before."
8f42ba0e2c70a441bc7821dd32d5bab1c562b062 28-Feb-2018 Yao Chen <yaochen@google.com> Avoid reading logs that were processed before.

This could happen when statsd is disconnected from logd reader. When we reconnect, we are going to
get all events from the buffer again.

Bug: 72379125
Test: manual
Change-Id: Ie0122d5452555500c3bdfc1f905a0b1c646efdf7
/frameworks/base/cmds/statsd/src/StatsLogProcessor.cpp
03b91d77c4eccd2d088a12e6fe747240a09b573d 28-Feb-2018 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Alarm: wakes up statsd and notifies the subscribers."
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/StatsLogProcessor.cpp
926fc7571a656b6ab7b758e4b108aee102029c94 23-Feb-2018 David Chen <dwchen@google.com> Fixes timebase used when dumping reports.

We should be using elapsed realtime for most timestamps in statsd
so that the times can only increase monotonically.

Test: Test that statsd builds and unit-tests passes.
Change-Id: I0bb23e89aa9a6dbf6d56a0c23eec77bdd053f29b
/frameworks/base/cmds/statsd/src/StatsLogProcessor.cpp
6189807c12e9cf32a36d32557725561c44b8aa5a 14-Feb-2018 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Remove unused variables in statsd, and make more warnings show."
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/StatsLogProcessor.cpp
4c959cb99eb7e71e5417a61f5429c5fa0073e826 13-Feb-2018 Yao Chen <yaochen@google.com> Remove unused variables in statsd, and make more warnings show.

Test: statsd_test

Change-Id: I2c7b674cb615f22c5de90c2de5f2d58108ab2e7f
/frameworks/base/cmds/statsd/src/StatsLogProcessor.cpp
aab45c1d09d3191a1289fb9d0408bfc2cfe7cf98 08-Feb-2018 yro <yro@google.com> Remove sending broadcast when StatsLogProcessor is being initialized as
its clients have not started to receive broadcasts

This also fixes broken statsd_test's which happens whenever there are
files in /data/misc/stats-data/ which is generated right before reboots.
This would delay the upload time from right after reboot to next upload
cycle but it should not be an issue.

Bug: 73089712
Test: statsd_test
Change-Id: Ida81099c9c9e54804a0c3b3b349096312ef570bc
/frameworks/base/cmds/statsd/src/StatsLogProcessor.cpp
8a8d16ceea1e5b7a2f8c41e17b5d993035f50f5d 08-Feb-2018 Yao Chen <yaochen@google.com> Statsd CPU optimization.

The key change is to revamp how we parse/store/match a log event, especially how we match repeated
field and attribution nodes, and how we construct dimensions and compare them.

+ We use a integer to encode the field of a log element. And also encode the FieldMatcher into an
integer and a bit mask. The log matching becomes 2 integer operations.

+ Dimension is stored as encoded field and value pair. Checking if 2 dimensions are equal is then
becoming checking if the underlying integers are equal. The integers are stored contiguously
in memory, so it's much faster than previous tree structure.

Start review from FieldValue.h

Test: statsd_test + new unit tests

Bug: 72659059

Change-Id: Iec8daeacdd3f39ab297c10ab9cd7b710a9c42e86
/frameworks/base/cmds/statsd/src/StatsLogProcessor.cpp
484524a246ffe453f8cd89b698a279c23b0bde1f 02-Feb-2018 Tej Singh <singhtejinder@google.com> Turn off debug logging in statsd

Sets DEBUG to false everywhere and replaces all ALOGD with VLOG so they
do not print with DEBUG false. Leaves all ALOGI, ALOGW and ALOGE as is.

Test: ran all CTS tests and checked "adb logcat -s statsd" to make sure
it wasn't spammy

Change-Id: Iaa8eb3a0a63723ffe40f94f2815f94df877fd432
/frameworks/base/cmds/statsd/src/StatsLogProcessor.cpp
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/StatsLogProcessor.cpp
fa22d65f146c94873ba98b768b08c643424c4477 05-Feb-2018 Chenjie Yu <cjyu@google.com> puller cache clearing

+ add adb command to manually clear puller cache
+ try to clear puller cache every 10s

Test: manual test
Change-Id: I8005cacd189de1880fcaeb030efbe21e6d3c0244
/frameworks/base/cmds/statsd/src/StatsLogProcessor.cpp
357b63b1727177e53f6ef896887b04eb7d71d274 30-Jan-2018 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Cpu usage optimization: 1/ Avoid unnecessary field/dimension proto construction. 2/ use unordered_map for slicing. 3/ Use dimension fields to compare dimension keys."
7ba8fc357e44ee3bb8e614c202852a1c46a9d4a8 25-Jan-2018 Yangster-mac <yanglu@google.com> Cpu usage optimization:
1/ Avoid unnecessary field/dimension proto construction.
2/ use unordered_map for slicing.
3/ Use dimension fields to compare dimension keys.

Test: all statsd tests passed.
Change-Id: I2f74f78589b7f6ecd0803a2ead822b8d0399f334
/frameworks/base/cmds/statsd/src/StatsLogProcessor.cpp
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/StatsLogProcessor.cpp
d0c260ff418f0d1c9d1536eb1420373391116f88 25-Jan-2018 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Adding guardrails on writing to disk from statsd"
82c2173b678ebff8092ec2a77eaaf4c987e109bd 24-Jan-2018 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Statsd always includes snapshot of uid map."
3f9a1a54268f5b191f785b7a2461c1fbc6910b26 24-Jan-2018 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Fix deadlock for write-disk cmd."
98a28501fe8ab53a490ec353c8a1f74f2e329cc5 19-Jan-2018 yro <yro@google.com> Adding guardrails on writing to disk from statsd

- Limit total number of files to 1000
- Limit total size of files to 5MB
- Remove idle files to be deleted after 30 days

Bug: 69854160
Test: manual testing, statsd, statsd_test
Change-Id: I33148a3b7ca11d413ec2495d5c0659f1ba4485c3
/frameworks/base/cmds/statsd/src/StatsLogProcessor.cpp
cfc311d2f098de441bb2eeb7d27ea158773e281b 24-Jan-2018 David Chen <dwchen@google.com> Statsd always includes snapshot of uid map.

Statsd will contain at least one snapshot of the uid map. The
previous design was not very robust in case a snapshot was missing.

Also fixes subtle bug with updating the isolated uid mapping since
this should always be kept up to date even if there are no metrics
being used (since metrics may be added later after the isolated uid
was created).

Test: Checked that unit-tests pass on marlin-eng.
Change-Id: I99754ed9016d980564e409b0946a46b398fd12b7
/frameworks/base/cmds/statsd/src/StatsLogProcessor.cpp
861795096296ebbe6d5b147519ad52a43b4b957c 24-Jan-2018 Yangster-mac <yanglu@google.com> Fix deadlock for write-disk cmd.

Test: manual tested.
Change-Id: I6c1e1f10bbb3830c932b3d7b57df8d4960c13977
/frameworks/base/cmds/statsd/src/StatsLogProcessor.cpp
68985805f26f5da6cc6b63934cb00fbff2741ca9 21-Jan-2018 Yangster-mac <yanglu@google.com> Avoid processing log event when there is no uid field.

Test: all statsd unit test passed

Change-Id: Id434d86586950a485b30a244f3c030e8202c1c6d
/frameworks/base/cmds/statsd/src/StatsLogProcessor.cpp
8282d5b8bc528c765cd29ee65ee1d287ccb9f5bb 19-Jan-2018 Yangster-mac <yanglu@google.com> Avoid processing the log event when there is no config.

Test: statsd unit test passed
Change-Id: If9840283accdeaa36d956213a1a9fec44204e77d
/frameworks/base/cmds/statsd/src/StatsLogProcessor.cpp
079cea9a7e1e7a7c6f819adf51428e6b172d480f 12-Jan-2018 yro <yro@google.com> Create /data/misc/stats-data/ and /data/misc/stats-service/ in statsd.rc
rather than during the runtime of statsd

The purpose of this change is to prevent causing selinux violation by
trying to mkdir to /data/misc/ directory when statsd doesn't have
permission to do so.

Bug: 71537285
Test: manually tested to make sure that there's no sepolicy violation

Change-Id: I9c4ccecc416f41923c9b24dd44a388d135fecc07
/frameworks/base/cmds/statsd/src/StatsLogProcessor.cpp
d40053eb8bcb19c7c3b080a36714566bb4e4a748 10-Jan-2018 Yangster-mac <yanglu@google.com> Map isolated uid to host uid when processing log event in statsD.

Test: added test case for isolated uid in Attribution e2e test.
Change-Id: I63d16ebee3e611b1ef0c910e5154cf27766cb330
/frameworks/base/cmds/statsd/src/StatsLogProcessor.cpp
b0d0628a2915449db2c4ec071bea0cdeff3af210 06-Jan-2018 Yangster-mac <yanglu@google.com> Thread-safety at log processor level.

Test: statsd unit test passed.

Change-Id: Ibe8c8d3cc8297875b16ee385c077b71c87353147
/frameworks/base/cmds/statsd/src/StatsLogProcessor.cpp
147ce6027880d05286f051f1501100a4ce2b52e8 22-Dec-2017 Yao Chen <yaochen@google.com> use only string type in the log source whitelist.

+ predefined "AID_X" will be provided as string type to statsd, and we will translate
to integer uid using the static map.

Test: statsd_test

Change-Id: Ie47d8481e0c456457e6881ebb9cb4ce008e772b8
/frameworks/base/cmds/statsd/src/StatsLogProcessor.cpp
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/StatsLogProcessor.cpp
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/StatsLogProcessor.cpp
857aaa520804d846a050e1eeb85d82977c983666 20-Dec-2017 Bookatz <bookatz@google.com> Splits AnomalyTracker into two files

Splits out DurationAnomalyTracker-specific functions into their own
subclass.

Test: the unit tests and CTS tests
Change-Id: Id6eb74d232b4a9c3a932d805d1ba3f0ba43a88b1
/frameworks/base/cmds/statsd/src/StatsLogProcessor.cpp
d10f7b1c7bdb1c66aa04148945cae9733ee4cadf 18-Dec-2017 Yao Chen <yaochen@google.com> Add log source filtering in statsd to filter out spams.

+ Add log source whitelist in StatsdConfig
+ Some changes in UidMap API. Listener needs to be wp instead of sp.
+ Update dogfood app config to have log source
+ Increase the stats service thread pool size to 10 (9+1).

TODO: add unit tests(b/70805664). This unit test takes some time to write.

Test: statsd_test & manual

Change-Id: I129b1cc13db5114db7417580962bd7cc4438519d
/frameworks/base/cmds/statsd/src/StatsLogProcessor.cpp
85ed8387135849f256cecb4429c75938ad91cd55 15-Dec-2017 Chenjie Yu <cjyu@google.com> align metrics to 5min bundary
We use one alarm clock for all pulled atoms.
If metrics from different configs are not aligned,
the clock will be set to repeat at higher and higher
frequency, and consume a lot of battery.
Current implementation assumes a 5min minimum bucket
size. New metric start time is set to be aligned to
the start time of statsd in the next 5min.
So it will ignore events up to 5min.

align puller alarm to minute bundary

Test: unit test
Change-Id: I77ffa3c13de363c780b1000181b9a9b780dd0846
/frameworks/base/cmds/statsd/src/StatsLogProcessor.cpp
2d48f13c7d1e344e6f160f54b9affdd799a2b5b7 14-Dec-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Only create ProtoOutputStream when onGetData() is called."
288c60001330a5a924a47c0eebd6097ae3ee5d67 12-Dec-2017 Yao Chen <yaochen@google.com> Only create ProtoOutputStream when onGetData() is called.

The exception is EventMetricProducer. Each EventMetricProducer will still have a ProtoOutputStream
Because LogEvent comes as a fixed 4K, it's more memory efficient to have an 8k ProtoOutputStream for
storing the events.

Also removed finish() api in MetricProducer, which was intended to use with Dropbox.

Test: statsd_test & dogfood app
Bug: 70393808
Change-Id: I2efe4ecc76a88060a9aa5eb49d1fa6ea60bc5da8
/frameworks/base/cmds/statsd/src/StatsLogProcessor.cpp
03faf093301847f0ac293ce8d6fcb0bce657a841 12-Dec-2017 yro <yro@google.com> Migrate disk directory from /data/system/ to /data/misc/

Test: statsd, statsd_test
Change-Id: I6d2fe97afd79fb9b36d180d5e6e6a7a166a228b7
/frameworks/base/cmds/statsd/src/StatsLogProcessor.cpp
d9269e2ee70b01cad3dda14c786e0e4434192248 05-Dec-2017 David Chen <dwchen@google.com> Adds rate limit to checking byte size.

Since there is a separate guardrail for memory used by uid map, we
no longer add the memory from uid map with the memory per each
config's metrics. We also prevent the byte size check from happening
too frequently. In order to mock the MetricsManager, we refactor
some of the existing methods.

Test: Added unit-tests and verified they all pass on marlin.
Change-Id: I15cf105f7d95f4016fdb0443b0a33eebe862cafb
/frameworks/base/cmds/statsd/src/StatsLogProcessor.cpp
312e898325372871eb73d5813adc029c54fb2780 06-Dec-2017 Yao Chen <yaochen@google.com> Let the event flow to MetricsManager. Comment out the size check only.

Test: statsd_test, and manual
Change-Id: I862967510eaf4d402471e9dd6b9c85f6037dd7e1
/frameworks/base/cmds/statsd/src/StatsLogProcessor.cpp
0b73ccad8fb47b1bcc5c89b0c10fac937336ab1e 05-Dec-2017 Yao Chen <yaochen@google.com> Urgent fix. Once UidMap size exceeds the limit, statsd triggers data drop every time a log comes in

Test: manual
Change-Id: Idf93e5aca19b80acf964670fa4bc9f1f0781df1f
/frameworks/base/cmds/statsd/src/StatsLogProcessor.cpp
12942956bcd6213d3349227ae8567e63f9644935 04-Dec-2017 David Chen <dwchen@google.com> Tiny fix to bug when statsd should clear data.

Previously, we always sent a broadcast, even after we have exceeded
the memory limit for this config key. We switch the order so that
we drop the data if the limit is exceeded. If greater than 90% of the
way to the limit, we send the broadcast.

We need to find a way to unit-test this behavior.

Test: N/A.
Change-Id: I6ea40b9e34dceb19805d9af24495d72878f787e0
/frameworks/base/cmds/statsd/src/StatsLogProcessor.cpp
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/StatsLogProcessor.cpp
3e585ecb513bf8294cc36a4d8d6da97b9726ab22 28-Nov-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Some fixes in StatsdStats, and add some unit tests"
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/StatsLogProcessor.cpp
cc5adef2d0c5f96a225fd69517fd1eecb557f46d 21-Nov-2017 Bookatz <bookatz@google.com> Statsd anomaly detection - fixes

Fixes a few items in AnomalyTracker, especially to do with what happens
when an anomaly alarm fires.

Test: unit tests still pass
Change-Id: Ia89bd617442e952e587336b890c3ca67430b5e21
/frameworks/base/cmds/statsd/src/StatsLogProcessor.cpp
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/StatsLogProcessor.cpp
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/StatsLogProcessor.cpp
7c334a129e93e405a72e8299a1cd928af079d14f 22-Nov-2017 Yangster <yanglu@google.com> Make member function as const whenever possible.

Test: unit tests passed.
Change-Id: I751cabf305a4b5aa2095853cc951837da0df4c78
/frameworks/base/cmds/statsd/src/StatsLogProcessor.cpp
e2cd6d509b17894b95d14523ae3e7c4c7a9a74e3 10-Nov-2017 Yangster-mac <yanglu@google.com> 1/ Duration anomaly tracker with alarm.
2/ Init anomaly from config based on the public language.
3/ Unit tests for anomaly detection in count/gauge producer.
4/ Revisit the duration tracker logic.

Test: unit test passed.
Change-Id: I2423c0e0f05b1e37626954de9e749303423963f2
/frameworks/base/cmds/statsd/src/StatsLogProcessor.cpp
1d7b0cd6b54e3b3ec8efdffd47b40cdd54c4e8d7 15-Nov-2017 David Chen <dwchen@google.com> Support StatsD sending broadcasts.

StatsD will send a broadcast when we're 90% of the way to our
allocated memory limit for the configuration. If the memory usage
goes over the limit, we just lose all the data for this config.

Also modifies the adb shell commands to facilitate debugging of the
broadcasts.

Test: Manually tested on marlin-eng with custom gmscore code.

Change-Id: I517a15bd4c959aa221802f84a51f13141a725102
/frameworks/base/cmds/statsd/src/StatsLogProcessor.cpp
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/StatsLogProcessor.cpp
b0378b093d9b937fe9a731a601d670d50f263078 10-Nov-2017 yro <yro@google.com> 1. Add FIELD_COUNT_REPEATED bit masks to repeated fields that were previously missing
2. Resolve segfault when serializing proto into vector of uint8_t
3. Add a local byte size variable for EventMetric data as we cannot call
size() of ProtoOutputStream before we finish writing.
4. Replace hardcoded conversion of second to nano second with NS_PER_SEC

Test: statsd, statsd_test

Change-Id: I47a2ce2b05e6191c18596489682118edcb41e945
/frameworks/base/cmds/statsd/src/StatsLogProcessor.cpp
570d4db0c9d46458b3bda68e5a44a8d1ea38cbe4 10-Nov-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Tracks isolated uid's and their parent uid."
21582961d779ea7190bd35a07805b9e41b43b05c 02-Nov-2017 David Chen <dwchen@google.com> Tracks isolated uid's and their parent uid.

We push events from BatteryStatsImpl if an isolated uid is added or
removed and we have a custom rule in statsd to use these events to
update our uid map. In the future, we need to use this map to
convert all incoming uid's to their host uid.

Test: Added unit-test to UidMap_test.
Change-Id: I33c0451eb2c886161f22dd12e479d216fad0940d
/frameworks/base/cmds/statsd/src/StatsLogProcessor.cpp
17adac9cf3e03ad95372eb8657b26909d0414ac0 09-Nov-2017 yro <yro@google.com> Finish migrating to use ProtoOutputStream. This change will take the
outputs of each MetricProducer's and merge the results into
ConfigMetricsReport which holds ConfigKey, repeated field of
StatsLogReport, and UidMap. The data will be represented as
vector<uint8_t> which can be passed down to binder call for clients to
pick up. Also, all unnecessary dependencies to stats_log proto have been
removed.

Test: statsd, statsd_test
Change-Id: Ia69137cbc8613644a892e6be1e87b4858bd39fe3
/frameworks/base/cmds/statsd/src/StatsLogProcessor.cpp
93fe3a34a02c673eaee4a2d18565ba8df20685cb 02-Nov-2017 Yao Chen <yaochen@google.com> Add unit tests for CountMetricProducer, EventMetricProducer

And other miscellaneous fixes.
+ clang-format
+ 2 bug fixes, one in dump-report command, one in ResourcePowerManagerPuller

Test: statsd_test

Change-Id: Ibd164d948ad62adcc529d813df1210781e38be47
/frameworks/base/cmds/statsd/src/StatsLogProcessor.cpp
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/StatsLogProcessor.cpp
69007c82625dd8b19bd68d1031191e2ff83b5f49 27-Oct-2017 yro <yro@google.com> Implement a logic to rate limitted flush statsd with by checking the
size of each MetricsProducer's. The implementation of byteSize() method
is still TBD as it depends on migration to ProtoOutputStream.

Test: statsd, statsd_test
Change-Id: I966606044d7cb814dabe94192bacecad91f28177
/frameworks/base/cmds/statsd/src/StatsLogProcessor.cpp
fd05a4ee56d72cf743c5186973fa6fd5100b2c04 26-Oct-2017 yro <yro@google.com> Remove dropbox dependency from StatsLogProcessor

Test: statsd, statsd_test

Change-Id: Ia9a3e9b2b3ffffaed81f6045ec43b7d908947fb6
/frameworks/base/cmds/statsd/src/StatsLogProcessor.cpp
31eb67b3498d326659b2b164ff367a01a793d641 24-Oct-2017 yro <yro@google.com> Adds aidl definitions and their implementations for binder transfer of
statsd entries to clients. This change only includes changes on statds
side and does not include java library for clients to import. Java
library will be a separate change as it requires system api review.

Test: statsd, statsd_test
Change-Id: I306c6e9687801668cc0145b12d38406bfe634775
/frameworks/base/cmds/statsd/src/StatsLogProcessor.cpp
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/StatsLogProcessor.cpp
c4dfae56c10a1dd571baa78c750f2e68c919d74f 18-Oct-2017 Joe Onorato <joeo@google.com> Introduce a new wrapper for log_msg -- LogEvent

It stores all of the parsed fields in a single vector, and
provides accessor methods to get at fields by index with
their correct type.

Test: statsd_test
Change-Id: I4fa94e4ce52db3ac87f19b62f9c85398de6e8145
/frameworks/base/cmds/statsd/src/StatsLogProcessor.cpp
9fc9edf95a308f5884bf541cac81ce1f41aba0ba 16-Oct-2017 Joe Onorato <joeo@google.com> Clean up how we handle configurations, and other assorted cleanup

- Add a ConfigManager class that tracks the configurations
that have been passed to us. Configurations are now
tracked by tuples of (uid,tag), where the tag is an
app-defined string, in case a single uid has multiple
configurations.
- Move all of the initialization into StatsService.
- Get rid of the ability to have multiple LogListeners. Raw
events are now pushed directly into StatsService, which
can distribute them to the interested parties (and will
eventually be able to do the proper locking).
- Add Log.h, which sets our LOG_TAG correctly.
- Move some of the related files that I expect will grow some
into their own subdirectories.

Test: statsd_test
Test: adb shell cmd stats config ...
Test: adb shell dumpsys stats
Change-Id: I79487603003d8a842d5bd319741f1ecbf72063d1
/frameworks/base/cmds/statsd/src/StatsLogProcessor.cpp
de70169109c57787a23c732ec4b361ade2e9850e 05-Oct-2017 David Chen <dwchen@google.com> UID mapping to provide app name and version.

The UID map is updated by StatsCompanionService, which listens to broadcast
updates indicating that an app was updated/installed or removed. Also,
the entire map is updated when statsd first connects to the companion
service. Also, there is a way for metrics producers to subscribe to
updates, so that they can know when an app was upgraded.

Test: Created new unit-test for mapping and manually tested for install
and remove. Did not manually test the app upgrade.

Change-Id: I6676ae5c93b75c72d9badabb36aa9c40006db07d
/frameworks/base/cmds/statsd/src/StatsLogProcessor.cpp
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/StatsLogProcessor.cpp
44cf27c14880005df093f372491c593e1a9a3c58 15-Sep-2017 Yao Chen <yaochen@google.com> Add metric computation skeleton to statsd.

This cl is to let statsd understand statsd_config, and compute metrics
defined in the config.

+ StatsLogProcessor is given a StatsdConfig (hard coded right now).
We construct a MetricProducer for each of the metric, and the metrics
share Condition and LogEntryMatchers

+ Added the CountMetricProducer type for CountMetric.

We can now count times of SCREEN_ON events given a config.

TODO: 1) conditions are not implemented.
2) slicings are not implemented in CountMetric
3) move the interaction to dropbox to a separate thread
4) decide how the in memory metrics would be used by anomaly detection

Test: manual test.

$ adb shell /system/bin/statsd

$ cat config_file.dat | adb shell cmd stats config

Change-Id: I38f4059c0dc5a827c338131d4a6fa7d4cbe865db
/frameworks/base/cmds/statsd/src/StatsLogProcessor.cpp
fbeb4cb3af245ab13566160e0da3ced19484223f 25-Sep-2017 yro <yro@google.com> Merge multiple eventMetricData entries into a single StatsLogReport
when writing to dropbox

Test: manual test.

Change-Id: I8ce323002ae1cad62703ece92bd99a5058b16fba
/frameworks/base/cmds/statsd/src/StatsLogProcessor.cpp
3f0c1f23682c81b4952a2123e35f5f2c511cf3cf 22-Sep-2017 Yao Chen <yaochen@google.com> Fix a timestamp bug.

Test: manual
Change-Id: I8067fa8029c0b5702cae09202f8f9f7e443e902d
/frameworks/base/cmds/statsd/src/StatsLogProcessor.cpp
ef99c4fa23b42fe6e58db706b9f4780018b6bf3e 23-Sep-2017 Yao Chen <yaochen@google.com> clang-format existing code in statsd.

Added .clang-format, because there isn't an official .clang-format file for Android framework code.

before we upload changes, do:

clang-format -style=file -i [file list]

to format the files that you touched.

Test: formatting only. NO code changes.
Change-Id: I90e87f1ee6618da8ea9bc2221c609c415a4046a8
/frameworks/base/cmds/statsd/src/StatsLogProcessor.cpp
906a35c814817c8bd503c3f4df8af9a2f622169d 21-Sep-2017 Bookatz <bookatz@google.com> Statsd namespace is defined and used

Statsd code now lives in android::os::statsd namespace. Existing files
are largely modified to follow this convention.

Exception: parse_util, since it seems a bit different.

Test: code compiles and existing statsd_tests still pass
Change-Id: Idf92a071b9ed172d01eb3087a4fa3609d67a038c
/frameworks/base/cmds/statsd/src/StatsLogProcessor.cpp
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/StatsLogProcessor.cpp
0656b7a158f6f71989e76ba55423217e3e75d8b4 14-Sep-2017 David Chen <dwchen@google.com> Adding ability to add configs via adb command-line. The input
must be in serialized binary format. Also fixes small issue
in build rule related to proto lib.

Test: Manually tested that ADB command works without crashing.

Change-Id: Iba2e677561ff500adb601a598f73e8a7b32540e5
/frameworks/base/cmds/statsd/src/StatsLogProcessor.cpp
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/StatsLogProcessor.cpp