Simplifications/changes:
(1) We remove the bufPos field and track the end of the buffer using
only the size field.
(2) We rename put_<type>() functions to append_<type>() to signify that the
value will be placed at the end of the buffer. We also move the
increment of event->size to within the append_<type>() functions;
this improves readability of the write_<type>() functions.
(3) We immediately write the timestamp and atom id to the buffer in
order to simplify stats_event_build().
(4) We never check for null pointers; checking for null pointers
delays errors and obfuscates the root problem.
(5) We change the the annotationId and numPairs parameters to be
uint8_t's. This helps signify to clients that these values must fit
in 1 byte.
(6) Clients no longer have to pass in the length of strings. Instead, we
expect them to pass in null-terminated strings, and we will
calculate the length outselves using strnlen.
Test: m -j libstatssocket
Change-Id: I6d192768876a23d7016173bcdaf59f8b7e92b182
Merged-In: I0173f8bc76ef25118379dce5d2481f5f7a9b7519
Encoding of key-value pairs follows strategy described in
go/statsd-socket-doc.
Fixed bug where timestamp and atom id were not contributing to the
number of fields in the buffer.
Note: Similar to ag/9603344, which was abandoned because of git rebasing
issues.
Test: m -j libstatssocket compiles
Bug: 143079361
Change-Id: I15abdf13ad8debf83ae1f6c372676db4fe390289
Merged-In: I8d23ddf2dbfee518ad970894ac09ba3ad5b5b4ad
This allows the parsing code within statsd to access the type ids.
Also, we move stats_event.h to the include directory for consistency.
Test: m -j libstatssocket
Change-Id: I7030416872677f3a523c2baf7bf6bcb4ca0ae6a4
Merged-In: I1db7fc9e9d0efd2225612353a8fc49bb13220ff0
Cherry pick to aosp.
stats_event_list changes for creating a generic api for statsd mainline
logging.
Test: builds
Test: existing logs continue to flow
Change-Id: I4163edc80ffcca61db7ab2a1e14ae8c14aab2347
Merged-In: I4163edc80ffcca61db7ab2a1e14ae8c14aab2347
(cherry picked from commit 4c2f079dad)
In addition to the dgram queue size, the sender buffer size also matters.
Set it to a higher value (default is 224KB).
Test: manual
Change-Id: Ib610c1fa1eaf3c5e36f51854a2b0720f387dc1b8
stats_event_list changes for creating a generic api for statsd mainline
logging.
Test: builds
Test: existing logs continue to flow
Change-Id: I4163edc80ffcca61db7ab2a1e14ae8c14aab2347
readv() isn't used by anyone, writev() has one easily replaced user.
uio.h can be left as a private header for windows compatibility with
struct iovec.
Test: build
Change-Id: I33d4c6bdee6fd818271f78ae06abdd2aa09430f2
The existing APIs will truncate the byte array in case of '\0' in between.
Test: test_drive with atom 103
Change-Id: I104d35b330c6b52e2fdce1f5d4305dca08228f1b
Previous submission of this change, aosp/790068, caused a failure in
sdk_mac for CLOCK_REALTIME and <endian.h> not being available.
Bug: 110537511
Test: compiles without failures and verified the correct metric
Change-Id: Iba1dc920ad82e88a4bcdd2feaee9a06202a440c2
+ Record all types of failures which lead to log loss
+ Only record eventual failure after the retries to get a accurate log loss count.
Bug: 80538532
Test: manually tested
Change-Id: I23a55e62e140bf22ae5aa9e6c40539d51149cd66
Merged-In: I23a55e62e140bf22ae5aa9e6c40539d51149cd66
(cherry picked from commit ad3a40bf76)
The original liblog code has this additional check because there may be multiple writers registered,
there is a for-loop and the retVal is set to be the FIRST error. Statsd doesn't need it because it
only has one writer.
Test: locally tested.
Change-Id: I03f0015d0c29eba19eb2b5ea145380cb98fb2509
So that lmkd can build on PDK.
Bug: 79349329
Test: builds locally
Merged-In: I981e6ef9f9769b873640e5f169a9495ccea2f25c
Change-Id: I981e6ef9f9769b873640e5f169a9495ccea2f25c
(cherry picked from commit b13a102c0a)