History log of /frameworks/base/cmds/statsd/src/metrics/duration_helper/MaxDurationTracker.h
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
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/metrics/duration_helper/MaxDurationTracker.h
d9afdee26f01d1e0277749959094d9f396799a69 27-Mar-2018 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Support sliced condition change in GaugeMetric" into pi-dev
427d372552490a2c5ac4041fe345b15f69451f57 22-Mar-2018 Yao Chen <yaochen@google.com> Support sliced condition change in GaugeMetric

TODO: We need CTS to verify the behavior.

Bug: 73958484
Test: statsd_test
Change-Id: I56406983ddede12bc6a2e12188693a0c51ccae5c
/frameworks/base/cmds/statsd/src/metrics/duration_helper/MaxDurationTracker.h
be10ddfe46ba6371bcd02cb57a06782e6b18d371 13-Mar-2018 Yangster-mac <yanglu@google.com> Flush the past buckets in anomaly tracker when time jumps forward

E2e test for count/duration anomaly trackers.

Test: new statsd tests.

BUG: b/74446029

Change-Id: Ia9be0240ba5021d44c1e1f096d67563e9138bb59
/frameworks/base/cmds/statsd/src/metrics/duration_helper/MaxDurationTracker.h
13fb7e4eeaf7aee408821afe7ee55a5167e49e59 08-Mar-2018 Yangster <yanglu@google.com> 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
/frameworks/base/cmds/statsd/src/metrics/duration_helper/MaxDurationTracker.h
2e414b99f44f00000d84765b3a095490415695af 13-Feb-2018 David Chen <dwchen@google.com> 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
/frameworks/base/cmds/statsd/src/metrics/duration_helper/MaxDurationTracker.h
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/metrics/duration_helper/MaxDurationTracker.h
27785a8a4a684c831c18f7189a6fa1b98c3573e6 20-Jan-2018 David Chen <dwchen@google.com> Partial buckets on app upgrade and fix duration.

Statsd will create partial buckets in all metrics producers when an
app is upgraded so that we can separate metrics between different
versions of an app. By looking at the uid map changes, we can tell
which app versions belong to a bucket; for metrics that are not
affected by an app version, we can instead join the buckets together.

To simplify the logic, the ends of the full buckets are always
aligned to when the metric producers were created. These boundaries
are computed on the fly by using the bucket number and the metric
producers' start times.

We keep the anomaly trackers to only be given full buckets; we buffer
the partial buckets within each metric producer.

Duration metric's MAX_SPARSE is fixed to be implemented as such. In
addition, after further discussion, we find anomaly detection on
MAX_SPARSE to be unnecessary, so this functionality is removed.

Test: Unit-tests added and modified, passed on marlin-eng.
Change-Id: I5ff7a9c7f05c406e9faf400c6a39162970ded102
/frameworks/base/cmds/statsd/src/metrics/duration_helper/MaxDurationTracker.h
9369446f0b04945d6674550728ae81196d6fb5c2 23-Jan-2018 Yangster-mac <yanglu@google.com> Support dimension in condition in metric producers.

Test: added e2e tests for count/duration metrics sliced by fields in condition and with/without links.

Change-Id: Ie34deba68e6780abdde458be3f0ce5284e76a1a2
/frameworks/base/cmds/statsd/src/metrics/duration_helper/MaxDurationTracker.h
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/metrics/duration_helper/MaxDurationTracker.h
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/metrics/duration_helper/MaxDurationTracker.h
d59a6589faeb8a1b7b3c23e5ac95671bda736cdd 08-Jan-2018 Yao Chen <yaochen@google.com> Some fixes in duration metrics

+ Don't need to keep the condition key if the condition is not sliced.
+ Whiten the hash before returning.

Test: statsd_test
Change-Id: Ie0bcb14b3adc4a15b79ba3be050431a672a68c28
/frameworks/base/cmds/statsd/src/metrics/duration_helper/MaxDurationTracker.h
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/metrics/duration_helper/MaxDurationTracker.h
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/metrics/duration_helper/MaxDurationTracker.h
f60e0bad5908c51c954ca8dc763c8efd394c56dc 30-Nov-2017 Yao Chen <yaochen@google.com> Fix how DurationTracker passes results to DurationMetricProducer

This allows us to safely delete old buckets after onDumpReport is called.

Test: statsd_test

Change-Id: If8e28a184dcaf491bcd9a62d0d61beabca5a91a5
/frameworks/base/cmds/statsd/src/metrics/duration_helper/MaxDurationTracker.h
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/metrics/duration_helper/MaxDurationTracker.h
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/metrics/duration_helper/MaxDurationTracker.h
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/metrics/duration_helper/MaxDurationTracker.h
0ea19901ef78de19437c08bbcbb7af6663ad6f4b 16-Nov-2017 Yao Chen <yaochen@google.com> One more feature in DurationMetric -- nesting on top of Or and Max

+ Added counters to count the starts.

Test: added some unit test in statsd_test.

TODO: ADD MORE UNIT TESTS

Change-Id: I3575e921a4abab27c4ea50fffde19cc1d4564030
/frameworks/base/cmds/statsd/src/metrics/duration_helper/MaxDurationTracker.h
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/metrics/duration_helper/MaxDurationTracker.h
2b0f88678b2877a8e9f83cea60f097322b078367 06-Nov-2017 yro <yro@google.com> Migrate all remaining MetricProducers to use ProtoOutputStream

Test: statsd, statsd_test
Change-Id: I1087e1c1ffb372ca288dfc575cb7a372b11ce8c5
/frameworks/base/cmds/statsd/src/metrics/duration_helper/MaxDurationTracker.h
5154a379303ab90a2b2914676a4441917a329b5d 31-Oct-2017 Yao Chen <yaochen@google.com> Adding multi layer aggregation in DurationMetric

Newly supported metrics examples:

1) Compute [Total|Max] duration of [an app] holding [ANY] wake lock while [this app] is in
[background] and [screen off], bucket size 30seconds, and slice output by uid.

2) Compute [Total|Max] duration of [ANY app] holding [ANY] wake lock while [this app] is in
[background] and [screen off], bucket size 30 seconds.

+ DurationMetric proto has a "what" which is a SimpleCondition. It defines the atom level start
and stop of the duration timer, and it has its atom dimension. e.g., for wake locks, the atom
dimensions wil be uid and wl name.

+ Now dimension is explicitly specified in SimpleCondition proto instead of inferred from the "link"

+ Added support for "Or" and "Max" through 2 layers of aggregation.

TODO: (1) The way we track slicedCondition in duration metric is not efficient. optimize!
(2) The output dimension should all use int32 instead of KeyMatcher. Fix in a future cl.

Test: Added some unit tests using gmock. Will add more unit tests.

Change-Id: I58a827624f01f9a54fcb80709c4de4ff94a8bc67
/frameworks/base/cmds/statsd/src/metrics/duration_helper/MaxDurationTracker.h