816 Commits

Author SHA1 Message Date
Zhi An Ng
c9b2722cb8 Merge "Revert "Revert "Log the apk optimization state in the MetricsLogger""" 2018-02-23 21:15:32 +00:00
Yangster-mac
16b7ff735e Use android reinterpret hash for float as it is faster.
Test: statsd test
Change-Id: I593edac1d7dcd0c5e84195602b42b7c6c3072a38
2018-02-23 11:11:36 -08:00
TreeHugger Robot
193fe201da Merge "Statsd alerts can inform subscribers probabilistically" 2018-02-23 18:50:16 +00:00
Calin Juravle
759fbda51b Revert "Revert "Log the apk optimization state in the MetricsLogger""
This reverts commit 203a9ab7665787c94f7d0711a1ad172588070aa6.

Reason for revert: Fix the original issue. There was a race with the
cleanup method which was resetting the app record to null.

Test: manual, adb logcat -b events | grep sysui_multi_action
      repeat steps from bugreport reporting the crash
Bug: 73102540

Change-Id: I6d9c6110a9d5dadeb9d4361592711d63563c958a
2018-02-22 16:53:48 -08:00
TreeHugger Robot
868688ed16 Merge "Add annotation to atoms that represent a state change in atoms.proto" 2018-02-22 05:36:45 +00:00
TreeHugger Robot
f9f44c954b Merge "Statsd anomaly output log fix" 2018-02-22 03:13:04 +00:00
Yao Chen
9c1debe330 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
2018-02-21 16:46:56 -08:00
Bookatz
32f2d4f320 Statsd anomaly output log fix
Alert.id() is signed, so the output line needs to be lld instead of llu.

Test: none
Change-Id: I7e3eeddac60931234285548b99a9c9cc78582716
2018-02-21 14:30:51 -08:00
Yangster
e1faa03b48 Fix the bug of timestamp encoding in event metric report.
Test: statsd cts tests
Change-Id: Id1d330f5d48d15ba026ae7c7e8cf4e1f6b460fba
2018-02-21 14:08:17 -08:00
Howard Ro
32bdf16288 Merge "Remove relevant configs when a uid (app) is uninstalled" 2018-02-21 21:12:41 +00:00
yro
019240235f Remove relevant configs when a uid (app) is uninstalled
Bug: 72267831
Test: statsd_test
Change-Id: I6ed29baba39b83f771629131af66b39ccc9cc130
2018-02-20 18:20:49 -08:00
TreeHugger Robot
3d7f2d40d4 Merge "Adds anomaly detection to max duration metrics." 2018-02-20 23:38:00 +00:00
TreeHugger Robot
81198c7332 Merge "Fix bug in edge case for statsd anomaly tracking." 2018-02-20 22:56:02 +00:00
David Chen
2e414b99f4 Adds anomaly detection to max duration metrics.
Statsd supports anomaly detection for max duration, which is
conceptually like asking for an anomaly on the current duration.
There was a bug previously in the logic for max duration since we
recorded a duration every time a dimension went into pause. Now, we
only record a max duration when the dimension goes into stop.

When a dimension inside the MaxDurationTracker leaves the started
state, we need to check if we still need to keep an anomaly alarm
set. It's possible that we just immediately set an alarm with the
same timestamp as what was just deleted.

Test: Added some unit-tests and tested on marlin-eng.
Change-Id: I09c82cd266b4cc6e1c893ad166e602bf08baca0e
2018-02-20 13:45:25 -08:00
David Chen
ebe7e237a6 Fix bug in edge case for statsd anomaly tracking.
Getting a past bucket value will always crash for anomalies
configured to track only the most recent one bucket.

Test: N/A
Change-Id: I2cd1c82fe8ba4cecb4fac21038bb5f04a60c360e
2018-02-20 13:22:53 -08:00
TreeHugger Robot
581ff5ec0d Merge "Timestamp Truncating whitelist." 2018-02-20 20:41:29 +00:00
Narayan Kamath
28ff9ceeeb Merge "Revert "Log the apk optimization state in the MetricsLogger"" 2018-02-20 18:17:34 +00:00
Narayan Kamath
203a9ab766 Revert "Log the apk optimization state in the MetricsLogger"
This reverts commit 0a8bea818c330d02161322901534992253a2f9ee.


