summaryrefslogtreecommitdiff
path: root/tools/stats_log_api_gen/test_collation.cpp
AgeCommit message (Collapse)Author
2020-12-12Migrate to frameworks/proto_logging/statsBaligh Uddin
BUG: 175318992 Test: TH Merged-In: Ia6463c8f6a801cd9db54afa30df0aa3f16b09891 Change-Id: I81324b83802dc2b06081600282bb73491f29473b Exempt-From-Owner-Approval: cleanup CL
2020-07-31Update stats-log-api-gen source based off of google3 presubmit checksSalud Lemus
Bug: 161812407 Test: `m statslog-framework-java-gen` Test: `m statslog-telephony-java-gen` Test: `m stats-log-api-gen-test && out/host/linux-x86/nativetest/stats-log-api-gen-test/stats-log-api-gen-test` Change-Id: Id68982e306fbc379ed8e90b33a38b8a6604e66ad
2020-07-07Added support for pulled atoms for stats-log-api-genSalud Lemus
Currently, stats-log-api-gen allows statsd clients to send events for pushed atoms to statsd using a simple auto-generated function call. Allow support for pulled atoms so that clients no longer have to hand-construct StatsEvent objects by calling StatsEvent write methods directly and also making sure that the appropriate annotations are added. This support is for Java clients only for now. Bug: 160368804 Test: Ran `m statslog-framework-java-gen` and completed successfully Test: Ran `m` and completed successfully Test: Ran `m stats-log-api-gen-test && out/host/linux-x86/nativetest/stats-log-api-gen-test/stats-log-api-gen-test` Test: Ran `atest CtsStatsdHostTestCases:android.cts.statsd.atom` and all passed except for CTS tests related to a SIM card because the testing device does not have a SIM card Change-Id: Ie2cbb298690ce71ff7fe7457b17b9d7bdbb24f6b
2020-06-18Remove libstatsmetadataMuhammad Qureshi
Remove kWhitelistedAtoms usage in MetricsManager and remove: - atoms_info references from statsd - libstatsmetadata usages from statsd - libstatsmetadata library - atoms_info_writer.h/.cpp - references to atoms_info in rest of stats-log-api-gen - allow_from_any_uid annotation Fixes: 147600720 Fixes: 154856835 Fixes: 148993016 Test: m stats-log-api-gen Test: m stats-log-api-gen-test && out/host/linux-x86/nativetest/stats-log-api-gen-test/stats-log-api-gen-test Test: m statsd Change-Id: I2e0579609ff257da934b95cdda397f3ca0ffa1f0
2020-04-03Make state_option top-level boolean annotationsMuhammad Qureshi
- Add AnnotationId enum stats-log-api-gen - Rename RESET_STATE annotation to TRIGGER_STATE_RESET. Also rename the proto annotation. Bug: 152412767 Test: stats-log-api-gen-test Test: m statslog-framework-java-gen Change-Id: I2c12ea0b9222ef28b8cc11ea36b272e518a96259
2020-03-26Group annotations for the same atom idMuhammad Qureshi
Group annotations for the same atom id inside one if-block in generated code. Use shared_ptr to store AtomDecls in multiple data structures. Store a mapping of field numbers to atoms that have annotations at corresponding field numbers in Collation.h Bug: 151744250 Test: stats-log-api-gen-test Test: m stats-log-api-gen Test: m libstatsmetadata Test: m statslog-framework-java-gen Test: m libstatslog Change-Id: I874696cfb5c27141017b4293bec809ab510ceb98
2020-03-24Run clang-format in stats_log_api_genMuhammad Qureshi
Bug: 152253223 Test: m stats-log-api-gen Test: stats-log-api-gen-test Change-Id: Iad76baea8cc9ae7b3978f1133ab94d8e96bbbafe
2020-03-17Store annotation during collationMuhammad Qureshi
- Only collate atoms in the specified module. - Replace signature_to_modules with signatureInfoMap. This maps each signature to another map keyed by field number and whose values are vector of annotations. Bug: 151102006 Test: stats-log-api-gen-test Change-Id: I25bbe4883c8f7f86a06d04d27cd425367b6d65a0
2020-03-05Support multiple module annotations per atomMuhammad Qureshi
Bug: 150864291 Test: m stats-log-api-gen-test && out/host/linux-x86/nativetest/stats-log-api-gen-test/stats-log-api-gen-test Change-Id: Ibf8869078c6f1eae13e687f0196d6ed91ec35c64
2020-03-05Fail if there are repeated fields in atoms.protoTej Singh
Repeated fields arent allowed outside of attribution node and key value pairs, so we should fail to build if someone attempts to add one. Bug: 149956370 Test: atest stats-log-api-gen-test Change-Id: I0caa6fcf74dabe8e962360ecccfd3a87fcaa4909 Merged-In: I0caa6fcf74dabe8e962360ecccfd3a87fcaa4909
2019-03-15Mainline logging to statsd: native static libsTej Singh
Creates an annotation to specify if an atom needs to be logged from a specific mainline module. Creates options in stats-log-api-gen so that if the same module name is passed in, cpp/h files will be generated with only those atoms that are specified. These files can be used to create a static library per mainline module to log to statsd. Test: builds Test: atest stats-log-api-gen-test Test: does not affect existing shared libstatslog Test: manually created a static lib for netd and used it to log to statsd. Used testdrive to validate the data was properly flowing. Bug: 126134616 Change-Id: I78064f81fb4971eede8e97dacce5424e3eefd8bb
2019-02-06Add whitelist atom field optionAndrei Onea
Whitelisted atoms can be triggered from any source Test: stats-log-api-gen-test Bug: 119217680 Change-Id: Ia5faed04d696b59ba4ffaab13f5046f943d8a8b7
2018-10-24Allow atoms to log fields in bytes format.Yao Chen
There are an increasing number of requests to log data in complex format to statsd, while the data is not expected to be parsed or aggregated by statsd and only to be uploaded as events. Instead of making an exception for each of these cases in a hard coded way, this CL add a feature to annotate these field in atoms.proto and the stats-log-api-gen tool will produce byte array interfaces for them. Note that log_msg does not have byte array type, and only has string type, when statsd receives the log, these fields are in string type. Only when the atom is written to proto, we will check if this field should be bytes field and write it to protobuf in message format. Change-Id: If53dd95c5826710c76d7fe982bf951a435dfc738 Fix: 118386797 Test: unit test & manual test
2018-02-21Add annotation to atoms that represent a state change in atoms.protoYao Chen
+ A state change atom can have one exclusive state field, and any number of primary key fields. When there is primary key in the atom, it means the state belongs to the primary key. For example, message UidProcessStateChanged { optional int32 uid = 1 [(stateFieldOption).option = PRIMARY]; optional android.app.ProcessStateEnum state = 2 [(stateFieldOption).option = EXCLUSIVE]; } When there is no primary key fields in the atom, the state is global. For example, message ScreenStateChanged { optional android.view.DisplayStateEnum state = 1 [(stateFieldOption).option = EXCLUSIVE]; } + The annotation is consumed by stats_log_api_gen to generate a static map from the state atoms to its primary fields, and exclusive fields + stats_log.proto is splitted into 2 proto files, because statsd needs proto lite, and c++ lite proto library cannot properly ignore the field options which requires full proto. This CL doesn't change any logic in the statsd yet. A separate CL will use the field option information to correctly track the state. Test: added unit tests in stats_log_api_gen_test. and statsd_test pases. Change-Id: I9e8a979fe81ba60efd4d854bb7087ce4b2b147ec
2018-01-011/ Support nested message and repeated fields in statsd.Yangster-mac
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
2017-12-15Stats log api for attribution chain.Yangster-mac
Test: all unit test passed. Change-Id: I628d409e517f4f95c8da1d0c7fd4d514c1d9196d
2017-10-31Generate constants for enum values.Stefan Lafon
Test: Builds successfully, tests pass and statsd works (it seems). This will allow us to use those constants instead of literals. The generated code only augmentes the java constant file. If needed, the same can be done for the C++ file. Some of the constant names are very long, but this is due to enum value names that are unnecessarily redundant with the enum names, i.e. enum ENUM_NAME { ENUM_NAME_UNKNOWN = 0; ENUM_NAME_VALUE1 = 1; ENUM_NAME_VALUE2 = 2; ... } which can be fixed by avoiding the 'ENUM_NAME_' part in the value names above. So, when possible, we should use shorter value names in stats_events.proto. Change-Id: I1ad19b86e28d0df0f8c15d4c995d101423cff4c2
2017-10-17Revert "Revert "Start auto-generating the stats log API.""Yao Chen
Test: builds successfully This reverts commit 931945399859ab91545ba2c2a914f044092d5e2e. Change-Id: I22bca4a32adf86040b9d72ad5b45999aba28f586
2017-10-16Revert "Start auto-generating the stats log API."Joe Onorato
This reverts commit b81d1a7b9a38dcb4d356ae3435a82fb52ba7d585. Change-Id: I189684d8913ffffca42d9514ac88ea5cc4a44f05
2017-10-15Start auto-generating the stats log API.Joe Onorato
Both native and java bindings. TODOs: - Finish WorkSources. - Clean up the package names for the protos. - Put the protos in a more suitable location. Test: stats-log-api-gen-test Change-Id: Idf4022225e2be05106dbcf7de8e97a3337fc63e2