summaryrefslogtreecommitdiffstats
path: root/metricsd
Commit message (Collapse)AuthorAgeFilesLines
* Remove crash_reporter and metricsdChristopher Wiley2016-09-0978-8384/+0
| | | | | | | | The responsible team has split these out into their own repositories. Bug: 31397631 Test: checkbuilds pass Change-Id: Id38e856d533899519bd5e5f20ffa6d79e8de4bff
* Remove Brillo-specific LOCAL_MODULE_TAGSDan Willemsen2016-07-311-6/+0
| | | | | | Replaced with PRODUCT_PACKAGES_ENG in brillo_base.mk Change-Id: I66f467d95745aa6b1f3c81aa87a3f139a33dbebf
* Merge "Fix google-explicit-constructor warnings in system/core."Chih-hung Hsieh2016-07-293-3/+3
|\
| * Fix google-explicit-constructor warnings in system/core.Chih-Hung Hsieh2016-07-263-3/+3
| | | | | | | | | | | | | | | | | | | | * Declare explicit conversion constructors. * Add NOLINT for implicit conversion constructors. * Fix also some misaligned indendations. Bug: 28341362 Change-Id: Idf911f35923b408d92285cc1a053f382ba08c63e Test: build with clang-tidy
* | Fix clang-tidy performance warnings in metricsd/uploader.Chih-Hung Hsieh2016-07-272-2/+2
|/ | | | | | | | * Use const reference type for parameters to avoid unnecessary copy. Bug: 30407689 Change-Id: I5e6bfd1cd3bcf54666316573281b79573cd8a780 Test: build with WITH_TIDY=1
* core: Update libchrome APIs to r395517Luis Hector Chavez2016-05-261-1/+3
| | | | | | | The new libchrome has been ported from Chromium and some APIs have changed. Make necessary changes at call sites. Change-Id: I0a0e0441b6a7486ff0b42d11136254d8a536788f
* metricsd: Remove release/aquire semantic from scoped_ptr/unique_ptrAlex Vakulenko2016-04-081-15/+15
| | | | | | | | | | | | 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
* metricsd: Fix upload service to compile with new libchrome versionAlex Vakulenko2016-03-181-0/+1
| | | | | | | | libmetric's HistogramSnapshotManager::PrepareDeltas now takes the iterators for the histogram collection to work on, instead of getting a global one. Change-Id: I3997ea7d2c330431379d055b0cb876069bddf395
* Add .clang-format symlink to Brillo's clang-format.Alex Deymo2016-02-161-10/+1
| | | | | | | | | | 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
* Fix UploadService unittests.Alex Deymo2016-02-101-0/+4
| | | | | | | | | | | | | | | 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
* Merge "metricsd: Create a brillo::MessageLoop."Alex Deymo2016-02-042-2/+7
|\
| * metricsd: Create a brillo::MessageLoop.Alex Deymo2016-02-042-2/+7
| | | | | | | | | | | | | | | | | | | | | | 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
* | Unit tests: Compile only on 'eng' builds.Jorge Lucangeli Obes2016-02-041-2/+2
|/ | | | | | | metrics_collector_tests, metricsd_tests. Bug: 26967770 Change-Id: I6d7e8fb6d3d98ab747d922bfeef05aa344b2179c
* crash_reporter: Fix paths for kernel panic collectionSteve Fung2016-02-021-1/+2
| | | | | | | | | Fix the paths to the pstore mount and run data within the kernel collector. BUG=26774830 Change-Id: I68be0a28201cb73c3420166b2f4da77a1e586ca2
* metricsd: Removing brillo::Any from weaved's public APIsAlex Vakulenko2016-01-287-54/+10
| | | | | | | | | | 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
* Add BinPackArguments: false to .clang-formatAlex Deymo2016-01-251-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | 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
* metricsd: Add more assert clause.Bertrand SIMONNET2016-01-222-0/+5
| | | | | | | | | | | | | 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
* libmetrics: Update BASE_VERS to 369476Alex Vakulenko2016-01-201-1/+1
| | | | | | This is needed to uprev everything on ChromeOS side Change-Id: I070e374dd4abe92884b88231ba60c82b69c72806
* crash_reporter/metricsd: Update libchrome APIs to r369476Alex Vakulenko2016-01-204-13/+17
| | | | | | | The new libchrome has been ported from Chromium and some APIs have changed. Make necessary changes at call sites. Change-Id: I9e45975cdef43913270b82e3fca2c027e614a464
* metricsd: Add tests to the default debug build.Bertrand SIMONNET2016-01-191-0/+6
| | | | | | | | 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.
* metricsd: Persist metrics on shutdown.Bertrand SIMONNET2016-01-191-0/+1
| | | | | | | | | | | 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
* metricsd: Persist the metrics to disk periodically.Bertrand SIMONNET2016-01-127-40/+170
| | | | | | | | | | | | | | | | | | 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
* metricsd: Cleanup on TERM signal.Bertrand SIMONNET2016-01-129-48/+141
| | | | | | | | | | | | | 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
* metricsd: Split out the trait name from the command nameAlex Vakulenko2016-01-081-8/+6
| | | | | | | | weaved::Service::AddCommandHandler() and SetStateProperty() now expect the trait name as a separate argument. BUG: 26443877 Change-Id: I2ad587d984375a7ebd70c7dc804b446b66d6be1b
* metrics: Switch to use Binder interface to weavedAlex Vakulenko2016-01-072-37/+54
| | | | | | | | Now that weaved provides a binder interface for its IPC, switch to using it instead. BUG: 23782171 Change-Id: Ic3c485f99580fe41e287eaf238f033149787f181
* Merge "Fix documentation."Bertrand Simonnet2016-01-073-170/+147
|\
| * Fix documentation.Bertrand SIMONNET2016-01-063-170/+147
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | Use specific users for metricsd/metrics_collector.Jorge Lucangeli Obes2016-01-062-6/+6
|/ | | | | | | | | | | | | /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
* metrics_collector: Fix build of testsTodd Poynor2016-01-051-2/+2
| | | | | | | | | 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
* Remove metrics collector service trampolineTodd Poynor2016-01-056-134/+29
| | | | | | | | | | | | | | | 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
* Disable RTTI in crash_reporter and metricsdAlex Vakulenko2016-01-041-4/+0
| | | | | | | | There is no longer a reliance on RTTI in libbrillo, so disable RTTI in the rest of Brillo codebase. Bug: 26292405 Change-Id: I2751a2ac973a74741a82f5cd949fc0adaf2449a6
* metricsd: Replace scoped_ptr with unique_ptr.Bertrand SIMONNET2015-12-2211-53/+58
| | | | | | | | | scoped_ptr are a chromism. We should use unique_ptr instead. Bug: 25958769 Test: unit tests. Change-Id: Ie23ae2ef42f66dcc76f45a9dafa66c8ceb0a2d90
* Fix metricsd to conform to the lastest server schemaAlex Vakulenko2015-12-162-8/+10
| | | | | | | | | | 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
* metrics_collector: add libmetricscollectorservice binder serviceTodd Poynor2015-12-1011-117/+345
| | | | | | | | | | | | | | 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
* Merge "metricsd binder: Abort if fail to register service"Todd Poynor2015-12-101-2/+6
|\
| * metricsd binder: Abort if fail to register serviceTodd Poynor2015-12-091-2/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | metricsd: Update to use new component/trait APIs from weavedAlex Vakulenko2015-12-095-35/+32
|/ | | | | | | | | Removed command and state definitions and use trait definitions instead. Also, create "metrics" component for weave. BUG: 25916429, 25916428, 25917426 Change-Id: Icc02d1c46c371d3afa8e4723852f182992c62bf2
* metricsd: Remove unused type declarationsAlex Vakulenko2015-12-081-2/+0
| | | | | BUG: 26092352 Change-Id: If0dda4c171a2b62291693db49c1e16499fc10f5a
* metricsd: Allows introspecting the metrics.Bertrand SIMONNET2015-12-046-3/+50
| | | | | | | | | | | | | | | | | | | | | | | | | 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
* metrics: Remove user action logic.Bertrand SIMONNET2015-12-046-52/+1
| | | | | | | User actions are no longer reported anywhere, we can remove the logic. Bug: 25818567 Change-Id: Ie8fee841bda6503a3f5781d73b0f879babe99b03
* metricsd: Log over binder.Bertrand SIMONNET2015-12-0322-1155/+487
| | | | | | | | | This CL converts metricsd, libmetrics and metrics_collector to use Binder to pass metrics samples. Bug: 25670685 Change-Id: I657faecdf4ed1226ab30ce69e062028463437e7b
* metricsd: Add clang format config.Bertrand SIMONNET2015-12-021-0/+9
| | | | | | | | | | 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
* metricsd: Use different directories for each daemon.Bertrand SIMONNET2015-11-3013-66/+101
| | | | | | | | | | | | | | | | | | | | 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
* metricsd: Specify directory for persistent integers.Bertrand SIMONNET2015-11-309-92/+63
| | | | | | | | | | 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
* metricsd: Split into two daemons.Bertrand SIMONNET2015-11-1814-288/+335
| | | | | | | | | | | | | | | | | | | | 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
* metricsd: Don't upload if product id is empty.Bertrand SIMONNET2015-11-173-1/+14
| | | | | | | | | 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.
* metricsd: Remove dead code.Bertrand SIMONNET2015-11-134-123/+0
| | | | | | | | | We don't report the cpu frequency, we can remove that part of the code. Bug: 25693224 Test: unit tests. Change-Id: I510654a74261dbd66b7183ea54eef1e1eadc4d91
* metricsd: Fix the update channel parsing logic.Bertrand SIMONNET2015-11-122-6/+6
| | | | | | | | | | | | | 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
* metricsd: Fix logging initialization.Bertrand SIMONNET2015-11-102-5/+20
| | | | | | | | | | 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
* metricsd: add SendBoolToUMA to metrics interfaceNathan Bullock2015-11-063-0/+12
| | | | | Bug: 25561571 Change-Id: I698d2408e2f462865f6512b7be17ff0851a1f97c