E AndroidRuntime: *** FATAL EXCEPTION IN SYSTEM PROCESS: ActivityManager
E AndroidRuntime: java.lang.NullPointerException: Attempt to read from field 'java.lang.String com.android.server.am.ProcessRecord.requiredAbi' on a null object reference
E AndroidRuntime:        at com.android.server.am.ActivityMetricsLogger.logAppTransition(ActivityMetricsLogger.java:504)
E AndroidRuntime:        at com.android.server.am.ActivityMetricsLogger.access$100(ActivityMetricsLogger.java:62)

Bug: 73626352
Change-Id: Idd50e0d2cf34e5393b4ae76ef8bc48b0067532eb
2018-02-20 17:06:21 +00:00
Calin Juravle
6e24ac8948 Merge "Log the apk optimization state in the MetricsLogger" 2018-02-19 19:36:08 +00:00
Chenjie Yu
ae9fdf0403 fix picture-in-picture logging
+ log uid and activity name

Test: manual test. Will add cts test
Change-Id: I3d3e77b24779e439eacc06007fae62c037a19fd6
2018-02-18 00:08:01 -08:00
Yangster-mac
d5c356214f Timestamp Truncating whitelist.
Test: manually tested.
Change-Id: I46da375b6c0773ffc611bc06fff12cb4f9a7fc18
2018-02-17 21:11:54 -08:00
Bookatz
12c1270f8b Statsd alerts can inform subscribers probabilistically
The config can specify that when an alarm fires the relevant
subscriber is only informed with some probability. This allows
only a fraction of firings to trigger the subscriber's action.

Bug: 73287237
Test: none yet

Change-Id: I365faad8ffd1b40b01782c1d761b1c0e09c7c299
2018-02-17 18:58:25 -08:00
Calin Juravle
0a8bea818c Log the apk optimization state in the MetricsLogger
Log the apk optimization state for app transition events. This will allow
precise measurement of the events based on the level of optimizations
performed.

Test: manual, adb logcat -b events | grep sysui_multi_action
Bug: 73102540
Change-Id: Ia8ccddff4ebe4120e05bb5d1dfb1cd458fa61e8a
2018-02-16 15:46:14 -08:00
Rajeev Kumar
334899b0d8 Merge "Implement atom puller for ProcessMemoryState." 2018-02-16 21:52:22 +00:00
TreeHugger Robot
0f888de06b Merge "Resupport long compare" 2018-02-16 17:31:42 +00:00
TreeHugger Robot
3b9999edca Merge "Adds locks to ConfigManager in statsd." 2018-02-16 17:30:43 +00:00
TreeHugger Robot
a9e43fa9b7 Merge "Remove a statsd duration anomaly sanity check." 2018-02-16 17:28:32 +00:00
Bookatz
bcc71c55c7 Resupport long compare
In ag/3554499 we made it so that comparisons of longs was supported.
That support was apparantly deleted by accident during a refactoring of
code, so this adds it back.

Bug: 73509837
Test: it gets used in run cts-dev -m CtsStatsdHostTestCases -t android.cts.statsd.alert.AnomalyDetectionTests#testCountAnomalyDetection
Change-Id: I3dbe7da61bbfb3e9982fd1e0cc7d4658b0168690
2018-02-15 18:45:00 -08:00
Rajeev Kumar
22d92b76bc Implement atom puller for ProcessMemoryState.
We would like to gather memory metrics of the processes when LMKD kills
a process. By gathering this info we would be able to analyze and improve
system health by potentially reducing memory footprint of the processes
contributing to the memory pressure on the device.

This feature would be available on production builds.

Perf analysis:
On an average getMemoryStateForProcesses method call takes
0.59 milli seconds per process.

To know more about this see: http://go/android-p-memory-metrics

Bug: 72177881
Test: Tested manually
Change-Id: Ice94c2d937a5c84bc205981d99588a30f686ff9b
2018-02-15 13:43:55 -08:00
TreeHugger Robot
15d8102111 Merge "Add owners file for statsd/incidentd" 2018-02-15 20:32:24 +00:00
David Chen
fdc123b685 Adds locks to ConfigManager in statsd.
The ConfigManager can be triggered by Binder threads, so we should
lock any reads or writes to the config managers. We don't need to
lock within StatsService, so those methods simply call the methods
in ConfigManager.

