593 Commits

Author SHA1 Message Date
David Chen
9fdd40302e Allow statsd to be given empty config.
Statsd clients may want to set an empty config temporarily, so it's
more convenient to allow them to set an empty config instead of
having to use the removeConfig and then having to remember to call
StatsManager#setDataFetchOperation.

Test: Added unit-tests and check they pass on marlin-eng.
Bug: 74997752
Change-Id: I2e762e5ec01e5a2c9a3469fb330b53fefbd734d6
2018-03-20 15:56:11 -07:00
TreeHugger Robot
790befca1d Merge "Delete TODO about renumbering statd atoms" into pi-dev 2018-03-19 05:54:22 +00:00
TreeHugger Robot
ad121b9fdc Merge changes I3ffb6e97,I689df136,Ia67a8eb6 into pi-dev
* changes:
  Statsd: remove DurationAnomalyTracker.resetStorage
  Statsd AnomalyDetection stopAlarm also checks old
  Statsd AnomalyDetection improvements
2018-03-19 05:49:27 +00:00
Bookatz
555ad97637 Delete TODO about renumbering statd atoms
Test: none
Bug: 72553942
Change-Id: If59ee407dffaed713a3a2f7543314aef3e70ef2c
2018-03-16 15:47:57 -07:00
Bookatz
6a1d3af7f5 Statsd: remove DurationAnomalyTracker.resetStorage
The explicit resetStorage function in the subclass isn't needed.
It does exactly what its superclass does.
The previous check for !mAlarms.empty() was actually not needed, since
there can be legit cases where !mAlarms.empty() (namely, when the
mMostRecentBucket is moved forward initially - we may call reset, but we
still want the old alarms to remain).

