Also changed StatsLog to call write() instead of the hard coded function
in StatsService.
Test: gts-tradefed run gts-dev --module GtsStatsdHostTestCases
Change-Id: I26171fa4cfc877e1e179b74ec8076d964aff8548
This switches stats-log-api-gen to use StatsEvent.java and
stats_event.c/StatsLogCompat.cpp in generated StatsLog write methods.
Bug: 143979391
Test: m
Test: fastboot flashall
Test: atest CtsStatsdHostTestCases
Change-Id: I56f58d5545e51a0d7a34ec835110f5bc1b069d57
The CarStatsPuller class is not needed because CarStatsService will now
directly register the VMS_CLIENT_STATS puller with StatsManager.
Test: m -j
Bug: 148123503
Change-Id: Icd46af829c8f559315f72feab1eda3b687c57148
Since pulls now go through StatsPullAtomService, instead of
StatsCompanionService, we no longer need the StatsCompanionServicePuller
class.
Test: m -j
Change-Id: Id7050fbda1118808aade0754747248b21c11b814
Now that we're using statsd's C api, we can define the puller callback
in the surfaceflinger process directly.
Bug: 119885568
Test: builds
Change-Id: Ieb6a843c26cf7f19142e05cc170beedbd1af14d9
Right now, Q schema generated code has a dependency on libutils.
Turning on R schema for clients will remove libutils as a required
dependency. Once libutils is removed from clients, turning the flag off
again will be complicated as all clients will need to re-include
libutils. To fix this problem, remove dependency on libutils in Q
schema.
Right now, we only use SystemClock.h from libutils in Q schema autogen.
Use timespec from C standard library instead.
Bug: 146808265
Test: m
Test: flashes successfully
Test: adb logcat "*:S statsd:*"
Test: bit statsd_test:*
Change-Id: I00efeab1be351a95083f3b6e2dbc9067849bee20
This is not a stable API surface, so modules shouldn't be building
against it. Compiling against core_platform also disables link-checking,
which can hide other problems.
Bug: 137191822
Test: m
Change-Id: I7ce7dad8c02b094c565daf8c178bc6f89bb610ef
Clients don't need to know about statsd metadata. Extract out metadata
from statslog.h/cpp into atoms_info.h/cpp which is only used by statsd.
Generated atoms_info.h: https://paste.googleplex.com/6303016724463616
Generated atoms_info.cpp: https://paste.googleplex.com/5717940978581504
Test: m -j
Test: old metadata in statslog matches the metadata in
atoms_info
Test: Flashes successfully
Test: adb logcat "*:S statsd:*"
Change-Id: I56ef3cc4ea1fbd2cd0130d4e9576b242efb9f627
Tests 4 key things: A successful pull, a failed pull and two timeout
cases.
Timeout case 1: StatsPullerCallback should stop early and return true.
Timeout case 2: StatsCallback should note that the pull timed out,
notify statsd stats, and return false.
Test: bit statsd_test:*
Bug: 145310627
Change-Id: Id87089f04e1cf54a622b3f15585341ecdcd21f7f
New tests are guarded by NEW_ENCODING_SCHEME flag.
Test: bit statsd_test:* (passes both when the flag is turned on or off)
Change-Id: I429f478355e3e19941e4796706405ab0774e11d9
New parsing logic can be turned on using the DNEW_ENCODING_SCHEME flag.
Currently, we do not support parsing annotations or errors.
To simplify the LogEvent constructor, we remove the creation of
log_msg objects within StatsSocketListener. This change to the LogEvent
constructor also forced us to modify the LogEvent benchmarking code.
Test: m -j128
Test: bit statsd_test:* (passes when flag is off)
Test: atest StatsdHostTestCases (passes when flag is off)
Test: bit statsd_benchmark:*
Change-Id: I827b72f46a617dbc5194ad778fcf7c3d794efb7b
Internal implementation of the puller API. Registers pullers by putting
them in the kAllPullAtomInfo map. Implements the actual pull,
with condition variables to timeout.
Lastly, keys the kAllPullAtom info by a PullerKey, which is a uid and
atom id. However, the uid is just set to a default of -1 for now. I will
work the security implementation in a follow up CL.
Test: builds, boots
Test: I will write unit tests in the future. It's very difficult to
write any without StatsEvent being completed.
Change-Id: Id602dd297b6ba7df811e2d5ab2e77efc0684e418
Changes in this CL compared to previous StateTracker version:
- MetricsManager parses StatsdConfig for State information and updates
MetricProducers accordingly
- MetricProducer implements StateListener
- MetricProducer has a list of atom ids of its slice_by_states and any
state maps from these states. MetricProducers are responsible for
handling the conversion from original state value to mapped state value.
- More unit tests added and e2e CountMetric test added
Test: bit statsd_test:*
Bug: 136566566
Change-Id: I07ce468733a1affcadf2be0206e081fddbbce4c5
This adds a writeBytes interface to LogEvent for native pulled atoms,
which have been using write(string). The function still takes in a
string, but instead uses the write_char_array interface to avoid
stopping on null termination.
Test: modified tests and ran statsd_test
Test: statsd_testdrive 10055 to test against gpu app stats
Bug: 141965020
Change-Id: Iaedfb73310769165d8b61affb55e784f109355cf
One shared StateManager object will manage all StateTrackers across all configs, maintaining a map of atom ids to StateTrackers.
StateManager is responsible for initializing and removing StateTrackers and notifying them of event or StateListener changes.
Each StateTracker maintains a list of StateListeners and is responsible for tracking state values to primary keys and notifying StateListeners when a state change occurs.
Test: bit statsd_test:*
Bug: 136566566
Change-Id: Icb61c668a01b611aa75caa7bdc2a6801c650b119
- The old StateTracker tracked state through a SimplePredicate defined
with only a "start" atom matcher that matched a state atom. This
StateTracker will be renamed StateConditionTracker to avoid confusion
with the new StateTracker.
Test: bit statsd_test:*
Bug: 136566566
Change-Id: I161aa463e83bd63d0fd52eb8579dab531f566dd5
libplatformprotos for the device is compiled using proto lite, and
statsd_test and statsd_benchmark have protos that reference the
libplatformprotos. With protobuf 3.9.1 compiling a full proto
against a lite proto doesn't work. Convert them to lite. Requires
adding the protobuf internal protos to the sources,
libprotobuf-cpp-lite does not contain the compiled version of
field_options.proto.
Bug: 117607748
Test: m checkbuild
Exempt-From-Owner-Approval: approved at https://android-review.googlesource.com/q/I0b101555ff604df17b2e3e06f3b3ce25adb1c9fb
Change-Id: I0b101555ff604df17b2e3e06f3b3ce25adb1c9fb
The dimensions_in_condition field is not used for any configs in statsd.
The functionality that it was intended to provide will be replaced by
StateTracker which is being tracked in b/136566566.
go/remove-dic contains background information on what was
removed/changed and why
Test: bit statsd_test:*
&& atest CtsStatsdHostTestCases
&& atest GtsStatsdHostTestCases
Change-Id: Ic328fa5fe027377380ba57363d9bc77985f18376
Deleting these did not cause a build error, so I do not think we need
them anymore.
Test: make statsd
Test: atest_statsd_test
Change-Id: If86365ae691b05c4922fe4edb07aad1ebf25e2d9
(cherry picked from commit 7954524e3cc618830f0bf7b23687bf222ecd285b)
Bug: 134566750
Test: m
Change-Id: I0260942108a13cc5e9bed1d6005abfb8daffe0ac
Exempt-From-Owner-Approval: minor build change
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
StatsService to update UID data and overflows kernel transfer buffer.
In this case, the IPC call silently fails. The issue was discovered in Android Automotive Embedded use case that employs multiuser setup. This causes more uid data being sent via one-way StatsCompanionService::informAllUidData call than usual and can trigger the issue. As the result, uid map on statsd side is empty and many metrics are not captured.
Bug: b/132444397
Fixes: b/132444397
Test: Did a clean build of master branch and flashed the device. adb
shell cmd stats print-uid-map returned without any result. Repeated the
steps after implementing the fix, print-uid-map returns the results now.
Change-Id: I1451c13b36696449c145c51618c68d10e29a596a
+ 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
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