Test: Test that statsd builds and unit tests pass.
Change-Id: I96904c4140a95dc60a419281c8c54f606a443fbc
2018-02-15 11:31:15 -08:00
TreeHugger Robot
7d5beeb255 Merge "More formatting fixes for statsd" 2018-02-15 19:26:32 +00:00
TreeHugger Robot
f31667f412 Merge "Statsd guardrail for Alerts" 2018-02-15 17:15:41 +00:00
David Chen
b639d14f1a More formatting fixes for statsd
Test: N/A
Change-Id: I378cde8700655bfba26b112ae6df1b4347683bdb
2018-02-14 17:45:45 -08:00
David Chen
00621d212e Remove a statsd duration anomaly sanity check.
The logic previously assumed that each bucket can only contain a
duration up to the bucket size, but this is not true for the max
sparse aggregation type. Instead of trying to keep this logic up to
date on the client, we will remove this check.

Test: Test that statsd still builds and unit-tests pass.
Change-Id: I576d75f8697b4e691b864f12ccaa6fa4611336c5
2018-02-14 17:30:38 -08:00
Howard Ro
db15052ae2 Merge "Add a guardrail to limit minimum bucket duration to be 5 minutes except when configured through adb command" 2018-02-15 00:18:22 +00:00
Yi Jin
4bad04eda4 Add owners file for statsd/incidentd
Test: N/A
Change-Id: I5536a239e0fefbc05a0db3b88de6d4a6ccddfdee
2018-02-14 15:47:39 -08:00
Bookatz
1476ef24f3 Statsd guardrail for Alerts
Now, each config is allowed at most 100 Alerts in it.
That is, for each uid, for each config id, the config's alert section
can have at most 100 items in it.

Bug: 73287046
Test: none yet
Change-Id: I2c81bc647627e432337c359c0a76aa3fc08bdd23
2018-02-14 13:56:25 -08:00
TreeHugger Robot
6189807c12 Merge "Remove unused variables in statsd, and make more warnings show." 2018-02-14 20:12:18 +00:00
TreeHugger Robot
2f5b9c9b03 Merge "Updates statsd atoms.proto with small changes." 2018-02-14 19:18:39 +00:00
TreeHugger Robot
98eafdb111 Merge "Use elapsed realtime instead of times based on wall clock, which can jump around and go backwards." 2018-02-14 17:17:07 +00:00
TreeHugger Robot
d8be2394d3 Merge "Fix a bug of not deleting previously added config files on disk" 2018-02-14 08:00:10 +00:00
Yangster-mac
330af58f2b 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
2018-02-13 23:30:39 -08:00
yro
f4ae56b87b Fix a bug of not deleting previously added config files on disk
Bug: 73304022
Test: statsd_test
Change-Id: Ic024d40da97ed79cb405a5da1f0c9abac0436b34
2018-02-13 22:07:43 -08:00
yro
59cc24dbfd Add a guardrail to limit minimum bucket duration to be 5 minutes except
when configured through adb command

Bug: 73287251
Test: statsd_test
Change-Id: Iee51fedbaabb2c1f534a6edef3c564da88ef658b
2018-02-13 20:26:31 -08:00
TreeHugger Robot
736d690a45 Merge "Statsd_test update for rounding up alarms" 2018-02-14 01:36:08 +00:00
David Chen
0b5c90cd8c Updates statsd atoms.proto with small changes.
Renames the apphook atom to be more descriptive. Renames time
suffixes to match more clear convention (ms and msec are ambiguous).

Adds a field to CPU active time that's required for the metrics
to be usable.

Test: Test that statsd can still build.
Change-Id: I94866510738db994e8d757260f30e599ba995dbd
2018-02-13 16:17:25 -08:00
Bookatz
14e0d854d7 Statsd_test update for rounding up alarms
In ag/3580546 we now round up when setting anomaly alarms. This means
the test needs to be updated by 1s in one place.

Test: make statsd_test && adb sync data && adb shell data/nativetest64/statsd_test/statsd_test
Change-Id: Ibd3548833dcc2c1b9ca3a1da2c183bb771799775
2018-02-13 15:55:14 -08:00
Yao Chen
4c959cb99e Remove unused variables in statsd, and make more warnings show.
Test: statsd_test

Change-Id: I2c7b674cb615f22c5de90c2de5f2d58108ab2e7f
2018-02-13 15:31:22 -08:00
Yao Chen
ab92a1fdcc Fix a bug in LogEvent.GetLong
Test: statsd_test

Bug: 73303815
Change-Id: I375083e7a9e447b385608b4ab64dc45981aa1193
2018-02-13 15:17:55 -08:00