Commit Graph

14 Commits

Author SHA1 Message Date
Tej Singh
273c839a06 Merge "Retry pullfinish with empty payload if call fails" into rvc-dev 2020-06-01 19:14:10 +00:00
Tej Singh
73bad98e46 Decrease default pull timeout to 2 seconds.
This can result in more pull failures, but can prohibit slow pullers
from slowing down statsd.

Test: atest GtsStatsdHostTestCases
Test: atest statsd_test
Test: atest FrameworkStatsdTest
Bug: 154056912
Change-Id: Ie30bd3584d808bb11aaaf0fe2057c9adfb198644
2020-05-29 23:37:03 +00:00
Tej Singh
2330e9be15 Retry pullfinish with empty payload if call fails
If the first call for pullFinished fails, it is likely because the
transaction is too large. Currently, if this happens statsd will just
sleep until the timeout. With this change, the client will retry calling
pullFinish if the first attempt fails, but with an empty payload (and
with success = false) to cause the puller to fail fast, and so statsd
does not wait for the timeout.

Test: atest GtsStatsdHostTestCases
Bug: 157768117
Change-Id: I1af29b6c83039ab56ef847832a600d4afea34000
2020-05-29 15:19:48 -07:00
Tej Singh
baed5257ad Fix statsd NPE on setPullAtomCallback
Suspected root cause: if a process crashes right after calling
setPullAtomCallback, it's possible that oneway binder calls can queue
but do not execute before the process crashes. Then, when the process
crashes, nothing has a strong reference to the IPullAtomCallback, so
it gets deallocated. Then, when the oneway call actually executes, the
callback is null. This is being followed up in b/155793159

Regardless, statsd should handle null input properly.

Test: GTS test in ag/11348719 now passes
Test: atest GtsStatsdHostTestCases
Bug: 153822941
Change-Id: Ic6d415e10eca8d133290de80cb61e1634590ca6a
2020-05-05 14:51:57 -07:00
Jeffrey Huang
f3364db2d1 Merge "Remove Exception in getRegisteredExperimentIds" into rvc-dev 2020-04-01 17:58:45 +00:00
Jeffrey Huang
c43a267c4d Remove Exception in getRegisteredExperimentIds
This check was not useful since service can only be null if system
server is not running or the app does not have permissions to access
statsd. This check is not done anywhere else, so removing it for
consistency.

Bug: 150645647
Test: atest StatsdHostTestCases
Change-Id: I6465697f0157c5a9583025979c55cb2e3dc1ef84
2020-03-31 14:38:05 -07:00
Tej Singh
abc1b8de87 Guardrail for pull cooldown/timeout
Enforce a 1 second minimum cooldown and a 10 second maximum timeout on
pullers.

Test: bit statsd_test:*
Test: atest LibStatsPullTests
Test: atest GtsStatsdHostTestCases
Bug: 152543610
Change-Id: Ida0047235a7e56d7b700f1a7ab5cfbc2a147caeb
2020-03-30 22:26:46 -07:00
Tej Singh
72a70a8a3c Address Puller API Feedback
1. Rename registerPullAtomCallback to setPullAtomCallback
2. Rename unregisterPullAtomCallback to clearPullAtomCallback
3. Add getters to PullAtomMetadata
4. Change Ns to Millis (when I tried to make it Nanos, I received a
built time error saying to prefer millis unless we need the precision.
We do not need the precision, so I changed it).
5. Fix out of order params.

I did not change usePooledBuffer to setPooledBuffer because I think use
is more appropriate for our use case.

Test: make
Test: atest PullAtomMetadataTest
Test: atest GtsStatsdHostTestCases
Bug: 149475498

Change-Id: Ib07aa57a6e02c77917fe0e65a3d4a77c00ce8565
2020-03-05 16:43:02 -08:00
Jeffrey Huang
201c631992 Catch IllegalStateException in StatsManager
StatsManagerService throws IllegalStateException
when statsd is not available. This causes GMSCore to crash.

Bug: 149914783
Test: Manual, verify play store no longer crashes
Change-Id: I45cd679600ccfdb7977ecfd4437b62f56034fed2
2020-02-20 15:23:29 -08:00
Muhammad Qureshi
0b04b0560f Remove more Slog usages in statsd apex
Slog.* --> Log.*

Bug: 149128236
Test: m
Change-Id: I926f292dd5562af132774670c35fe2ca4e853bf8
2020-02-09 11:05:47 -08:00
Muhammad Qureshi
a1e47e9f2b Create REGISTER_STATS_PULL_ATOM permission
Create a permission to allow clients to register pull atom callbacks to
statsd. This permission should allow mainline modules and other platform
clients register puller callbacks, but is not intended for 3p apps.

Bug: 146462168
Test: atest CtsPermission2TestCases
Change-Id: Iea50d137e2cc9f34644c8aa9548a7445f5ec16b8
2020-02-05 14:42:15 -08:00
Jeffrey Huang
a85d8f95b4 Cleanup StatsPullAtomService
Move all variable declarations to top of file
Delete unused puller registrations
Migrate to new API

Test: m -j
Bug: 145565211
Change-Id: I03890e333dd179be3b8d075657cf84a2247a473c
2020-01-27 19:39:09 -08:00
Jeffrey Huang
f58800b66a Migrate away from using ServiceManager
Create a wrapper class to access binder objects
published by statsd mainline module

Bug: 147923515
Test: atest com.google.android.statsd.gts.StatsdHostTestCases
Change-Id: I9ea3677d88c790c856e4e89318ae2ce67ac7df1e
2020-01-23 15:47:08 -08:00
Jeffrey Huang
38330a0833 Migrate StatsManager to apex
Link frameworks-statsd.jar against framework-all
since it is currently infeasible to to link against stubs

Linking against stubs in frameworks/base cannot be done because
we still have StatsLog that calls StatsEvent.getBytes which
is a hidden API.

We can't move StatsLog to the apex because of hidden APIs in the
autogenerated code which is currently being migrated.

Test: m -j
Bug: 147923515
Change-Id: I0a59dce83a8075bdde3e72d1d8eceef2ed572791
2020-01-23 13:21:53 -08:00