blob: ffd83ba978f4badedae54619eb3679f393832bcf [file] [log] [blame]
Yao Chenab273e22017-09-06 12:53:50 -07001/*
2 * Copyright (C) 2017 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
Yao Chenab273e22017-09-06 12:53:50 -070016
Yangster-mac20877162017-12-22 17:19:39 -080017#pragma once
18
19#include <gtest/gtest_prod.h>
Joe Onorato9fc9edf2017-10-15 20:08:52 -070020#include "config/ConfigListener.h"
Jonathan Nguyen703c42f2020-02-04 15:54:26 -080021#include "logd/LogEvent.h"
Yao Chen44cf27c2017-09-14 22:32:50 -070022#include "metrics/MetricsManager.h"
Joe Onorato9fc9edf2017-10-15 20:08:52 -070023#include "packages/UidMap.h"
Chenjie Yufa22d652018-02-05 14:37:48 -080024#include "external/StatsPullerManager.h"
Joe Onorato9fc9edf2017-10-15 20:08:52 -070025
26#include "frameworks/base/cmds/statsd/src/statsd_config.pb.h"
Jeffrey Huangb8f54032020-03-23 13:42:42 -070027#include "frameworks/base/cmds/statsd/src/statsd_metadata.pb.h"
Yao Chenab273e22017-09-06 12:53:50 -070028
Yao Chen44cf27c2017-09-14 22:32:50 -070029#include <stdio.h>
David Chen0656b7a2017-09-13 15:53:39 -070030#include <unordered_map>
31
Bookatz906a35c2017-09-20 15:26:44 -070032namespace android {
33namespace os {
34namespace statsd {
Yao Chenab273e22017-09-06 12:53:50 -070035
Chenjie Yue36018b2018-04-16 15:18:30 -070036
Tej Singh9ec159a2019-11-14 11:59:48 -080037class StatsLogProcessor : public ConfigListener, public virtual PackageInfoListener {
Yao Chenab273e22017-09-06 12:53:50 -070038public:
Chenjie Yue2219202018-06-08 10:07:51 -070039 StatsLogProcessor(const sp<UidMap>& uidMap, const sp<StatsPullerManager>& pullerManager,
40 const sp<AlarmMonitor>& anomalyAlarmMonitor,
Yangster-mac932ecec2018-02-01 10:23:52 -080041 const sp<AlarmMonitor>& subscriberTriggerAlarmMonitor,
Yangster-mac15f6bbc2018-04-08 11:52:26 -070042 const int64_t timeBaseNs,
Tej Singh6ede28b2019-01-29 17:06:54 -080043 const std::function<bool(const ConfigKey&)>& sendBroadcast,
44 const std::function<bool(const int&,
45 const vector<int64_t>&)>& sendActivationBroadcast);
Yao Chenab273e22017-09-06 12:53:50 -070046 virtual ~StatsLogProcessor();
47
Yangster-macd40053e2018-01-09 16:29:22 -080048 void OnLogEvent(LogEvent* event);
Yao Chenab273e22017-09-06 12:53:50 -070049
Yangster-macc04feba2018-04-02 14:37:33 -070050 void OnConfigUpdated(const int64_t timestampNs, const ConfigKey& key,
51 const StatsdConfig& config);
Joe Onorato9fc9edf2017-10-15 20:08:52 -070052 void OnConfigRemoved(const ConfigKey& key);
David Chen0656b7a2017-09-13 15:53:39 -070053
Yangster7c334a12017-11-22 14:24:24 -080054 size_t GetMetricsSize(const ConfigKey& key) const;
55
Tej Singh6ede28b2019-01-29 17:06:54 -080056 void GetActiveConfigs(const int uid, vector<int64_t>& outActiveConfigs);
57
Yangster-mace68f3a52018-04-04 00:01:43 -070058 void onDumpReport(const ConfigKey& key, const int64_t dumpTimeNs,
Bookatzff71cad2018-09-20 17:17:49 -070059 const bool include_current_partial_bucket, const bool erase_data,
Muhammad Qureshi3a5ebf52019-03-28 12:38:21 -070060 const DumpReportReason dumpReportReason,
Olivier Gaillard6c75ecd2019-02-20 09:57:33 +000061 const DumpLatency dumpLatency,
62 vector<uint8_t>* outData);
Bookatzff71cad2018-09-20 17:17:49 -070063 void onDumpReport(const ConfigKey& key, const int64_t dumpTimeNs,
64 const bool include_current_partial_bucket, const bool erase_data,
Olivier Gaillard6c75ecd2019-02-20 09:57:33 +000065 const DumpReportReason dumpReportReason,
66 const DumpLatency dumpLatency,
67 ProtoOutputStream* proto);
Bookatzcc5adef22017-11-21 14:36:23 -080068
Yangster-mac932ecec2018-02-01 10:23:52 -080069 /* Tells MetricsManager that the alarms in alarmSet have fired. Modifies anomaly alarmSet. */
Yangster-mace2cd6d52017-11-09 20:38:30 -080070 void onAnomalyAlarmFired(
Yangster-macb142cc82018-03-30 15:22:08 -070071 const int64_t& timestampNs,
Yangster-mac932ecec2018-02-01 10:23:52 -080072 unordered_set<sp<const InternalAlarm>, SpHash<InternalAlarm>> alarmSet);
73
74 /* Tells MetricsManager that the alarms in alarmSet have fired. Modifies periodic alarmSet. */
75 void onPeriodicAlarmFired(
Yangster-macb142cc82018-03-30 15:22:08 -070076 const int64_t& timestampNs,
Yangster-mac932ecec2018-02-01 10:23:52 -080077 unordered_set<sp<const InternalAlarm>, SpHash<InternalAlarm>> alarmSet);
yro31eb67b2017-10-24 13:33:21 -070078
yro947fbce2017-11-15 22:50:23 -080079 /* Flushes data to disk. Data on memory will be gone after written to disk. */
Olivier Gaillard6c75ecd2019-02-20 09:57:33 +000080 void WriteDataToDisk(const DumpReportReason dumpReportReason,
81 const DumpLatency dumpLatency);
Yangster-mac892f3d32018-05-02 14:16:48 -070082
Muhammad Qureshi844694b2019-04-05 10:10:40 -070083 /* Persist configs containing metrics with active activations to disk. */
84 void SaveActiveConfigsToDisk(int64_t currentTimeNs);
Chenjie Yuc7939cb2019-02-04 17:25:45 -080085
Tej Singhf53d4452019-05-09 18:17:59 -070086 /* Writes the current active status/ttl for all configs and metrics to ProtoOutputStream. */
87 void WriteActiveConfigsToProtoOutputStream(
88 int64_t currentTimeNs, const DumpReportReason reason, ProtoOutputStream* proto);
89
Muhammad Qureshi844694b2019-04-05 10:10:40 -070090 /* Load configs containing metrics with active activations from disk. */
91 void LoadActiveConfigsFromDisk();
Chenjie Yuc7939cb2019-02-04 17:25:45 -080092
Jeffrey Huangb8f54032020-03-23 13:42:42 -070093 /* Persist metadata for configs and metrics to disk. */
94 void SaveMetadataToDisk(int64_t currentWallClockTimeNs, int64_t systemElapsedTimeNs);
95
96 /* Writes the statsd metadata for all configs and metrics to StatsMetadataList. */
97 void WriteMetadataToProto(int64_t currentWallClockTimeNs,
98 int64_t systemElapsedTimeNs,
99 metadata::StatsMetadataList* metadataList);
100
Jeffrey Huang475677e2020-03-30 19:52:07 -0700101 /* Load stats metadata for configs and metrics from disk. */
102 void LoadMetadataFromDisk(int64_t currentWallClockTimeNs,
103 int64_t systemElapsedTimeNs);
104
105 /* Sets the metadata for all configs and metrics */
106 void SetMetadataState(const metadata::StatsMetadataList& statsMetadataList,
107 int64_t currentWallClockTimeNs,
108 int64_t systemElapsedTimeNs);
109
Tej Singhf53d4452019-05-09 18:17:59 -0700110 /* Sets the active status/ttl for all configs and metrics to the status in ActiveConfigList. */
111 void SetConfigsActiveState(const ActiveConfigList& activeConfigList, int64_t currentTimeNs);
112
Tej Singh9ec159a2019-11-14 11:59:48 -0800113 /* Notify all MetricsManagers of app upgrades */
114 void notifyAppUpgrade(const int64_t& eventTimeNs, const string& apk, const int uid,
115 const int64_t version) override;
116
117 /* Notify all MetricsManagers of app removals */
118 void notifyAppRemoved(const int64_t& eventTimeNs, const string& apk, const int uid) override;
119
120 /* Notify all MetricsManagers of uid map snapshots received */
121 void onUidMapReceived(const int64_t& eventTimeNs) override;
122
Tej Singhe678cb72020-04-14 16:23:30 -0700123 /* Notify all metrics managers of boot completed
124 * This will force a bucket split when the boot is finished.
125 */
126 void onStatsdInitCompleted(const int64_t& elapsedTimeNs);
127
Yangster-mac892f3d32018-05-02 14:16:48 -0700128 // Reset all configs.
129 void resetConfigs();
yro947fbce2017-11-15 22:50:23 -0800130
Yangster-macb5bc7412018-01-06 23:17:45 -0800131 inline sp<UidMap> getUidMap() {
132 return mUidMap;
133 }
134
Yao Chena80e5c02018-09-04 13:55:29 -0700135 void dumpStates(int outFd, bool verbose);
Yao Chen884c8c12018-01-26 10:36:25 -0800136
Yangster-mac15f6bbc2018-04-08 11:52:26 -0700137 void informPullAlarmFired(const int64_t timestampNs);
Yangster-macb142cc82018-03-30 15:22:08 -0700138
David Chend37bc232018-04-12 18:05:11 -0700139 int64_t getLastReportTimeNs(const ConfigKey& key);
140
Yao Chen876889c2018-05-02 11:16:16 -0700141 inline void setPrintLogs(bool enabled) {
142#ifdef VERY_VERBOSE_PRINTING
143 std::lock_guard<std::mutex> lock(mMetricsMutex);
144 mPrintAllLogs = enabled;
145#endif
146 }
147
David Chen48944902018-05-03 10:29:11 -0700148 // Add a specific config key to the possible configs to dump ASAP.
149 void noteOnDiskData(const ConfigKey& key);
150
Yao Chenab273e22017-09-06 12:53:50 -0700151private:
Yangster-macbe10ddf2018-03-13 15:39:51 -0700152 // For testing only.
153 inline sp<AlarmMonitor> getAnomalyAlarmMonitor() const {
154 return mAnomalyAlarmMonitor;
155 }
156
Yangster-mac684d1952018-03-24 16:47:16 -0700157 inline sp<AlarmMonitor> getPeriodicAlarmMonitor() const {
158 return mPeriodicAlarmMonitor;
159 }
160
Yangster-macb0d06282018-01-05 15:44:07 -0800161 mutable mutex mMetricsMutex;
David Chen1d7b0cd2017-11-15 14:20:04 -0800162
Yao Chend10f7b12017-12-18 12:53:50 -0800163 std::unordered_map<ConfigKey, sp<MetricsManager>> mMetricsManagers;
David Chende701692017-10-05 13:16:02 -0700164
Tej Singh5a801c82019-11-01 10:45:22 -0700165 std::unordered_map<ConfigKey, int64_t> mLastBroadcastTimes;
yro69007c82017-10-26 20:42:57 -0700166
Tej Singh6ede28b2019-01-29 17:06:54 -0800167 // Last time we sent a broadcast to this uid that the active configs had changed.
Tej Singh5a801c82019-11-01 10:45:22 -0700168 std::unordered_map<int, int64_t> mLastActivationBroadcastTimes;
Tej Singh6ede28b2019-01-29 17:06:54 -0800169
David Chend9269e22017-12-05 13:43:51 -0800170 // Tracks when we last checked the bytes consumed for each config key.
Tej Singh5a801c82019-11-01 10:45:22 -0700171 std::unordered_map<ConfigKey, int64_t> mLastByteSizeTimes;
David Chend9269e22017-12-05 13:43:51 -0800172
David Chen48944902018-05-03 10:29:11 -0700173 // Tracks which config keys has metric reports on disk
174 std::set<ConfigKey> mOnDiskDataConfigs;
175
Joe Onorato9fc9edf2017-10-15 20:08:52 -0700176 sp<UidMap> mUidMap; // Reference to the UidMap to lookup app name and version for each uid.
yro31eb67b2017-10-24 13:33:21 -0700177
Chenjie Yue2219202018-06-08 10:07:51 -0700178 sp<StatsPullerManager> mPullerManager; // Reference to StatsPullerManager
Chenjie Yufa22d652018-02-05 14:37:48 -0800179
Yangster-mac932ecec2018-02-01 10:23:52 -0800180 sp<AlarmMonitor> mAnomalyAlarmMonitor;
181
182 sp<AlarmMonitor> mPeriodicAlarmMonitor;
Yangster-mace2cd6d52017-11-09 20:38:30 -0800183
Tej Singh480392f2019-10-23 15:53:46 -0700184 void OnLogEvent(LogEvent* event, int64_t elapsedRealtimeNs);
185
Yangster-macb142cc82018-03-30 15:22:08 -0700186 void resetIfConfigTtlExpiredLocked(const int64_t timestampNs);
187
188 void OnConfigUpdatedLocked(
189 const int64_t currentTimestampNs, const ConfigKey& key, const StatsdConfig& config);
190
Tej Singh6ede28b2019-01-29 17:06:54 -0800191 void GetActiveConfigsLocked(const int uid, vector<int64_t>& outActiveConfigs);
192
Tej Singhf53d4452019-05-09 18:17:59 -0700193 void WriteActiveConfigsToProtoOutputStreamLocked(
194 int64_t currentTimeNs, const DumpReportReason reason, ProtoOutputStream* proto);
195
196 void SetConfigsActiveStateLocked(const ActiveConfigList& activeConfigList,
197 int64_t currentTimeNs);
198
Jeffrey Huang475677e2020-03-30 19:52:07 -0700199 void SetMetadataStateLocked(const metadata::StatsMetadataList& statsMetadataList,
200 int64_t currentWallClockTimeNs,
201 int64_t systemElapsedTimeNs);
202
Jeffrey Huangb8f54032020-03-23 13:42:42 -0700203 void WriteMetadataToProtoLocked(int64_t currentWallClockTimeNs,
204 int64_t systemElapsedTimeNs,
205 metadata::StatsMetadataList* metadataList);
206
Olivier Gaillard6c75ecd2019-02-20 09:57:33 +0000207 void WriteDataToDiskLocked(const DumpReportReason dumpReportReason,
208 const DumpLatency dumpLatency);
Jeffrey Huangb8f54032020-03-23 13:42:42 -0700209
Yangster-mac892f3d32018-05-02 14:16:48 -0700210 void WriteDataToDiskLocked(const ConfigKey& key, const int64_t timestampNs,
Olivier Gaillard6c75ecd2019-02-20 09:57:33 +0000211 const DumpReportReason dumpReportReason,
212 const DumpLatency dumpLatency);
Yangster-mace68f3a52018-04-04 00:01:43 -0700213
Yao Chen9a43b4f2019-04-10 10:43:20 -0700214 void onConfigMetricsReportLocked(
215 const ConfigKey& key, const int64_t dumpTimeStampNs,
216 const bool include_current_partial_bucket, const bool erase_data,
217 const DumpReportReason dumpReportReason, const DumpLatency dumpLatency,
218 /*if dataSavedToDisk is true, it indicates the caller will write the data to disk
219 (e.g., before reboot). So no need to further persist local history.*/
220 const bool dataSavedToDisk, vector<uint8_t>* proto);
Yangster-mac86179502018-01-23 15:47:15 -0800221
David Chen1d7b0cd2017-11-15 14:20:04 -0800222 /* Check if we should send a broadcast if approaching memory limits and if we're over, we
223 * actually delete the data. */
Tej Singh480392f2019-10-23 15:53:46 -0700224 void flushIfNecessaryLocked(const ConfigKey& key, MetricsManager& metricsManager);
yro31eb67b2017-10-24 13:33:21 -0700225
Yangster-macd40053e2018-01-09 16:29:22 -0800226 // Maps the isolated uid in the log event to host uid if the log event contains uid fields.
227 void mapIsolatedUidToHostUidIfNecessaryLocked(LogEvent* event) const;
228
229 // Handler over the isolated uid change event.
230 void onIsolatedUidChangedEventLocked(const LogEvent& event);
231
Jonathan Nguyena0e6de12020-01-28 18:33:55 -0800232 // Handler over the binary push state changed event.
233 void onBinaryPushStateChangedEventLocked(LogEvent* event);
234
Jonathan Nguyen703c42f2020-02-04 15:54:26 -0800235 // Handler over the watchdog rollback occurred event.
236 void onWatchdogRollbackOccurredLocked(LogEvent* event);
237
Jonathan Nguyena0e6de12020-01-28 18:33:55 -0800238 // Updates train info on disk based on binary push state changed info and
239 // write disk info into parameters.
Jonathan Nguyen703c42f2020-02-04 15:54:26 -0800240 void getAndUpdateTrainInfoOnDisk(bool is_rollback, InstallTrainInfo* trainInfoIn);
241
242 // Gets experiment ids on disk for associated train and updates them
243 // depending on rollback type. Then writes them back to disk and returns
244 // them.
245 std::vector<int64_t> processWatchdogRollbackOccurred(const int32_t rollbackTypeIn,
246 const string& packageName);
Jonathan Nguyena0e6de12020-01-28 18:33:55 -0800247
Yangster-mac892f3d32018-05-02 14:16:48 -0700248 // Reset all configs.
249 void resetConfigsLocked(const int64_t timestampNs);
250 // Reset the specified configs.
Yao Chen163d2602018-04-10 10:39:53 -0700251 void resetConfigsLocked(const int64_t timestampNs, const std::vector<ConfigKey>& configs);
252
David Chen1d7b0cd2017-11-15 14:20:04 -0800253 // Function used to send a broadcast so that receiver for the config key can call getData
254 // to retrieve the stored data.
David Chen48944902018-05-03 10:29:11 -0700255 std::function<bool(const ConfigKey& key)> mSendBroadcast;
yro69007c82017-10-26 20:42:57 -0700256
Tej Singh6ede28b2019-01-29 17:06:54 -0800257 // Function used to send a broadcast so that receiver can be notified of which configs
258 // are currently active.
259 std::function<bool(const int& uid, const vector<int64_t>& configIds)> mSendActivationBroadcast;
260
Yangster-mac15f6bbc2018-04-08 11:52:26 -0700261 const int64_t mTimeBaseNs;
Chenjie Yu85ed8382017-12-14 16:48:54 -0800262
Yao Chen163d2602018-04-10 10:39:53 -0700263 // Largest timestamp of the events that we have processed.
264 int64_t mLargestTimestampSeen = 0;
265
266 int64_t mLastTimestampSeen = 0;
267
Tej Singh5a801c82019-11-01 10:45:22 -0700268 int64_t mLastPullerCacheClearTimeSec = 0;
Chenjie Yufa22d652018-02-05 14:37:48 -0800269
Tej Singh42f9e062018-11-09 10:01:00 -0800270 // Last time we wrote data to disk.
271 int64_t mLastWriteTimeNs = 0;
272
jianjin996f40d2019-03-29 13:53:48 -0700273 // Last time we wrote active metrics to disk.
274 int64_t mLastActiveMetricsWriteNs = 0;
275
Jeffrey Huangb8f54032020-03-23 13:42:42 -0700276 //Last time we wrote metadata to disk.
277 int64_t mLastMetadataWriteNs = 0;
278
Yao Chen876889c2018-05-02 11:16:16 -0700279#ifdef VERY_VERBOSE_PRINTING
280 bool mPrintAllLogs = false;
281#endif
282
Yao Chen163d2602018-04-10 10:39:53 -0700283 FRIEND_TEST(StatsLogProcessorTest, TestOutOfOrderLogs);
David Chend9269e22017-12-05 13:43:51 -0800284 FRIEND_TEST(StatsLogProcessorTest, TestRateLimitByteSize);
285 FRIEND_TEST(StatsLogProcessorTest, TestRateLimitBroadcast);
286 FRIEND_TEST(StatsLogProcessorTest, TestDropWhenByteSizeTooLarge);
Chenjie Yuc7939cb2019-02-04 17:25:45 -0800287 FRIEND_TEST(StatsLogProcessorTest, TestActiveConfigMetricDiskWriteRead);
Chenjie Yua9a310e2019-02-06 13:40:10 -0800288 FRIEND_TEST(StatsLogProcessorTest, TestActivationOnBoot);
Muhammad Qureshi844694b2019-04-05 10:10:40 -0700289 FRIEND_TEST(StatsLogProcessorTest, TestActivationOnBootMultipleActivations);
Muhammad Qureshi15f8da92019-04-05 10:10:40 -0700290 FRIEND_TEST(StatsLogProcessorTest,
291 TestActivationOnBootMultipleActivationsDifferentActivationTypes);
Tej Singhf53d4452019-05-09 18:17:59 -0700292 FRIEND_TEST(StatsLogProcessorTest, TestActivationsPersistAcrossSystemServerRestart);
Chenjie Yuc7939cb2019-02-04 17:25:45 -0800293
Yao Chen8a8d16c2018-02-08 14:50:40 -0800294 FRIEND_TEST(WakelockDurationE2eTest, TestAggregatedPredicateDimensionsForSumDuration1);
295 FRIEND_TEST(WakelockDurationE2eTest, TestAggregatedPredicateDimensionsForSumDuration2);
296 FRIEND_TEST(WakelockDurationE2eTest, TestAggregatedPredicateDimensionsForSumDuration3);
297 FRIEND_TEST(WakelockDurationE2eTest, TestAggregatedPredicateDimensionsForMaxDuration1);
298 FRIEND_TEST(WakelockDurationE2eTest, TestAggregatedPredicateDimensionsForMaxDuration2);
299 FRIEND_TEST(WakelockDurationE2eTest, TestAggregatedPredicateDimensionsForMaxDuration3);
300 FRIEND_TEST(MetricConditionLinkE2eTest, TestMultiplePredicatesAndLinks1);
301 FRIEND_TEST(MetricConditionLinkE2eTest, TestMultiplePredicatesAndLinks2);
Yangster-mace06cfd72018-03-10 23:22:59 -0800302 FRIEND_TEST(AttributionE2eTest, TestAttributionMatchAndSliceByFirstUid);
303 FRIEND_TEST(AttributionE2eTest, TestAttributionMatchAndSliceByChain);
Yangster-mac87718e22018-01-11 16:16:26 -0800304 FRIEND_TEST(GaugeMetricE2eTest, TestMultipleFieldsForPushedEvent);
Yangster-mac15f6bbc2018-04-08 11:52:26 -0700305 FRIEND_TEST(GaugeMetricE2eTest, TestRandomSamplePulledEvents);
306 FRIEND_TEST(GaugeMetricE2eTest, TestRandomSamplePulledEvent_LateAlarm);
Tej Singh597c7162019-04-17 16:41:45 -0700307 FRIEND_TEST(GaugeMetricE2eTest, TestRandomSamplePulledEventsWithActivation);
308 FRIEND_TEST(GaugeMetricE2eTest, TestRandomSamplePulledEventsNoCondition);
Yangster-mac32f07af2018-10-13 17:08:11 -0700309 FRIEND_TEST(GaugeMetricE2eTest, TestConditionChangeToTrueSamplePulledEvents);
Yangster-mac15f6bbc2018-04-08 11:52:26 -0700310 FRIEND_TEST(ValueMetricE2eTest, TestPulledEvents);
311 FRIEND_TEST(ValueMetricE2eTest, TestPulledEvents_LateAlarm);
Tej Singh597c7162019-04-17 16:41:45 -0700312 FRIEND_TEST(ValueMetricE2eTest, TestPulledEvents_WithActivation);
Yangster-mac15f6bbc2018-04-08 11:52:26 -0700313
Yangster-macbe10ddf2018-03-13 15:39:51 -0700314 FRIEND_TEST(AnomalyDetectionE2eTest, TestSlicedCountMetric_single_bucket);
315 FRIEND_TEST(AnomalyDetectionE2eTest, TestSlicedCountMetric_multiple_buckets);
Jeffrey Huangb8f54032020-03-23 13:42:42 -0700316 FRIEND_TEST(AnomalyDetectionE2eTest, TestCountMetric_save_refractory_to_disk_no_data_written);
317 FRIEND_TEST(AnomalyDetectionE2eTest, TestCountMetric_save_refractory_to_disk);
Jeffrey Huang475677e2020-03-30 19:52:07 -0700318 FRIEND_TEST(AnomalyDetectionE2eTest, TestCountMetric_load_refractory_from_disk);
Yangster-macbe10ddf2018-03-13 15:39:51 -0700319 FRIEND_TEST(AnomalyDetectionE2eTest, TestDurationMetric_SUM_single_bucket);
320 FRIEND_TEST(AnomalyDetectionE2eTest, TestDurationMetric_SUM_multiple_buckets);
321 FRIEND_TEST(AnomalyDetectionE2eTest, TestDurationMetric_SUM_long_refractory_period);
Yangster-macb142cc82018-03-30 15:22:08 -0700322
Yangster-mac684d1952018-03-24 16:47:16 -0700323 FRIEND_TEST(AlarmE2eTest, TestMultipleAlarms);
Yangster-macb142cc82018-03-30 15:22:08 -0700324 FRIEND_TEST(ConfigTtlE2eTest, TestCountMetric);
Yangster-mac849dfdc22018-10-12 15:41:45 -0700325 FRIEND_TEST(MetricActivationE2eTest, TestCountMetric);
Muhammad Qureshi3a5ebf52019-03-28 12:38:21 -0700326 FRIEND_TEST(MetricActivationE2eTest, TestCountMetricWithOneDeactivation);
327 FRIEND_TEST(MetricActivationE2eTest, TestCountMetricWithTwoDeactivations);
Tej Singhee4495e2019-06-03 18:37:35 -0700328 FRIEND_TEST(MetricActivationE2eTest, TestCountMetricWithSameDeactivation);
Muhammad Qureshi3a5ebf52019-03-28 12:38:21 -0700329 FRIEND_TEST(MetricActivationE2eTest, TestCountMetricWithTwoMetricsTwoDeactivations);
Muhammad Qureshi18e46922019-05-24 16:38:49 -0700330
tsaichristine69000e62019-10-18 17:34:52 -0700331 FRIEND_TEST(CountMetricE2eTest, TestSlicedState);
332 FRIEND_TEST(CountMetricE2eTest, TestSlicedStateWithMap);
333 FRIEND_TEST(CountMetricE2eTest, TestMultipleSlicedStates);
334 FRIEND_TEST(CountMetricE2eTest, TestSlicedStateWithPrimaryFields);
tsaichristined21aacf2019-10-07 14:47:38 -0700335
Muhammad Qureshi18e46922019-05-24 16:38:49 -0700336 FRIEND_TEST(DurationMetricE2eTest, TestOneBucket);
337 FRIEND_TEST(DurationMetricE2eTest, TestTwoBuckets);
338 FRIEND_TEST(DurationMetricE2eTest, TestWithActivation);
339 FRIEND_TEST(DurationMetricE2eTest, TestWithCondition);
340 FRIEND_TEST(DurationMetricE2eTest, TestWithSlicedCondition);
341 FRIEND_TEST(DurationMetricE2eTest, TestWithActivationAndSlicedCondition);
tsaichristine1449fa42020-01-02 12:12:05 -0800342 FRIEND_TEST(DurationMetricE2eTest, TestWithSlicedState);
343 FRIEND_TEST(DurationMetricE2eTest, TestWithConditionAndSlicedState);
344 FRIEND_TEST(DurationMetricE2eTest, TestWithSlicedStateMapped);
345 FRIEND_TEST(DurationMetricE2eTest, TestSlicedStatePrimaryFieldsNotSubsetDimInWhat);
346 FRIEND_TEST(DurationMetricE2eTest, TestWithSlicedStatePrimaryFieldsSubset);
tsaichristinec876b492019-12-10 13:47:05 -0800347
348 FRIEND_TEST(ValueMetricE2eTest, TestInitWithSlicedState);
349 FRIEND_TEST(ValueMetricE2eTest, TestInitWithSlicedState_WithDimensions);
350 FRIEND_TEST(ValueMetricE2eTest, TestInitWithSlicedState_WithIncorrectDimensions);
Yao Chenab273e22017-09-06 12:53:50 -0700351};
Bookatz906a35c2017-09-20 15:26:44 -0700352
Yao Chenef99c4f2017-09-22 16:26:54 -0700353} // namespace statsd
354} // namespace os
355} // namespace android