Test: still pass
Change-Id: I3ffb6e97c02b75170c246f57d55ccf59cd368b9c
Fixes: 74607818
2018-03-16 15:25:49 -07:00
Bookatz
3e8cd35b55 Statsd AnomalyDetection stopAlarm also checks old
Every time stopAlarm() is called, it should also,
right then, check to see if the alarm should actually
have already fired (but didn't due to AlarmManager lag).
Right now, the client needs to do this check separately,
but they always go together. Indeed, MaxDurationTracker
forgot to do the check, which is a bug. It would make
much more sense if the stopAlarm takes care of it for
them, to prevent such mistakes.

Bug: 75273733
Test: make statsd_test && adb sync data && adb shell data/nativetest64/statsd_test/statsd_test
Test: cts-tradefed run cts-dev -m CtsStatsdHostTestCases -t android.cts.statsd.alert
Change-Id: I689df13690df822090ac34b1171e948be1ad0d9f
2018-03-16 13:23:19 -07:00
Bookatz
6bf9825b15 Statsd AnomalyDetection improvements
Various fixes and improvements to statsd's anomaly detection.

Bug: 74607818
Test: make statsd_test && adb sync data && adb shell data/nativetest64/statsd_test/statsd_test

Change-Id: Ia67a8eb6da0ea9293f698949e1565f7f024a7cb9
2018-03-16 11:34:21 -07:00
David Chen
f384b90049 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
2018-03-15 13:33:04 -07:00
TreeHugger Robot
a825c8ee5d Merge "Support slicing by chain." into pi-dev 2018-03-15 02:27:15 +00:00
TreeHugger Robot
8568931d6f Merge "Add stats from storage manager to dumpsys result" into pi-dev 2018-03-14 23:05:33 +00:00
Yangster-mac
e06cfd777a Support slicing by chain.
BUG: b/73975181

Test: statsd test
Change-Id: I913ae0f68ff21ed0703bb5da9c60d3eaa3bf5981
2018-03-14 15:36:24 -07:00
yro
665208d743 Add stats from storage manager to dumpsys result
Bug: 74601313
Test: manual test, statsd_test
Change-Id: Ifdde6bb10d29f3983b0c27a66a6e30f1f40308ee
2018-03-14 12:46:27 -07:00
TreeHugger Robot
c7ce1a0978 Merge "Add wall clock timestamp for ConfigMetricsReport and gauge atoms." into pi-dev 2018-03-14 19:03:06 +00:00
TreeHugger Robot
a9e73469c5 Merge "Remove unused shared lib from statsd" into pi-dev 2018-03-14 18:48:20 +00:00
TreeHugger Robot
aaadf6663f Merge "Statsd: Remove storage of bucketNum" into pi-dev 2018-03-14 16:51:41 +00:00
TreeHugger Robot
dc8e7fa0ae Merge "Dump the stats for count/gauge/value metrics." into pi-dev 2018-03-14 16:45:49 +00:00
Yangster-mac
a78d00874d Dump the stats for count/gauge/value metrics.
Bug: b/74159560

Test: statsd test
Change-Id: I1410309ecfdfc2a5becf8d0c620c68a621ebc5fa
2018-03-14 16:45:37 +00:00
TreeHugger Robot
3ce667a466 Merge "Add vendor-logged stats to statsd." into pi-dev 2018-03-14 05:35:03 +00:00
Andrew Chant
28d627e4be Add vendor-logged stats to statsd.
Add atoms to statsd that are logged by code residing in /vendor.
These atoms are reported from code in /vendor, and
rely on a vendor-provided /system daemon to log the atoms to statslogd.

Test: Built & reported manually.
Bug: 74261180
Bug: 74261750
Bug: 74258154
Bug: 74260998

Change-Id: I858a1266c4c212808fb63276439f1dd6cf2a387e
2018-03-14 05:34:47 +00:00
Howard Ro
a32913f087 Merge "Add a check for duplicate configuration on statsd" into pi-dev 2018-03-13 21:38:16 +00:00
Bookatz
3f5ab3ff1d Statsd: Remove storage of bucketNum
Past buckets had a field mBucketNum, storing the
"bucket number" they represented. Currently, the concept
of bucket number is used by Anomaly Detection (although this
may not be necessary), but these stored values are not used at all,
so removing them will save RAM.

Test: statsd tests still pass
Bug: 74607818
Change-Id: Iacc343bc39c5035f6e2f236c03de1d91606eff4c
2018-03-13 12:18:21 -07:00
yro
4490765d15 Add a check for duplicate configuration on statsd
Bug: 74349901
Test: statsd_test, manual testing of functionality

Change-Id: Ia4e3e51bfe61f5f773cecadda23e53d24b768dc8
2018-03-13 11:15:00 -07:00
Tej Singh
5d991e1f25 Atoms: Bluetooth
Adds atom defininitions for some bluetooth atoms.
Logging will go in aosp. ag/3668205 contained most of this change, but
is being split up and moved to pi-dev and aosp.

Bug: 74457175, 72320489
Test: build success on marlin
Change-Id: Ib14a74eabfab08bbae5d4d549244f1022e8c34f0
2018-03-12 21:03:22 -07:00
TreeHugger Robot
81cacb274c Merge "Statsd BroadcastSubscribers can receive 'cookies'" into pi-dev 2018-03-12 18:27:02 +00:00
TreeHugger Robot
9722ec74e0 Merge "Remove kPullerCooldownMap from code" into pi-dev 2018-03-12 18:25:00 +00:00
Yangster-mac
3fa5d7fb23 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
2018-03-10 22:25:28 -08:00
TreeHugger Robot
072a82abf3 Merge "statsd AnomalyDetection improvements" into pi-dev 2018-03-10 00:55:21 +00:00
Bookatz
423f753ea3 statsd AnomalyDetection improvements
Re-add check to make sure that bad config won't cause duration
anomaly detection to crash stastd

Bug: 74399947
Test: manual
Change-Id: Id175d233685c133ec3d4231272fe5708250dee6b
2018-03-09 11:09:51 -08:00
Bookatz
058d869826 Statsd BroadcastSubscribers can receive 'cookies'
Subscribers can now provide additional Strings that will be passed back to
it when an anomaly is detected. This way, the Subscriber can be informed
about anomaly-specific information has meaning to it.
Statsd itself does not use these strings and doesn't care what they are
- it simply passes them back to the subscriber.

Change-Id: If269872397c4ed2c67e41d54d850cdc664d4f73e
Fixes: 74012329
Test: run cts-dev -m CtsStatsdHostTestCases -t android.cts.statsd.alert.BroadcastSubscriberTests
2018-03-09 10:44:48 -08:00
TreeHugger Robot
3ce208c1e9 Merge "Add team members in OWNER file" into pi-dev 2018-03-09 07:37:43 +00:00
yro
66781e1bf5 Add team members in OWNER file
Bug: 74415902

Test: no test necessary
Change-Id: I39d0a5cb9c6e8520fd29881442e66961096d52fc
2018-03-09 07:37:36 +00:00
TreeHugger Robot
7ad26e4bad Merge "Fix statsd crash due to bad bucket index" into pi-dev 2018-03-09 03:23:17 +00:00
TreeHugger Robot
ec66e9e726 Merge "Write data to file when StatsCompanionSerivice (system_server) crashes" into pi-dev 2018-03-09 01:18:27 +00:00
Yao Chen
b19425e011 Remove unused shared lib from statsd
Test: build statsd, and statsd_test

Bug: 72129300
Change-Id: I0ebff977dabe796799a0d41c64adb2c2f2e9035e
2018-03-08 14:38:12 -08:00
Bookatz
2fb5653b97 Fix statsd crash due to bad bucket index
Statsd crashes because predictAnomalyTimestamp requests past buckets
that occurred before time began. That's fine, but statsd needs to know
that the data before time began was 0 (instead of reading before the
beginning of the array and crashing).

AnomalyTracker's use of bucketNumbers is in general risky, and should be
auditted. But this cl will fix the current crashing.

Bug: 73825954
Test: Definitely necessary. Will write during audit.
Change-Id: I990ff134153f290d3089bfe3440d838f47996b63
2018-03-08 13:34:16 -08:00
Chenjie Yu
e05c8e7776 Remove kPullerCooldownMap from code
remove dead code

Bug: 74032852
Test: manual test
Change-Id: I0da74be21bab5842a89ede2a272094ba5ee33d80
2018-03-08 12:43:58 -08:00
yro
1cf2ac5241 Write data to file when StatsCompanionSerivice (system_server) crashes
Bug: 73352867
Change-Id: Iecbb1ae3e29264975771155a878b368cfc2f50f0
Test: statsd_test
2018-03-07 17:59:13 -08:00
Yangster
13fb7e4eea Statsd cpu optimizaton
- cache the changed dimensions in condition tracker.
- avoid query condition wizard when unnecessary.
- avoid copy dimension keys in condition key generation.

Test: statsd tests.

BUG: b/73959649
Change-Id: I17d68e2a82643de3f421309841e75f84c6fd8f43
2018-03-07 17:36:07 -08:00
Chenjie Yu
c8a6305ddf Merge "Refactor cpu stats pullers" into pi-dev 2018-03-08 00:24:00 +00:00
Chenjie Yu
ec67661bdf Refactor cpu stats pullers
use same cpu stats readers with BatteryStats so that
1) both throttle to avoid too frequent pulls
2) cached value is served within throttle interval to avoid double
pulling by both statsd and BatteryStats

