blob: 08f46688bbbaa99f38a842b652365b2ac7309adc [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 periodic alarmSet. */
70 void onPeriodicAlarmFired(
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);
yro31eb67b2017-10-24 13:33:21 -070073
yro947fbce2017-11-15 22:50:23 -080074 /* Flushes data to disk. Data on memory will be gone after written to disk. */
Olivier Gaillard6c75ecd2019-02-20 09:57:33 +000075 void WriteDataToDisk(const DumpReportReason dumpReportReason,
76 const DumpLatency dumpLatency);
Yangster-mac892f3d32018-05-02 14:16:48 -070077
Muhammad Qureshi844694b2019-04-05 10:10:40 -070078 /* Persist configs containing metrics with active activations to disk. */
79 void SaveActiveConfigsToDisk(int64_t currentTimeNs);
Chenjie Yuc7939cb2019-02-04 17:25:45 -080080
Tej Singhf53d4452019-05-09 18:17:59 -070081 /* Writes the current active status/ttl for all configs and metrics to ProtoOutputStream. */
82 void WriteActiveConfigsToProtoOutputStream(
83 int64_t currentTimeNs, const DumpReportReason reason, ProtoOutputStream* proto);
84
Muhammad Qureshi844694b2019-04-05 10:10:40 -070085 /* Load configs containing metrics with active activations from disk. */
86 void LoadActiveConfigsFromDisk();
Chenjie Yuc7939cb2019-02-04 17:25:45 -080087
Jeffrey Huangb8f54032020-03-23 13:42:42 -070088 /* Persist metadata for configs and metrics to disk. */
89 void SaveMetadataToDisk(int64_t currentWallClockTimeNs, int64_t systemElapsedTimeNs);
90
91 /* Writes the statsd metadata for all configs and metrics to StatsMetadataList. */
92 void WriteMetadataToProto(int64_t currentWallClockTimeNs,
93 int64_t systemElapsedTimeNs,
94 metadata::StatsMetadataList* metadataList);
95
Jeffrey Huang475677e2020-03-30 19:52:07 -070096 /* Load stats metadata for configs and metrics from disk. */
97 void LoadMetadataFromDisk(int64_t currentWallClockTimeNs,
98 int64_t systemElapsedTimeNs);
99
100 /* Sets the metadata for all configs and metrics */
101 void SetMetadataState(const metadata::StatsMetadataList& statsMetadataList,
102 int64_t currentWallClockTimeNs,
103 int64_t systemElapsedTimeNs);
104
Tej Singhf53d4452019-05-09 18:17:59 -0700105 /* Sets the active status/ttl for all configs and metrics to the status in ActiveConfigList. */
106 void SetConfigsActiveState(const ActiveConfigList& activeConfigList, int64_t currentTimeNs);
107
Tej Singh9ec159a2019-11-14 11:59:48 -0800108 /* Notify all MetricsManagers of app upgrades */
109 void notifyAppUpgrade(const int64_t& eventTimeNs, const string& apk, const int uid,
110 const int64_t version) override;
111
112 /* Notify all MetricsManagers of app removals */
113 void notifyAppRemoved(const int64_t& eventTimeNs, const string& apk, const int uid) override;
114
115 /* Notify all MetricsManagers of uid map snapshots received */
116 void onUidMapReceived(const int64_t& eventTimeNs) override;
117
Tej Singhe678cb72020-04-14 16:23:30 -0700118 /* Notify all metrics managers of boot completed
119 * This will force a bucket split when the boot is finished.
120 */
121 void onStatsdInitCompleted(const int64_t& elapsedTimeNs);
122
Yangster-mac892f3d32018-05-02 14:16:48 -0700123 // Reset all configs.
124 void resetConfigs();
yro947fbce2017-11-15 22:50:23 -0800125
Yangster-macb5bc7412018-01-06 23:17:45 -0800126 inline sp<UidMap> getUidMap() {
127 return mUidMap;
128 }
129
Yao Chena80e5c02018-09-04 13:55:29 -0700130 void dumpStates(int outFd, bool verbose);
Yao Chen884c8c12018-01-26 10:36:25 -0800131
Yangster-mac15f6bbc2018-04-08 11:52:26 -0700132 void informPullAlarmFired(const int64_t timestampNs);
Yangster-macb142cc82018-03-30 15:22:08 -0700133
David Chend37bc232018-04-12 18:05:11 -0700134 int64_t getLastReportTimeNs(const ConfigKey& key);
135
Yao Chen876889c2018-05-02 11:16:16 -0700136 inline void setPrintLogs(bool enabled) {
137#ifdef VERY_VERBOSE_PRINTING
138 std::lock_guard<std::mutex> lock(mMetricsMutex);
139 mPrintAllLogs = enabled;
140#endif
141 }
142
David Chen48944902018-05-03 10:29:11 -0700143 // Add a specific config key to the possible configs to dump ASAP.
144 void noteOnDiskData(const ConfigKey& key);
145
Tej Singh8b914c02020-07-14 23:16:24 -0700146 void setAnomalyAlarm(const int64_t timeMillis);
147
148 void cancelAnomalyAlarm();
149
Yao Chenab273e22017-09-06 12:53:50 -0700150private:
Yangster-macbe10ddf2018-03-13 15:39:51 -0700151 // For testing only.
152 inline sp<AlarmMonitor> getAnomalyAlarmMonitor() const {
153 return mAnomalyAlarmMonitor;
154 }
155
Yangster-mac684d1952018-03-24 16:47:16 -0700156 inline sp<AlarmMonitor> getPeriodicAlarmMonitor() const {
157 return mPeriodicAlarmMonitor;
158 }
159
Yangster-macb0d06282018-01-05 15:44:07 -0800160 mutable mutex mMetricsMutex;
David Chen1d7b0cd2017-11-15 14:20:04 -0800161
Tej Singh8b914c02020-07-14 23:16:24 -0700162 // Guards mNextAnomalyAlarmTime. A separate mutex is needed because alarms are set/cancelled
163 // in the onLogEvent code path, which is locked by mMetricsMutex.
164 // DO NOT acquire mMetricsMutex while holding mAnomalyAlarmMutex. This can lead to a deadlock.
165 mutable mutex mAnomalyAlarmMutex;
166
Yao Chend10f7b12017-12-18 12:53:50 -0800167 std::unordered_map<ConfigKey, sp<MetricsManager>> mMetricsManagers;
David Chende701692017-10-05 13:16:02 -0700168
Tej Singh5a801c82019-11-01 10:45:22 -0700169 std::unordered_map<ConfigKey, int64_t> mLastBroadcastTimes;
yro69007c82017-10-26 20:42:57 -0700170
Tej Singh6ede28b2019-01-29 17:06:54 -0800171 // Last time we sent a broadcast to this uid that the active configs had changed.
Tej Singh5a801c82019-11-01 10:45:22 -0700172 std::unordered_map<int, int64_t> mLastActivationBroadcastTimes;
Tej Singh6ede28b2019-01-29 17:06:54 -0800173
David Chend9269e22017-12-05 13:43:51 -0800174 // Tracks when we last checked the bytes consumed for each config key.
Tej Singh5a801c82019-11-01 10:45:22 -0700175 std::unordered_map<ConfigKey, int64_t> mLastByteSizeTimes;
David Chend9269e22017-12-05 13:43:51 -0800176
David Chen48944902018-05-03 10:29:11 -0700177 // Tracks which config keys has metric reports on disk
178 std::set<ConfigKey> mOnDiskDataConfigs;
179
Joe Onorato9fc9edf2017-10-15 20:08:52 -0700180 sp<UidMap> mUidMap; // Reference to the UidMap to lookup app name and version for each uid.
yro31eb67b2017-10-24 13:33:21 -0700181
Chenjie Yue2219202018-06-08 10:07:51 -0700182 sp<StatsPullerManager> mPullerManager; // Reference to StatsPullerManager
Chenjie Yufa22d652018-02-05 14:37:48 -0800183
Yangster-mac932ecec2018-02-01 10:23:52 -0800184 sp<AlarmMonitor> mAnomalyAlarmMonitor;
185
186 sp<AlarmMonitor> mPeriodicAlarmMonitor;
Yangster-mace2cd6d52017-11-09 20:38:30 -0800187
Tej Singh480392f2019-10-23 15:53:46 -0700188 void OnLogEvent(LogEvent* event, int64_t elapsedRealtimeNs);
189
Yangster-macb142cc82018-03-30 15:22:08 -0700190 void resetIfConfigTtlExpiredLocked(const int64_t timestampNs);
191
192 void OnConfigUpdatedLocked(
193 const int64_t currentTimestampNs, const ConfigKey& key, const StatsdConfig& config);
194
Tej Singh6ede28b2019-01-29 17:06:54 -0800195 void GetActiveConfigsLocked(const int uid, vector<int64_t>& outActiveConfigs);
196
Tej Singhf53d4452019-05-09 18:17:59 -0700197 void WriteActiveConfigsToProtoOutputStreamLocked(
198 int64_t currentTimeNs, const DumpReportReason reason, ProtoOutputStream* proto);
199
200 void SetConfigsActiveStateLocked(const ActiveConfigList& activeConfigList,
201 int64_t currentTimeNs);
202
Jeffrey Huang475677e2020-03-30 19:52:07 -0700203 void SetMetadataStateLocked(const metadata::StatsMetadataList& statsMetadataList,
204 int64_t currentWallClockTimeNs,
205 int64_t systemElapsedTimeNs);
206
Jeffrey Huangb8f54032020-03-23 13:42:42 -0700207 void WriteMetadataToProtoLocked(int64_t currentWallClockTimeNs,
208 int64_t systemElapsedTimeNs,
209 metadata::StatsMetadataList* metadataList);
210
Olivier Gaillard6c75ecd2019-02-20 09:57:33 +0000211 void WriteDataToDiskLocked(const DumpReportReason dumpReportReason,
212 const DumpLatency dumpLatency);
Jeffrey Huangb8f54032020-03-23 13:42:42 -0700213
Yangster-mac892f3d32018-05-02 14:16:48 -0700214 void WriteDataToDiskLocked(const ConfigKey& key, const int64_t timestampNs,
Olivier Gaillard6c75ecd2019-02-20 09:57:33 +0000215 const DumpReportReason dumpReportReason,
216 const DumpLatency dumpLatency);
Yangster-mace68f3a52018-04-04 00:01:43 -0700217
Yao Chen9a43b4f2019-04-10 10:43:20 -0700218 void onConfigMetricsReportLocked(
219 const ConfigKey& key, const int64_t dumpTimeStampNs,
220 const bool include_current_partial_bucket, const bool erase_data,
221 const DumpReportReason dumpReportReason, const DumpLatency dumpLatency,
222 /*if dataSavedToDisk is true, it indicates the caller will write the data to disk
223 (e.g., before reboot). So no need to further persist local history.*/
224 const bool dataSavedToDisk, vector<uint8_t>* proto);
Yangster-mac86179502018-01-23 15:47:15 -0800225
David Chen1d7b0cd2017-11-15 14:20:04 -0800226 /* Check if we should send a broadcast if approaching memory limits and if we're over, we
227 * actually delete the data. */
Tej Singh480392f2019-10-23 15:53:46 -0700228 void flushIfNecessaryLocked(const ConfigKey& key, MetricsManager& metricsManager);
yro31eb67b2017-10-24 13:33:21 -0700229
Yangster-macd40053e2018-01-09 16:29:22 -0800230 // Maps the isolated uid in the log event to host uid if the log event contains uid fields.
231 void mapIsolatedUidToHostUidIfNecessaryLocked(LogEvent* event) const;
232
233 // Handler over the isolated uid change event.
234 void onIsolatedUidChangedEventLocked(const LogEvent& event);
235
Jonathan Nguyena0e6de12020-01-28 18:33:55 -0800236 // Handler over the binary push state changed event.
237 void onBinaryPushStateChangedEventLocked(LogEvent* event);
238
Jonathan Nguyen703c42f2020-02-04 15:54:26 -0800239 // Handler over the watchdog rollback occurred event.
240 void onWatchdogRollbackOccurredLocked(LogEvent* event);
241
Jonathan Nguyena0e6de12020-01-28 18:33:55 -0800242 // Updates train info on disk based on binary push state changed info and
243 // write disk info into parameters.
Jonathan Nguyen703c42f2020-02-04 15:54:26 -0800244 void getAndUpdateTrainInfoOnDisk(bool is_rollback, InstallTrainInfo* trainInfoIn);
245
246 // Gets experiment ids on disk for associated train and updates them
247 // depending on rollback type. Then writes them back to disk and returns
248 // them.
249 std::vector<int64_t> processWatchdogRollbackOccurred(const int32_t rollbackTypeIn,
250 const string& packageName);
Jonathan Nguyena0e6de12020-01-28 18:33:55 -0800251
Yangster-mac892f3d32018-05-02 14:16:48 -0700252 // Reset all configs.
253 void resetConfigsLocked(const int64_t timestampNs);
254 // Reset the specified configs.
Yao Chen163d2602018-04-10 10:39:53 -0700255 void resetConfigsLocked(const int64_t timestampNs, const std::vector<ConfigKey>& configs);
256
Tej Singh8b914c02020-07-14 23:16:24 -0700257 // An anomaly alarm should have fired.
258 // Check with anomaly alarm manager to find the alarms and process the result.
259 void informAnomalyAlarmFiredLocked(const int64_t elapsedTimeMillis);
260
261 /* Tells MetricsManager that the alarms in alarmSet have fired. Modifies anomaly alarmSet. */
262 void processFiredAnomalyAlarmsLocked(
263 const int64_t& timestampNs,
264 unordered_set<sp<const InternalAlarm>, SpHash<InternalAlarm>> alarmSet);
265
David Chen1d7b0cd2017-11-15 14:20:04 -0800266 // Function used to send a broadcast so that receiver for the config key can call getData
267 // to retrieve the stored data.
David Chen48944902018-05-03 10:29:11 -0700268 std::function<bool(const ConfigKey& key)> mSendBroadcast;
yro69007c82017-10-26 20:42:57 -0700269
Tej Singh6ede28b2019-01-29 17:06:54 -0800270 // Function used to send a broadcast so that receiver can be notified of which configs
271 // are currently active.
272 std::function<bool(const int& uid, const vector<int64_t>& configIds)> mSendActivationBroadcast;
273
Yangster-mac15f6bbc2018-04-08 11:52:26 -0700274 const int64_t mTimeBaseNs;
Chenjie Yu85ed8382017-12-14 16:48:54 -0800275
Yao Chen163d2602018-04-10 10:39:53 -0700276 // Largest timestamp of the events that we have processed.
277 int64_t mLargestTimestampSeen = 0;
278
279 int64_t mLastTimestampSeen = 0;
280
Tej Singh5a801c82019-11-01 10:45:22 -0700281 int64_t mLastPullerCacheClearTimeSec = 0;
Chenjie Yufa22d652018-02-05 14:37:48 -0800282
Tej Singh42f9e062018-11-09 10:01:00 -0800283 // Last time we wrote data to disk.
284 int64_t mLastWriteTimeNs = 0;
285
jianjin996f40d2019-03-29 13:53:48 -0700286 // Last time we wrote active metrics to disk.
287 int64_t mLastActiveMetricsWriteNs = 0;
288
Jeffrey Huangb8f54032020-03-23 13:42:42 -0700289 //Last time we wrote metadata to disk.
290 int64_t mLastMetadataWriteNs = 0;
291
Tej Singh8b914c02020-07-14 23:16:24 -0700292 // The time for the next anomaly alarm for alerts.
293 int64_t mNextAnomalyAlarmTime = 0;
294
Yao Chen876889c2018-05-02 11:16:16 -0700295#ifdef VERY_VERBOSE_PRINTING
296 bool mPrintAllLogs = false;
297#endif
298
Yao Chen163d2602018-04-10 10:39:53 -0700299 FRIEND_TEST(StatsLogProcessorTest, TestOutOfOrderLogs);
David Chend9269e22017-12-05 13:43:51 -0800300 FRIEND_TEST(StatsLogProcessorTest, TestRateLimitByteSize);
301 FRIEND_TEST(StatsLogProcessorTest, TestRateLimitBroadcast);
302 FRIEND_TEST(StatsLogProcessorTest, TestDropWhenByteSizeTooLarge);
Tej Singh5a4727d2020-06-09 18:13:12 -0700303 FRIEND_TEST(StatsLogProcessorTest, InvalidConfigRemoved);
Chenjie Yuc7939cb2019-02-04 17:25:45 -0800304 FRIEND_TEST(StatsLogProcessorTest, TestActiveConfigMetricDiskWriteRead);
Chenjie Yua9a310e2019-02-06 13:40:10 -0800305 FRIEND_TEST(StatsLogProcessorTest, TestActivationOnBoot);
Muhammad Qureshi844694b2019-04-05 10:10:40 -0700306 FRIEND_TEST(StatsLogProcessorTest, TestActivationOnBootMultipleActivations);
Muhammad Qureshi15f8da92019-04-05 10:10:40 -0700307 FRIEND_TEST(StatsLogProcessorTest,
308 TestActivationOnBootMultipleActivationsDifferentActivationTypes);
Tej Singhf53d4452019-05-09 18:17:59 -0700309 FRIEND_TEST(StatsLogProcessorTest, TestActivationsPersistAcrossSystemServerRestart);
Chenjie Yuc7939cb2019-02-04 17:25:45 -0800310
Yao Chen8a8d16c2018-02-08 14:50:40 -0800311 FRIEND_TEST(WakelockDurationE2eTest, TestAggregatedPredicateDimensionsForSumDuration1);
312 FRIEND_TEST(WakelockDurationE2eTest, TestAggregatedPredicateDimensionsForSumDuration2);
313 FRIEND_TEST(WakelockDurationE2eTest, TestAggregatedPredicateDimensionsForSumDuration3);
314 FRIEND_TEST(WakelockDurationE2eTest, TestAggregatedPredicateDimensionsForMaxDuration1);
315 FRIEND_TEST(WakelockDurationE2eTest, TestAggregatedPredicateDimensionsForMaxDuration2);
316 FRIEND_TEST(WakelockDurationE2eTest, TestAggregatedPredicateDimensionsForMaxDuration3);
317 FRIEND_TEST(MetricConditionLinkE2eTest, TestMultiplePredicatesAndLinks1);
318 FRIEND_TEST(MetricConditionLinkE2eTest, TestMultiplePredicatesAndLinks2);
Yangster-mace06cfd72018-03-10 23:22:59 -0800319 FRIEND_TEST(AttributionE2eTest, TestAttributionMatchAndSliceByFirstUid);
320 FRIEND_TEST(AttributionE2eTest, TestAttributionMatchAndSliceByChain);
Yangster-mac87718e22018-01-11 16:16:26 -0800321 FRIEND_TEST(GaugeMetricE2eTest, TestMultipleFieldsForPushedEvent);
Yangster-mac15f6bbc2018-04-08 11:52:26 -0700322 FRIEND_TEST(GaugeMetricE2eTest, TestRandomSamplePulledEvents);
323 FRIEND_TEST(GaugeMetricE2eTest, TestRandomSamplePulledEvent_LateAlarm);
Tej Singh597c7162019-04-17 16:41:45 -0700324 FRIEND_TEST(GaugeMetricE2eTest, TestRandomSamplePulledEventsWithActivation);
325 FRIEND_TEST(GaugeMetricE2eTest, TestRandomSamplePulledEventsNoCondition);
Yangster-mac32f07af2018-10-13 17:08:11 -0700326 FRIEND_TEST(GaugeMetricE2eTest, TestConditionChangeToTrueSamplePulledEvents);
Yangster-mac15f6bbc2018-04-08 11:52:26 -0700327
Yangster-macbe10ddf2018-03-13 15:39:51 -0700328 FRIEND_TEST(AnomalyDetectionE2eTest, TestSlicedCountMetric_single_bucket);
329 FRIEND_TEST(AnomalyDetectionE2eTest, TestSlicedCountMetric_multiple_buckets);
Jeffrey Huangb8f54032020-03-23 13:42:42 -0700330 FRIEND_TEST(AnomalyDetectionE2eTest, TestCountMetric_save_refractory_to_disk_no_data_written);
331 FRIEND_TEST(AnomalyDetectionE2eTest, TestCountMetric_save_refractory_to_disk);
Jeffrey Huang475677e2020-03-30 19:52:07 -0700332 FRIEND_TEST(AnomalyDetectionE2eTest, TestCountMetric_load_refractory_from_disk);
Yangster-macbe10ddf2018-03-13 15:39:51 -0700333 FRIEND_TEST(AnomalyDetectionE2eTest, TestDurationMetric_SUM_single_bucket);
334 FRIEND_TEST(AnomalyDetectionE2eTest, TestDurationMetric_SUM_multiple_buckets);
335 FRIEND_TEST(AnomalyDetectionE2eTest, TestDurationMetric_SUM_long_refractory_period);
Yangster-macb142cc82018-03-30 15:22:08 -0700336
Yangster-mac684d1952018-03-24 16:47:16 -0700337 FRIEND_TEST(AlarmE2eTest, TestMultipleAlarms);
Yangster-macb142cc82018-03-30 15:22:08 -0700338 FRIEND_TEST(ConfigTtlE2eTest, TestCountMetric);
Yangster-mac849dfdc22018-10-12 15:41:45 -0700339 FRIEND_TEST(MetricActivationE2eTest, TestCountMetric);
Muhammad Qureshi3a5ebf52019-03-28 12:38:21 -0700340 FRIEND_TEST(MetricActivationE2eTest, TestCountMetricWithOneDeactivation);
341 FRIEND_TEST(MetricActivationE2eTest, TestCountMetricWithTwoDeactivations);
Tej Singhee4495e2019-06-03 18:37:35 -0700342 FRIEND_TEST(MetricActivationE2eTest, TestCountMetricWithSameDeactivation);
Muhammad Qureshi3a5ebf52019-03-28 12:38:21 -0700343 FRIEND_TEST(MetricActivationE2eTest, TestCountMetricWithTwoMetricsTwoDeactivations);
Muhammad Qureshi18e46922019-05-24 16:38:49 -0700344
tsaichristine70a7ee52020-05-18 10:05:09 -0700345 FRIEND_TEST(CountMetricE2eTest, TestInitialConditionChanges);
tsaichristine69000e62019-10-18 17:34:52 -0700346 FRIEND_TEST(CountMetricE2eTest, TestSlicedState);
347 FRIEND_TEST(CountMetricE2eTest, TestSlicedStateWithMap);
348 FRIEND_TEST(CountMetricE2eTest, TestMultipleSlicedStates);
349 FRIEND_TEST(CountMetricE2eTest, TestSlicedStateWithPrimaryFields);
tsaichristined21aacf2019-10-07 14:47:38 -0700350
Muhammad Qureshi18e46922019-05-24 16:38:49 -0700351 FRIEND_TEST(DurationMetricE2eTest, TestOneBucket);
352 FRIEND_TEST(DurationMetricE2eTest, TestTwoBuckets);
353 FRIEND_TEST(DurationMetricE2eTest, TestWithActivation);
354 FRIEND_TEST(DurationMetricE2eTest, TestWithCondition);
355 FRIEND_TEST(DurationMetricE2eTest, TestWithSlicedCondition);
356 FRIEND_TEST(DurationMetricE2eTest, TestWithActivationAndSlicedCondition);
tsaichristine1449fa42020-01-02 12:12:05 -0800357 FRIEND_TEST(DurationMetricE2eTest, TestWithSlicedState);
358 FRIEND_TEST(DurationMetricE2eTest, TestWithConditionAndSlicedState);
359 FRIEND_TEST(DurationMetricE2eTest, TestWithSlicedStateMapped);
360 FRIEND_TEST(DurationMetricE2eTest, TestSlicedStatePrimaryFieldsNotSubsetDimInWhat);
361 FRIEND_TEST(DurationMetricE2eTest, TestWithSlicedStatePrimaryFieldsSubset);
tsaichristinec876b492019-12-10 13:47:05 -0800362
tsaichristine70a7ee52020-05-18 10:05:09 -0700363 FRIEND_TEST(ValueMetricE2eTest, TestInitialConditionChanges);
364 FRIEND_TEST(ValueMetricE2eTest, TestPulledEvents);
365 FRIEND_TEST(ValueMetricE2eTest, TestPulledEvents_LateAlarm);
366 FRIEND_TEST(ValueMetricE2eTest, TestPulledEvents_WithActivation);
tsaichristinec876b492019-12-10 13:47:05 -0800367 FRIEND_TEST(ValueMetricE2eTest, TestInitWithSlicedState);
368 FRIEND_TEST(ValueMetricE2eTest, TestInitWithSlicedState_WithDimensions);
369 FRIEND_TEST(ValueMetricE2eTest, TestInitWithSlicedState_WithIncorrectDimensions);
Yao Chenab273e22017-09-06 12:53:50 -0700370};
Bookatz906a35c2017-09-20 15:26:44 -0700371
Yao Chenef99c4f2017-09-22 16:26:54 -0700372} // namespace statsd
373} // namespace os
374} // namespace android