History log of /frameworks/base/cmds/statsd/src/metrics/GaugeMetricProducer.h
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
50b0c9a6082417034514d68a079248ce09957027 11-May-2018 Yangster-mac <yanglu@google.com> Guardrail the max gauge atoms per dimension in one bucket.

Test: statsd
BUG: b/78603347
Change-Id: Ide77cc8ff0cde6cf6cc9e56034727ed27dd7be88
/frameworks/base/cmds/statsd/src/metrics/GaugeMetricProducer.h
b85e5616dfa153eea1e61e99427164c5102dbbd3 02-May-2018 android-build-team Robot <android-build-team-robot@google.com> Merge "Reduce statsd log data size." 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/metrics/GaugeMetricProducer.h
a802d73da625ac72f6a0211aab017f365139112d 24-Apr-2018 Yangster-mac <yanglu@google.com> Clear the past buckets for no-report metrics

Test: statsd tests.
BUG: b/78503732
Change-Id: I3de855929ad05677769cffaae4fea2db0d2f32da
/frameworks/base/cmds/statsd/src/metrics/GaugeMetricProducer.h
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/metrics/GaugeMetricProducer.h
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/metrics/GaugeMetricProducer.h
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/metrics/GaugeMetricProducer.h
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/GaugeMetricProducer.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/GaugeMetricProducer.h
c58750578fdf6e54500e9deabe7d5062afbd6e09 09-Mar-2018 Chenjie Yu <cjyu@google.com> Up the dimension key limit for CpuTimePerUidFreq

This atom logs time spent on cpu per frequency per uid.
On marlin, there are 27 frequency steps per uid (should be 50+ if
flatten to both cores)
On walleye, there are 52 frequency steps per uid.
So it easily goes to 6k data.

Soft limit set to 6k now.
Hard limit set to 10k to accommodate future processors

Memory impact: on marlin, start memory no config is 2,346K
after using this atom in one guage metric, it is 3,067K

Bug: 72505991
Test: cts test
Change-Id: I067a32e54e4a457fdf9a25911aa16030e893ef4d
/frameworks/base/cmds/statsd/src/metrics/GaugeMetricProducer.h
aaadf6663fdc8787947d67bc14841d20094bd072 14-Mar-2018 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Statsd: Remove storage of bucketNum" into pi-dev
a78d00874d4e274937734a1b73aef4b6389eb3cd 12-Mar-2018 Yangster-mac <yanglu@google.com> Dump the stats for count/gauge/value metrics.

Bug: b/74159560

Test: statsd test
Change-Id: I1410309ecfdfc2a5becf8d0c620c68a621ebc5fa
/frameworks/base/cmds/statsd/src/metrics/GaugeMetricProducer.h
3f5ab3ff1d66e53c26e3a5951dc0804bca5467a8 13-Mar-2018 Bookatz <bookatz@google.com> 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
/frameworks/base/cmds/statsd/src/metrics/GaugeMetricProducer.h
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/metrics/GaugeMetricProducer.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/GaugeMetricProducer.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/GaugeMetricProducer.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/GaugeMetricProducer.h
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/metrics/GaugeMetricProducer.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/GaugeMetricProducer.h
a070b6a40c95df5b64d195aba1386815fec5d5b7 04-Jan-2018 Yangster-mac <yanglu@google.com> Bug fix: gauge metric producer does not need the atom id parameter.

Test: statsd unit test passed
Change-Id: Ifd1e2f7a05a03886eb227ac1ae0e30b884e49f0c
/frameworks/base/cmds/statsd/src/metrics/GaugeMetricProducer.h
b814481ad1f8d0e429d799b1571a6272e1a7f6c5 04-Jan-2018 Yangster-mac <yanglu@google.com> Use TimeUnit enum to specify the bucket size.

Test: all statsd unit test passed

Change-Id: I4f6b80ba2f8c984b06e46e6de6df3e546e99a968
/frameworks/base/cmds/statsd/src/metrics/GaugeMetricProducer.h
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/metrics/GaugeMetricProducer.h
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/metrics/GaugeMetricProducer.h
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/metrics/GaugeMetricProducer.h
f09569f848ca0b81a21a74e9f4dd8bd9a886151a 14-Dec-2017 Yao Chen <yaochen@google.com> Further reduce statsd memory usage.

+ Remove the protobuf *Metric object from MetricProducers
-- This saves ~150 bytes per metric.
+ Remove the StatsdConfig from ConfigManager
-- This saves us xKB per config.
+ Also remove alerts from fake config to avoid crash (Bug: 70627390)
+ Other misc fixes too.

Test: statsd_test & manual
Change-Id: Ied4eb3fa31c50599817b3a5e1caf5077c487fad2
/frameworks/base/cmds/statsd/src/metrics/GaugeMetricProducer.h
a7259abde4e89fd91404b14b4845113cd313d1ec 10-Dec-2017 Chenjie Yu <cjyu@google.com> use running sum for ValueMetricProducer bucket
simplify ValueMetricProducer logic for pulled data

Test: unit test
Change-Id: Ic0a21a543166cc5c34c1fa505dba08d1fc2f510a
/frameworks/base/cmds/statsd/src/metrics/GaugeMetricProducer.h
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/metrics/GaugeMetricProducer.h
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/metrics/GaugeMetricProducer.h
f2bee6fec965fd42ab223f1a3aa705f07ba79aea 29-Nov-2017 Yangster <yanglu@google.com> 1/ Only expose thread-safe interfaces in metric producer.
2/ Simplify lock logic.
3/ Add test for duration metric producer.

Test: all unit test passsed.
Change-Id: If6ee2e69a17f12406f4b3ea3553b14642cd636d6
/frameworks/base/cmds/statsd/src/metrics/GaugeMetricProducer.h
6a8c799d901cbd166aa6463d7dea231bcf594a1e 29-Nov-2017 Yao Chen <yaochen@google.com> Revert "Thread-safe metric producers."

This reverts commit 8de6939c494da838f6dbbda0631f66425dbbd25b.

Change-Id: Ieae841bfc5339b569f0fca909a6066de72806617
/frameworks/base/cmds/statsd/src/metrics/GaugeMetricProducer.h
8de6939c494da838f6dbbda0631f66425dbbd25b 27-Nov-2017 Yangster <yanglu@google.com> Thread-safe metric producers.

Test: unit test passed
Change-Id: Ie47404e8649b63ee8ac32e40189a47f6cb7a9def
/frameworks/base/cmds/statsd/src/metrics/GaugeMetricProducer.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/GaugeMetricProducer.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/GaugeMetricProducer.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/GaugeMetricProducer.h
6736c893a73c567d3794d88ae0d17abab34b7a6f 09-Nov-2017 Chenjie Yu <cjyu@google.com> Unit tests for ValueMetricProducer
StatsPullerManager is refactored so that we can mock it.
It may need more refactor pass to make is safer for longer runs.

Test: unit test
Change-Id: Ief0c99710e4d06e1454678f8b749c9599467d114
/frameworks/base/cmds/statsd/src/metrics/GaugeMetricProducer.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/GaugeMetricProducer.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/GaugeMetricProducer.h
1d4d686001b220e114df737154f143ffabc212f1 31-Oct-2017 Yangster <yanglu@google.com> Gauge metric producer.

Test: manual tests passed for pushed device temperature.
Change-Id: I7592a4c04666606b745cdb41db8f9d8a96a966da
/frameworks/base/cmds/statsd/src/metrics/GaugeMetricProducer.h