Add logging to record whenever the 10 second guardrail for sending
active configs changed broadcast is met, so that we know when the
broadcast would not have been sent.
Add activation time for configs that are active when the device boots.
This will help determine whether or not statsd thinks configs are active
and will help debug issues like b/133809948
Bug: 133809948
Test: bit statsd_test:*
Test: manually rebooted to make sure activation time was logged
Change-Id: Ifa72202bc52485e4953e49d78dffea685cc3d1e7
Previously,we could only have one deactivation matcher for a given
metric. This meant that the same matcher could not be used to cancel
several (or all) event activations of a metric. This fixes that bug.
Test: bit statsd_test:*
Bug: 134185513
Change-Id: I9d74878c9e09bd1f58c8f3dcffe1092edf490329
A condition was reversed in code refactoring during previous code review.
Test: unit tests added for all 4 combination cases.
Bug: 134417583
Change-Id: Id79a827ec7a5404b9006769f9595de773b4724ef
Treat metric activation like conditions as much as possible. Keep track
of condition changes even when metric is not active. Right now, we
ignore all condition changes if metric is not active.
This is a band-aid fix. Ideally, we should re-think how metric activation is
implemented and consider implementing it as a condition with a timebomb.
Bug: 130838341
Test: statsd_test
Test: cts-tradefed run cts-dev -m CtsStatsdHostTestCases -t
android.cts.statsd.metric
Change-Id: I96bb7a7c6ee88359f310065e166f858be945eaff
Previously, all metrics/configs would deactivate on system server death.
Now, active status is restored.
Bug: 129717537
Test: bit statsd_test:*
Test: libprotoutil_test:ProtoOutputStream*
Change-Id: Idf372457f60a931a2d00176a5eab58c534a25e41
In Q, mainline modules will can add atoms after the platform ships.
Statsdstats now supports atom counts of up to 100 atoms that are added
after Q ships. Note: pixel/oem pushed atoms will also get counted now.
Also fixes a typo in prepareFirstBucket
Bug: 131448746
Bug: 128363379
Test: statsd_test
Change-Id: I149c91136fb7649f0c9a0d6e83bc20f8461e45e2
This allows setting one metric with both IMMEDIATE and ACTIVATE_ON_BOOT
EventActivations
Also, if an on-boot Activation that is already active gets another
activation signal, ignore it.
Bug: 128880263
Fixes: 128880263
Test: statsd_test
Change-Id: I8d483882836c9abc184230b4a70d4734d49d93c3
Statsd is pulling data when the metric is not active. This cl causes
statsd to skip data pulls when the metric is not active
Test: unit tests
Test: cts
Bug: 129910938
Change-Id: Ibc9459f38c2f6128b8a1f10c6dea683bfe07b22a
condition_true_nanos is only written to proto when there is a condition.
Bug: 130831927
Test: statsd_test
Change-Id: I059ca478879567757658bce51d6a751f844a33f6
Usually after config owner calls statsd to get data, statsd will remove that data
forever. This cl adds an option to save historical data locally so that when a bugreport
is taken, it contains historical statsd metrics for debugging.
+ All existing guardrail on storage still apply, and local history data has lower
priority when the guardrail is hit. On top of that, statsd will remove history
files that are more than 2 days old.
+ Also fixed issues inside StorageManager (e.g.,
using string::compare to sort by timestamp is problematic, redundant file size read, etc)
Test: statsd_test and manually
Fix: 126562025
Change-Id: I5238b9fd3069cbef5bcccabd2212bc4d6c734702
+ Plug it in ValueMetric as the frist step as we often need to normalize the values
by the duration of condition being true.
E.g., Coulomb counter drop / screen_on_and_on_battery_time
Having a simple timer inside the metric will eliminate the need of creating
another duration metric and joining them on server side.
Test: statsd_test
Fix: 130048020
Change-Id: Ie377dc6de917176ab07843e0dfd8506ed1d5db75
+ Create a thread-safe LogEventQueue to buffer log events.
+ The socket listner thread will read from socket and write to the buffer as quickly as possible
to minimize the data loss in socket.
+ All pushed data is fetched from the the buffer and processed in a dedicated thread. After an
event is fetched from the queue, we no longer block the socket listener thread.
+ Report event queue stats via statsdstats, including the min and max queue event history span in
the queue (to understand how slow statsd can be and how fast the events can be)
Bug: 119031518
Test: unit tests added in statsd_test
Change-Id: I6b65ed9a678935b2e24302ba4b36e69c157adde4
Change the file format to store the
experiment IDs direclty so we don't
need to parse the proto when reading
the values out.
Bug: 129099771
Test: bit statsd_test:* && adb shell cmd stats pull-source 10051
Change-Id: I0dc1fd118f4d9ba597c2f0959648136bbafb5aab
- Use no_time_contraints to pull the data in PartialBucket_e2e_test.
Fast means there is no time to complete the current bucket
- One test had to be updated since the condition was unknown so the
bucket was not valid
Test: atest statsd_test
Change-Id: Id22539b801b29ed6b384045979e7c3cc6e3fe8b6
If the bucket is not reset, we will sum the data from the previous
bucket and the next bucket.
As well, the value should only be added to the full bucket if the value
is set.
Bug: 128521677
Test: atest statsd_test
Change-Id: I45bf924a5d2966044cecda34fff84b7cbfe070b0
Add trainName string field to TrainInfo atom
Add status enum to TrainInfo atom
Add additional states to BinaryPushStateChanged.State
Bug: 124397500
Bug: 126787525
Bug: 126780868
Test: add/edit tests in StorageManagerTest to verify new
serialization/deserialization logic
Change-Id: I7bf4cd3b3cb4fdb8b1ebe51a602cfde9fdace6e1
This can be used for sending a broadcast to an app which incidentd
would share the incident report with.
Test: added unit test in statsd_test
Change-Id: Ieaf5b3b4d67168e2a99ff54e6392c77d8372ed4e
For diffs, we need a global base at the beginning of the bucket. If we
do not have a global base, it means the bucket will contain incomplete
data.
Test: atest statsd_test
Change-Id: Ifea7ce09e31d7c5c44b1820b528dfda492dd0dc9
- For pulled metrics, buckets should only be flushed when we did a pull.
Without a pull, we will have incomplete data.
- Flush buckets at the end of each incoming event (on data pull,
app upgrade, condition change). That way, we can ensure that buckets
will be in sync with the conditions.
- Do not throw away on data pull events which are late as long as they
are in the correct bucket. This is expected since we are using
AlarmManager.
Test: atest statsd_test
Change-Id: If1222b6005a0b88bbdae1b4690921c24acd75542
the bucket.
- since the condition was unknown, the bucket contains partial data.
- we need to do the same for other metrics
Bug: 124100912
Test: atest statsd_test
Change-Id: If803e28667c1e8a74d5b809bcab2eb54d1961f46
We are currently dumping invalid data for pulled metrics. Pulled metrics
require a new pull when flushing a bucket. We should either do another
pull or invalidate the previous bucket.
There are cases where we cannot afford to do another pull, e.g. statsd
being killed. If we do not have enough time, we'll just invalidte the
bucket to make sure we have correct data.
Bug: 123866830
Test: atest statsd_test
Change-Id: I090127cace3b7265032ebb2c9bddae976c883771
+ Add metric_id, dimension, metric_value in the incident report header
to make it easier to identify an anomaly.
+ In case there is a uid in the dimension, put the its package info in the header too
Test: statsd_test && tested locally with a config
Change-Id: I762a1a4b0563fb3104e0d32b616b4a2367485e48
Modifies statsd unit tests to also assert the active configs changed
broadcast is called at the right time with the right configs. One case
has one config with multiple activation signals, while the other has
multiple configs that are activated at the same time with one signal.
Test: this is the test
Change-Id: I6e1cd19a8a0a8dbf9745152d4ad4980854be0cbd
This api is to log BinaryPushStateChanged.
Experiment id is added as a binary blob that is not expected to be
accessed on device side.
This cl is mainly for API.
Will add follow up cls for persisting train info on disk and make puller
for it.
Will address sepolicy in follow up cls.
Bug: 119633962
Bug: 119685453
Test: will add gts
Change-Id: I68b4246cf7e8079155e16121ca37a312b35a5328
Statsd now sends active configs changed broadcasts when needed per uid.
Also made an adb command to help debug.
More gts tests and unit tests required, will follow.
Test: GTS in topic
Bug: 123372077
Change-Id: Ib079018ded85d002581ffc2ba1240138ce7a54e7
When statsd starts or is killed, the conditions are not initialized.
Tracks how many buckets are skipped because the condition was unknown.
This change does not change the behavior of statsd. In the future, we
might want to invalid buckets with a condition that has been partially
unknown.
Bug: 124100912
Test: atest statsd_test
Change-Id: Ie3d2eb5e30c21dda3203ad30f9b486961ff570cf
Creates a hidden api to register puller callbacks for vendor atoms.
Test: manual local test
Test: statsd unit tests
Bug: 119898637
Change-Id: Id28817b8fc718e128adc4e1c6b2e997db84517f9