To run unit tests:
bit
FrameworksCoreTests:com.android.internal.os.KernelUidCpuFreqTimeReaderTest
bit
FrameworksCoreTests:com.android.internal.os.KernelUidCpuClusterTimeReaderTest
bit
FrameworksCoreTests:com.android.internal.os.KernelUidCpuActiveTimeReaderTest

make -j56 statsd_test && adb sync data && adb shell
/data/nativetest64/statsd_test/statsd_test

Test: cts test, unit test
Bug: 73745189
Bug: 73780619
Bug: 73360959

Merged-In: I10a9bc91ca67fa812f4cd71c4fbd73c1a5ba580e

Change-Id: I10a9bc91ca67fa812f4cd71c4fbd73c1a5ba580e
2018-03-07 21:43:00 +00:00
Anton Hansson
d137c872cd frameworks/base: Set LOCAL_SDK_VERSION where possible.
This change sets LOCAL_SDK_VERSION for all packages where
this is possible without breaking the build, and
LOCAL_PRIVATE_PLATFORM_APIS := true otherwise.

Setting one of these two will be made required soon, and this
is a change in preparation for that. Not setting LOCAL_SDK_VERSION
makes the app implicitly depend on the bootclasspath, which is
often not required. This change effectively makes depending on
private apis opt-in rather than opt-out.

Test: make relevant packages
Bug: 73535841
Exempt-From-Owner-Approval: Global cleanup
Change-Id: I26458e41ecb84de91ac9a356a5d4bafb44f463c1
2018-03-07 11:42:04 +00:00
TreeHugger Robot
f9500e9c01 Merge "Atom: ResourceConfigurationChanged" into pi-dev 2018-03-07 00:41:35 +00:00
Tej Singh
a883b37fc0 Atom: ResourceConfigurationChanged
Logs when the configuration changes, such as when the screen orientation
changes. Logs information including font scale, screen width/height,
screen orientation, color mode.

Test: verified atom appears in adb logcat -b stats when screen
orientation changes.

Change-Id: Ifc3f3c62c5e386960b77d78f2ff2f17fc27db2b8
(cherry picked from commit 8a6df9290f82ee195ecc05df340035a82dc34a40)
2018-03-06 17:49:39 +00:00
Yi Jin
5ee0787024 Use uint64_t instead of long long as API type for consistent reason.
Bug: 74118023
Test: manual
Change-Id: Icd5f506c76d3a008a79cb6c9d2061962ca7fdd40
2018-03-05 18:18:27 -08:00
TreeHugger Robot
076eebfb3d Merge "Add #alerts to StatsdStats printout" 2018-03-05 05:43:44 +00:00
TreeHugger Robot
b603fb06ba Merge "Add API to let metrics directly drop data without writing to an output." 2018-03-02 23:38:21 +00:00
TreeHugger Robot
644e15d5bd Merge "Reduce statsd binary size from 730KB-> 664KB" 2018-03-02 19:41:56 +00:00
TreeHugger Robot
a793e50849 Merge "Add the MetricDimensionKey to the log when anomaly happens." 2018-03-02 19:12:18 +00:00
Bookatz
aea8d10b1e Add #alerts to StatsdStats printout
When print-stats is called, now #alert=0 won't always be 0.

Change-Id: If618c9a0890b45f7211f05853f4d97332d7f4cf1
Fixes: 73493830
Test: Manual confirmation
2018-03-02 10:37:24 -08:00
TreeHugger Robot
cbecb1a006 Merge "Add StateTracker." 2018-03-02 17:54:08 +00:00