aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2017-03-27Remove libweaved support.HEADmastermainAlex Deymo
Bug: None Test: `make checkbuild` without weave. Change-Id: I9fa060ecdc5b563aa2c453152f86f586f75756ac
2016-09-13Fix metricsd compile issues in new repositorySteve Fung
This fixes a few issues: - Fixes proto absolute paths for new system/metricsd location - Conditionally builds in weave support behind a use flag Bug: 29835922 (cherry picked from commit a7840a0353e7675158ac4a4bdb679cc5ea6ff72a) Change-Id: Iff5c5bef9759ecdc071e9608dbdd41dcc0748f4b
2016-06-24Merge branch 'rewrite-metricsd' into merge-metricsdXin Li
Initial import of metricsd from platform/system/core. BUG: 29548040
2016-06-16Initial empty repositorykuantung
2016-05-26core: Update libchrome APIs to r395517Luis Hector Chavez
The new libchrome has been ported from Chromium and some APIs have changed. Make necessary changes at call sites. Change-Id: I0a0e0441b6a7486ff0b42d11136254d8a536788f
2016-04-08metricsd: Remove release/aquire semantic from scoped_ptr/unique_ptrAlex Vakulenko
Now that scoped_ptr is just a type alias to unique_ptr, there is no longer a need to convert between the two by using .release() and constructing the other with a raw pointer. BUG: None TEST: Built for dragonboard, all unit tests pass (except for update_engine, but those tests failed before these changes too). Change-Id: Ibf0a094805d22d00ca10e1c67f68efb08c8677df
2016-03-18metricsd: Fix upload service to compile with new libchrome versionAlex Vakulenko
libmetric's HistogramSnapshotManager::PrepareDeltas now takes the iterators for the histogram collection to work on, instead of getting a global one. Change-Id: I3997ea7d2c330431379d055b0cb876069bddf395
2016-02-16Add .clang-format symlink to Brillo's clang-format.Alex Deymo
This patch replaces the locally defined clang-format with a symlink to the one defined in build/tools. Bug: 27121653 TEST=Ran clang-format. Change-Id: I8810428d12b60c7463bc7f9a96228600ec8b425d
2016-02-10Fix UploadService unittests.Alex Deymo
The unittest was creating a brillo::Daemon in a smart pointer and then resetting it to a newly created different brillo::Daemon instance. This creates two brillo::Daemon instances for a short period of time, which both setup global context (the default message loop). This patch fixes this situation by deleting the service before creating a new one. Bug: 27121855 TEST=`/data/nativetest/metricsd_tests/metricsd_tests` on edison-eng Change-Id: I3b60cbfcdba77febbfa6104aa0ecad60a29afec5
2016-02-04Merge "metricsd: Create a brillo::MessageLoop."Alex Deymo
2016-02-04Unit tests: Compile only on 'eng' builds.Jorge Lucangeli Obes
metrics_collector_tests, metricsd_tests. Bug: 26967770 Change-Id: I6d7e8fb6d3d98ab747d922bfeef05aa344b2179c
2016-02-04metricsd: Create a brillo::MessageLoop.Alex Deymo
brillo::BinderWatcher now requires a brillo::MessageLoop, so this patch creates a brillo::BaseMessageLoop and passes it when creating the brillo::BinderWatcher. Bug: 26356682 TEST=Deployed metricsd to edison-eng. Change-Id: I6a9e592623faf231205ae44e479bec2b873b8898
2016-02-02crash_reporter: Fix paths for kernel panic collectionSteve Fung
Fix the paths to the pstore mount and run data within the kernel collector. BUG=26774830 Change-Id: I68be0a28201cb73c3420166b2f4da77a1e586ca2
2016-01-28metricsd: Removing brillo::Any from weaved's public APIsAlex Vakulenko
Weaved replaces brillo::Any with base::Value in its client library, so need to update clients. Also this removes last D-Bus dependencies from metrics_collector. BUG: 26558300 Change-Id: I82d571d7e2bd17347daeb1b70f48ec05378894f0
2016-01-25Add BinPackArguments: false to .clang-formatAlex Deymo
Without this setting, arguments passed to a function can be packed in more than one line, with more than one argument per line. For example, the following code will be formated as this without the BinPackArguments: CallMyFunction( with_more_than_one, argument_per_line, event_they_dont_fit_in_a_single_line); On the other hand, with BinPackArguments: false, that code will be split in: CallMyFunction( with_more_than_one, argument_per_line, event_they_dont_fit_in_a_single_line); or all the arguments in the same line if they all fit. Bug: None TEST=None Change-Id: I48627e66e2a841f89418c0763e7fe6c3e6ea7387
2016-01-22metricsd: Add more assert clause.Bertrand SIMONNET
This CL adds two more checks: * When populating a closed log with the metadata, make sure the SystemProfileSetter is not null. * When using the update engine client library, check if the update engine client object was created correctly. The returning object can be null if update engine's binder service is not running. Bug: 26731548 Change-Id: I8a615c87f33e15a163d56ccfa3a932a0908aac5f
2016-01-20libmetrics: Update BASE_VERS to 369476Alex Vakulenko
This is needed to uprev everything on ChromeOS side Change-Id: I070e374dd4abe92884b88231ba60c82b69c72806
2016-01-20crash_reporter/metricsd: Update libchrome APIs to r369476Alex Vakulenko
The new libchrome has been ported from Chromium and some APIs have changed. Make necessary changes at call sites. Change-Id: I9e45975cdef43913270b82e3fca2c027e614a464
2016-01-19metricsd: Add tests to the default debug build.Bertrand SIMONNET
This will allow the tests to be run by the continuous builder. Bug: 26571398 Change-Id: I7eae2761603e83e3d1f003cb3b06582abc4ed24f Test: Build an eng build. The tests are installed.
2016-01-19metricsd: Persist metrics on shutdown.Bertrand SIMONNET
When metricsd receives a SIGTERM signal (on system shutdown for example), save the metrics to disk before exiting. Bug: 26184202 Test: Start metricsd. Log a metric sample. Stop metricsd. The metric is saved to disk. Change-Id: Ib224efa8837130393fac5d06fa80d320263cfc84
2016-01-12metricsd: Persist the metrics to disk periodically.Bertrand SIMONNET
Every now and then (5 minutes by default), the uploader will persist the current metrics to disk to avoid losing them in case we exit unexpectedly (reboot or crash). When starting up, metricsd will load the previously saved log and resume the metrics collection from there. Bug: 25670584 Test: Unit tests. Test: manual: restart metricsd. The saved log is detected and parsed correctly. Test: manual: Send a sample to metricsd, send SIGTERM to metricsd, the log is saved to disk, metricsd restarts and picks up the log where it left. Change-Id: I4cefc62c7ea1fa51333d84d8a7ba0a2e9c7fd58f
2016-01-12metricsd: Cleanup on TERM signal.Bertrand SIMONNET
metricsd should shutdown cleanly when receiving a TERM signal: * stop the binder watcher. * wait for the thread to quit. * Exit cleanly. Note: This is not directly used as we don't send SIGTERM on shutdown or when stopping services yet. Bug: 25670584 Change-Id: I878d1e67474c72d24790f3540470e37a23112a95
2016-01-08metricsd: Split out the trait name from the command nameAlex Vakulenko
weaved::Service::AddCommandHandler() and SetStateProperty() now expect the trait name as a separate argument. BUG: 26443877 Change-Id: I2ad587d984375a7ebd70c7dc804b446b66d6be1b
2016-01-07metrics: Switch to use Binder interface to weavedAlex Vakulenko
Now that weaved provides a binder interface for its IPC, switch to using it instead. BUG: 23782171 Change-Id: Ic3c485f99580fe41e287eaf238f033149787f181
2016-01-07Merge "Fix documentation."Bertrand Simonnet
2016-01-06Fix documentation.Bertrand SIMONNET
This fixes the documentation for UploadService and the README file: * stop mentioning Chrome OS as we forked the code. * update the histogram declaration workflow. It is not tied to Chrome's histograms.xml file anymore. * update the architecture explanation of metricsd. We split metrics_daemon into two daemons and are now using binder to log metrics. * convert README to markdown to make it prettier when viewed in gitiles. Bug: 26314417 Change-Id: I1e492f1211c1784e65dd4d3e473bb9aacefc3b5d
2016-01-06Use specific users for metricsd/metrics_collector.Jorge Lucangeli Obes
/data/misc/metricsd only needs to be accessed by metricsd. /data/misc/metrics_collector only needs to be accessed by metrics_collector. /data/misc/metrics needs to be writable by metrics_collector and readable by metricsd. Make it 0750 metrics_collector:system and keep running metricsd as group 'system' to allow reading. Bug: 26337609 Change-Id: I169573cc547f154daa8b65c5f13bdc20964a3f2c
2016-01-05metrics_collector: Fix build of testsTodd Poynor
IMetricsCollectorService implementation moved from libmetricscollectorservice to metrics_collector executable, which means it needs to be compiled into test main as well. Bug: None Change-Id: I29b0a3ae6164d2256366d61c3a3639d22b943a69
2016-01-05Remove metrics collector service trampolineTodd Poynor
No longer needed to trampoline between RTTI and non-RTTI compiles. Move the service impl from libmetricscollector service to the metrics_collector executable, now that RTTI is no longer used (and the impl is not used by binder clients). Other fixups, including: * Move service registration and binder watcher to metrics_collector main. * Compile libmetricscollectorservice with clang just because. Bug: 26292405 Change-Id: Iae8115c13b203ff03d49bf7678d5eb3ede30e855
2016-01-04Disable RTTI in crash_reporter and metricsdAlex Vakulenko
There is no longer a reliance on RTTI in libbrillo, so disable RTTI in the rest of Brillo codebase. Bug: 26292405 Change-Id: I2751a2ac973a74741a82f5cd949fc0adaf2449a6
2015-12-22metricsd: Replace scoped_ptr with unique_ptr.Bertrand SIMONNET
scoped_ptr are a chromism. We should use unique_ptr instead. Bug: 25958769 Test: unit tests. Change-Id: Ie23ae2ef42f66dcc76f45a9dafa66c8ceb0a2d90
2015-12-16Fix metricsd to conform to the lastest server schemaAlex Vakulenko
The new server push enabled component/trait validation rules. This allows us to use the new schema that does not require vendor commands, parameters and state to start with underscore ("_"). Also fixed a few minor errors in schema definition. Change-Id: I184dd8e4c69c05e0dd1b0dddb1f9a7b0aef78841
2015-12-10metrics_collector: add libmetricscollectorservice binder serviceTodd Poynor
Switch user crash event notification from D-Bus to this Binder service. Add a trampoline as a go-between for the -frtti and -fno-rtti sources. Add MetricsCollectorServiceClient for crash_reporter to use, hiding the binder proxy details. Remove D-Bus message filtering from metrics_collector. Bug: 25929888 Change-Id: Idcdd60ac476340fb11602fc9afab6cd87843e529
2015-12-10Merge "metricsd binder: Abort if fail to register service"Todd Poynor
2015-12-09metricsd binder: Abort if fail to register serviceTodd Poynor
Assert abort metricsd if binder service registration fails. If the addService() call fails (for reasons that at least include an SELinux policy denial), the call to joinThreadPool() apparently processes a stale pending weak dereference that triggers an abort on a probable double-free: F libc : Invalid address 0xbe8bfa30 passed to free: value not allocated F libc : Fatal signal 6 (SIGABRT), code -6 in tid 609 (metricsd) Since metricsd is severely hobbled if registration fails, abort and see if things work better the next time. If not, the crash loop will hopefully attract attention to the problem. Change-Id: I520d0eafb9cb25ee225d589bfd87df4e51f6b181
2015-12-09metricsd: Update to use new component/trait APIs from weavedAlex Vakulenko
Removed command and state definitions and use trait definitions instead. Also, create "metrics" component for weave. BUG: 25916429, 25916428, 25917426 Change-Id: Icc02d1c46c371d3afa8e4723852f182992c62bf2
2015-12-08metricsd: Remove unused type declarationsAlex Vakulenko
BUG: 26092352 Change-Id: If0dda4c171a2b62291693db49c1e16499fc10f5a
2015-12-04metricsd: Allows introspecting the metrics.Bertrand SIMONNET
This CL adds a dump command to metrics_client that will dump the histograms, aggregated by metricsd since it started, in a human readable format. This is useful for developers to ensure that their code uses libmetrics correctly and the reported values are correct. Sample output (redacted to fit the commit message): $ metrics_client -d Histogram: hello recorded 5 samples, average = 54.8 (flags = 0x1) 0 ... 9 --------O (1 = 20.0%) {0.0%} 16 O (0 = 0.0%) {20.0%} 29 --------O (1 = 20.0%) {20.0%} 54 ------------------------O (3 = 60.0%) {40.0%} 100 O (0 = 0.0%) {100.0%} $ Bug: 25817310 Test: * Send a histogram with metrics_client. * `metrics_client -d` shows it. Change-Id: Id186dc5463403ca9181ee9eef8f46b5e809b8714
2015-12-04metrics: Remove user action logic.Bertrand SIMONNET
User actions are no longer reported anywhere, we can remove the logic. Bug: 25818567 Change-Id: Ie8fee841bda6503a3f5781d73b0f879babe99b03
2015-12-03metricsd: Log over binder.Bertrand SIMONNET
This CL converts metricsd, libmetrics and metrics_collector to use Binder to pass metrics samples. Bug: 25670685 Change-Id: I657faecdf4ed1226ab30ce69e062028463437e7b
2015-12-02metricsd: Add clang format config.Bertrand SIMONNET
This will make it easier to catch formatting nits. This style is based on the Google style guide (well known publicly) and follows the Chromium style changes we have adopted. Bug: 25887990 Change-Id: If9562223752dfe611a32c341e703338f806bcc0f
2015-11-30metricsd: Use different directories for each daemon.Bertrand SIMONNET
Instead of using a single directory for both the internal data of metricsd and metrics_collector and the shared files (metrics samples log file and the metrics enabled file), we should use separate directory to allow for a finer access control. The new structure will be: * /data/misc/metrics for the files accessible to all daemons reporting metrics, metricsd and metrics_collector. * /data/misc/metricsd for the private files of metricsd. * /data/misc/metrics_collector for the private files of metrics_collector. Bug: 25886951 Test: Unit tests. Test: Manual: metricsd and metrics_collector run without errors. Change-Id: I006d19f45f5f419d2b08744126c2e2a0b899c9fa
2015-11-30metricsd: Specify directory for persistent integers.Bertrand SIMONNET
Instead of using a global directory for persistent integers, specify the directory to use in the constructor. This will make changing the backing directory easier. Bug: 25886951 Change-Id: I590816b195fa81b179a5ec78b9cdf41bc86353dc
2015-11-18metricsd: Split into two daemons.Bertrand SIMONNET
This CL splits metrics_daemon into two independent daemons: metricsd and metrics_collector. * metricsd will be responsible for reading the metrics from disk and periodically uploading them to the server. * metrics_collector will be responsible for gathering generic metrics from the system and managing the weave state for metrics. This refactoring is necessary to prepare the migration of metricsd to log over binder. Bug: 25670908 Test: Unit tests. Test: manual: both daemons run. Metrics are logged, uploaded and the weave interaction works. Change-Id: Ib00e1772bb7eec87cbcdcd912c30b555d79d7074
2015-11-17metricsd: Don't upload if product id is empty.Bertrand SIMONNET
If the product id is not set, the product_id file might exist but be empty. In this case, to try to update the metrics. Bug: 25745391 Change-Id: I3942afaf38921b44ddb7e5a29d5d0e4fb6d48d94 Test: Unit tests.
2015-11-13metricsd: Remove dead code.Bertrand SIMONNET
We don't report the cpu frequency, we can remove that part of the code. Bug: 25693224 Test: unit tests. Change-Id: I510654a74261dbd66b7183ea54eef1e1eadc4d91
2015-11-12metricsd: Fix the update channel parsing logic.Bertrand SIMONNET
libupdate_engine_client returns the channel as "stable-channel", "dev-channel" or "beta-channel". This CL updates the parsing logic to match this format. Bug: 25669566 Test: unit tests Test: manual: The reported channel matches what update_engine_client --show_channel reports. Change-Id: Ic6e52df892ae0b438f58fc05b178d5844d6674d0
2015-11-10metricsd: Fix logging initialization.Bertrand SIMONNET
metricsd should only log to a single location (stderr or syslog): * standard error if --logtostderr is set or metricsd runs in the foreground. * syslog if --logtosyslog is set or metricsd is daemonized. Bug: 25472752 Change-Id: Idb918714e1b6975d79682f22495a7ca708d4d97d
2015-11-06metricsd: add SendBoolToUMA to metrics interfaceNathan Bullock
Bug: 25561571 Change-Id: I698d2408e2f462865f6512b7be17ff0851a1f97c
2015-11-04metricsd: Collect average cpu usage information.Bertrand SIMONNET
Collect a new histogram (Platform.CpuUsage.Percent), collecting the average cpu usage in percent of the total cpu usage possible (across all cpus). This measurement is collected every minute. Bug: 25231576 Test: unit tests. Test: Manual testing. Change-Id: I1c63486c177f0c2d4bd361eb9e351a7ca25b80d9