• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
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  */
16 
17 #pragma once
18 
19 #include <set>
20 #include <unordered_map>
21 #include <vector>
22 
23 #include "anomaly/AlarmTracker.h"
24 #include "condition/ConditionTracker.h"
25 #include "config/ConfigMetadataProvider.h"
26 #include "external/StatsPullerManager.h"
27 #include "matchers/AtomMatchingTracker.h"
28 #include "metrics/MetricProducer.h"
29 
30 namespace android {
31 namespace os {
32 namespace statsd {
33 
34 // Helper functions for creating, validating, and updating config components from StatsdConfig.
35 // Should only be called from metrics_manager_util and config_update_utils.
36 
37 // Create a AtomMatchingTracker.
38 // input:
39 // [logMatcher]: the input AtomMatcher from the StatsdConfig
40 // [invalidConfigReason]: logging ids if config is invalid
41 // output:
42 // new AtomMatchingTracker, or null if the tracker is unable to be created
43 sp<AtomMatchingTracker> createAtomMatchingTracker(
44         const AtomMatcher& logMatcher, const sp<UidMap>& uidMap,
45         optional<InvalidConfigReason>& invalidConfigReason);
46 
47 // Create a ConditionTracker.
48 // input:
49 // [predicate]: the input Predicate from the StatsdConfig
50 // [index]: the index of the condition tracker
51 // [atomMatchingTrackerMap]: map of atom matcher id to its index in allAtomMatchingTrackers
52 // [invalidConfigReason]: logging ids if config is invalid
53 // output:
54 // new ConditionTracker, or null if the tracker is unable to be created
55 sp<ConditionTracker> createConditionTracker(
56         const ConfigKey& key, const Predicate& predicate, int index,
57         const unordered_map<int64_t, int>& atomMatchingTrackerMap,
58         optional<InvalidConfigReason>& invalidConfigReason);
59 
60 // Get the hash of a metric, combining the activation if the metric has one.
61 optional<InvalidConfigReason> getMetricProtoHash(
62         const StatsdConfig& config, const google::protobuf::MessageLite& metric, int64_t id,
63         const std::unordered_map<int64_t, int>& metricToActivationMap, uint64_t& metricHash);
64 
65 // 1. Validates matcher existence
66 // 2. Enforces matchers with dimensions and those used for trigger_event are about one atom
67 // 3. Gets matcher index and updates tracker to metric map
68 optional<InvalidConfigReason> handleMetricWithAtomMatchingTrackers(
69         const int64_t matcherId, int64_t metricId, int metricIndex, const bool enforceOneAtom,
70         const std::vector<sp<AtomMatchingTracker>>& allAtomMatchingTrackers,
71         const std::unordered_map<int64_t, int>& atomMatchingTrackerMap,
72         std::unordered_map<int, std::vector<int>>& trackerToMetricMap, int& logTrackerIndex);
73 
74 // 1. Validates condition existence, including those in links
75 // 2. Gets condition index and updates condition to metric map
76 optional<InvalidConfigReason> handleMetricWithConditions(
77         const int64_t condition, int64_t metricId, int metricIndex,
78         const std::unordered_map<int64_t, int>& conditionTrackerMap,
79         const ::google::protobuf::RepeatedPtrField<MetricConditionLink>& links,
80         const std::vector<sp<ConditionTracker>>& allConditionTrackers, int& conditionIndex,
81         std::unordered_map<int, std::vector<int>>& conditionToMetricMap);
82 
83 // Validates a metricActivation and populates state.
84 // Fills the new event activation/deactivation maps, preserving the existing activations.
85 // Returns nullopt if successful and InvalidConfigReason if not.
86 optional<InvalidConfigReason> handleMetricActivationOnConfigUpdate(
87         const StatsdConfig& config, int64_t metricId, int metricIndex,
88         const std::unordered_map<int64_t, int>& metricToActivationMap,
89         const std::unordered_map<int64_t, int>& oldAtomMatchingTrackerMap,
90         const std::unordered_map<int64_t, int>& newAtomMatchingTrackerMap,
91         const std::unordered_map<int, shared_ptr<Activation>>& oldEventActivationMap,
92         std::unordered_map<int, std::vector<int>>& activationAtomTrackerToMetricMap,
93         std::unordered_map<int, std::vector<int>>& deactivationAtomTrackerToMetricMap,
94         std::vector<int>& metricsWithActivation,
95         std::unordered_map<int, shared_ptr<Activation>>& newEventActivationMap,
96         std::unordered_map<int, std::vector<shared_ptr<Activation>>>& newEventDeactivationMap);
97 
98 // Creates a CountMetricProducer and updates the vectors/maps used by MetricsManager with
99 // the appropriate indices. Returns an sp to the producer, or nullopt if there was an error.
100 optional<sp<MetricProducer>> createCountMetricProducerAndUpdateMetadata(
101         const ConfigKey& key, const StatsdConfig& config, int64_t timeBaseNs,
102         const int64_t currentTimeNs, const CountMetric& metric, int metricIndex,
103         const std::vector<sp<AtomMatchingTracker>>& allAtomMatchingTrackers,
104         const std::unordered_map<int64_t, int>& atomMatchingTrackerMap,
105         std::vector<sp<ConditionTracker>>& allConditionTrackers,
106         const std::unordered_map<int64_t, int>& conditionTrackerMap,
107         const std::vector<ConditionState>& initialConditionCache, const sp<ConditionWizard>& wizard,
108         const std::unordered_map<int64_t, int>& stateAtomIdMap,
109         const std::unordered_map<int64_t, std::unordered_map<int, int64_t>>& allStateGroupMaps,
110         const std::unordered_map<int64_t, int>& metricToActivationMap,
111         std::unordered_map<int, std::vector<int>>& trackerToMetricMap,
112         std::unordered_map<int, std::vector<int>>& conditionToMetricMap,
113         std::unordered_map<int, std::vector<int>>& activationAtomTrackerToMetricMap,
114         std::unordered_map<int, std::vector<int>>& deactivationAtomTrackerToMetricMap,
115         std::vector<int>& metricsWithActivation, optional<InvalidConfigReason>& invalidConfigReason,
116         const wp<ConfigMetadataProvider> configMetadataProvider);
117 
118 // Creates a DurationMetricProducer and updates the vectors/maps used by MetricsManager with
119 // the appropriate indices. Returns an sp to the producer, or nullopt if there was an error.
120 optional<sp<MetricProducer>> createDurationMetricProducerAndUpdateMetadata(
121         const ConfigKey& key, const StatsdConfig& config, int64_t timeBaseNs,
122         const int64_t currentTimeNs, const DurationMetric& metric, int metricIndex,
123         const std::vector<sp<AtomMatchingTracker>>& allAtomMatchingTrackers,
124         const std::unordered_map<int64_t, int>& atomMatchingTrackerMap,
125         std::vector<sp<ConditionTracker>>& allConditionTrackers,
126         const std::unordered_map<int64_t, int>& conditionTrackerMap,
127         const std::vector<ConditionState>& initialConditionCache, const sp<ConditionWizard>& wizard,
128         const std::unordered_map<int64_t, int>& stateAtomIdMap,
129         const std::unordered_map<int64_t, std::unordered_map<int, int64_t>>& allStateGroupMaps,
130         const std::unordered_map<int64_t, int>& metricToActivationMap,
131         std::unordered_map<int, std::vector<int>>& trackerToMetricMap,
132         std::unordered_map<int, std::vector<int>>& conditionToMetricMap,
133         std::unordered_map<int, std::vector<int>>& activationAtomTrackerToMetricMap,
134         std::unordered_map<int, std::vector<int>>& deactivationAtomTrackerToMetricMap,
135         std::vector<int>& metricsWithActivation, optional<InvalidConfigReason>& invalidConfigReason,
136         const wp<ConfigMetadataProvider> configMetadataProvider);
137 
138 // Creates an EventMetricProducer and updates the vectors/maps used by MetricsManager with
139 // the appropriate indices. Returns an sp to the producer, or nullopt if there was an error.
140 optional<sp<MetricProducer>> createEventMetricProducerAndUpdateMetadata(
141         const ConfigKey& key, const StatsdConfig& config, int64_t timeBaseNs,
142         const EventMetric& metric, int metricIndex,
143         const std::vector<sp<AtomMatchingTracker>>& allAtomMatchingTrackers,
144         const std::unordered_map<int64_t, int>& atomMatchingTrackerMap,
145         std::vector<sp<ConditionTracker>>& allConditionTrackers,
146         const std::unordered_map<int64_t, int>& conditionTrackerMap,
147         const std::vector<ConditionState>& initialConditionCache, const sp<ConditionWizard>& wizard,
148         const std::unordered_map<int64_t, int>& stateAtomIdMap,
149         const std::unordered_map<int64_t, std::unordered_map<int, int64_t>>& allStateGroupMaps,
150         const std::unordered_map<int64_t, int>& metricToActivationMap,
151         std::unordered_map<int, std::vector<int>>& trackerToMetricMap,
152         std::unordered_map<int, std::vector<int>>& conditionToMetricMap,
153         std::unordered_map<int, std::vector<int>>& activationAtomTrackerToMetricMap,
154         std::unordered_map<int, std::vector<int>>& deactivationAtomTrackerToMetricMap,
155         std::vector<int>& metricsWithActivation, optional<InvalidConfigReason>& invalidConfigReason,
156         const wp<ConfigMetadataProvider> configMetadataProvider);
157 
158 // Creates a NumericValueMetricProducer and updates the vectors/maps used by MetricsManager with
159 // the appropriate indices. Returns an sp to the producer, or nullopt if there was an error.
160 optional<sp<MetricProducer>> createNumericValueMetricProducerAndUpdateMetadata(
161         const ConfigKey& key, const StatsdConfig& config, int64_t timeBaseNs,
162         const int64_t currentTimeNs, const sp<StatsPullerManager>& pullerManager,
163         const ValueMetric& metric, int metricIndex,
164         const std::vector<sp<AtomMatchingTracker>>& allAtomMatchingTrackers,
165         const std::unordered_map<int64_t, int>& atomMatchingTrackerMap,
166         std::vector<sp<ConditionTracker>>& allConditionTrackers,
167         const std::unordered_map<int64_t, int>& conditionTrackerMap,
168         const std::vector<ConditionState>& initialConditionCache, const sp<ConditionWizard>& wizard,
169         const sp<EventMatcherWizard>& matcherWizard,
170         const std::unordered_map<int64_t, int>& stateAtomIdMap,
171         const std::unordered_map<int64_t, std::unordered_map<int, int64_t>>& allStateGroupMaps,
172         const std::unordered_map<int64_t, int>& metricToActivationMap,
173         std::unordered_map<int, std::vector<int>>& trackerToMetricMap,
174         std::unordered_map<int, std::vector<int>>& conditionToMetricMap,
175         std::unordered_map<int, std::vector<int>>& activationAtomTrackerToMetricMap,
176         std::unordered_map<int, std::vector<int>>& deactivationAtomTrackerToMetricMap,
177         std::vector<int>& metricsWithActivation, optional<InvalidConfigReason>& invalidConfigReason,
178         const wp<ConfigMetadataProvider> configMetadataProvider);
179 
180 // Creates a GaugeMetricProducer and updates the vectors/maps used by MetricsManager with
181 // the appropriate indices. Returns an sp to the producer, or nullopt if there was an error.
182 optional<sp<MetricProducer>> createGaugeMetricProducerAndUpdateMetadata(
183         const ConfigKey& key, const StatsdConfig& config, int64_t timeBaseNs,
184         const int64_t currentTimeNs, const sp<StatsPullerManager>& pullerManager,
185         const GaugeMetric& metric, int metricIndex,
186         const std::vector<sp<AtomMatchingTracker>>& allAtomMatchingTrackers,
187         const std::unordered_map<int64_t, int>& atomMatchingTrackerMap,
188         std::vector<sp<ConditionTracker>>& allConditionTrackers,
189         const std::unordered_map<int64_t, int>& conditionTrackerMap,
190         const std::vector<ConditionState>& initialConditionCache, const sp<ConditionWizard>& wizard,
191         const sp<EventMatcherWizard>& matcherWizard,
192         const std::unordered_map<int64_t, int>& stateAtomIdMap,
193         const std::unordered_map<int64_t, std::unordered_map<int, int64_t>>& allStateGroupMaps,
194         const std::unordered_map<int64_t, int>& metricToActivationMap,
195         std::unordered_map<int, std::vector<int>>& trackerToMetricMap,
196         std::unordered_map<int, std::vector<int>>& conditionToMetricMap,
197         std::unordered_map<int, std::vector<int>>& activationAtomTrackerToMetricMap,
198         std::unordered_map<int, std::vector<int>>& deactivationAtomTrackerToMetricMap,
199         std::vector<int>& metricsWithActivation, optional<InvalidConfigReason>& invalidConfigReason,
200         const wp<ConfigMetadataProvider> configMetadataProvider);
201 
202 // Creates a KllMetricProducer and updates the vectors/maps used by MetricsManager with
203 // the appropriate indices. Returns an sp to the producer, or nullopt if there was an error.
204 optional<sp<MetricProducer>> createKllMetricProducerAndUpdateMetadata(
205         const ConfigKey& key, const StatsdConfig& config, int64_t timeBaseNs,
206         const int64_t currentTimeNs, const sp<StatsPullerManager>& pullerManager,
207         const KllMetric& metric, int metricIndex,
208         const vector<sp<AtomMatchingTracker>>& allAtomMatchingTrackers,
209         const unordered_map<int64_t, int>& atomMatchingTrackerMap,
210         vector<sp<ConditionTracker>>& allConditionTrackers,
211         const unordered_map<int64_t, int>& conditionTrackerMap,
212         const vector<ConditionState>& initialConditionCache, const sp<ConditionWizard>& wizard,
213         const sp<EventMatcherWizard>& matcherWizard,
214         const unordered_map<int64_t, int>& stateAtomIdMap,
215         const unordered_map<int64_t, unordered_map<int, int64_t>>& allStateGroupMaps,
216         const unordered_map<int64_t, int>& metricToActivationMap,
217         unordered_map<int, vector<int>>& trackerToMetricMap,
218         unordered_map<int, vector<int>>& conditionToMetricMap,
219         unordered_map<int, vector<int>>& activationAtomTrackerToMetricMap,
220         unordered_map<int, vector<int>>& deactivationAtomTrackerToMetricMap,
221         vector<int>& metricsWithActivation, optional<InvalidConfigReason>& invalidConfigReason,
222         const wp<ConfigMetadataProvider> configMetadataProvider);
223 
224 // Creates an AnomalyTracker and adds it to the appropriate metric.
225 // Returns an sp to the AnomalyTracker, or nullopt if there was an error.
226 optional<sp<AnomalyTracker>> createAnomalyTracker(
227         const Alert& alert, const sp<AlarmMonitor>& anomalyAlarmMonitor,
228         const UpdateStatus& updateStatus, int64_t currentTimeNs,
229         const std::unordered_map<int64_t, int>& metricProducerMap,
230         std::vector<sp<MetricProducer>>& allMetricProducers,
231         optional<InvalidConfigReason>& invalidConfigReason);
232 
233 // Templated function for adding subscriptions to alarms or alerts. Returns nullopt if successful
234 // and InvalidConfigReason if not.
235 template <typename T>
initSubscribersForSubscriptionType(const StatsdConfig & config,const Subscription_RuleType ruleType,const std::unordered_map<int64_t,int> & ruleMap,std::vector<T> & allRules)236 optional<InvalidConfigReason> initSubscribersForSubscriptionType(
237         const StatsdConfig& config, const Subscription_RuleType ruleType,
238         const std::unordered_map<int64_t, int>& ruleMap, std::vector<T>& allRules) {
239     for (int i = 0; i < config.subscription_size(); ++i) {
240         const Subscription& subscription = config.subscription(i);
241         if (subscription.rule_type() != ruleType) {
242             continue;
243         }
244         if (subscription.subscriber_information_case() ==
245             Subscription::SubscriberInformationCase::SUBSCRIBER_INFORMATION_NOT_SET) {
246             ALOGW("subscription \"%lld\" has no subscriber info.\"", (long long)subscription.id());
247             return createInvalidConfigReasonWithSubscription(
248                     INVALID_CONFIG_REASON_SUBSCRIPTION_SUBSCRIBER_INFO_MISSING, subscription.id());
249         }
250         const auto& itr = ruleMap.find(subscription.rule_id());
251         if (itr == ruleMap.end()) {
252             ALOGW("subscription \"%lld\" has unknown rule id: \"%lld\"",
253                   (long long)subscription.id(), (long long)subscription.rule_id());
254             switch (subscription.rule_type()) {
255                 case Subscription::ALARM:
256                     return createInvalidConfigReasonWithSubscriptionAndAlarm(
257                             INVALID_CONFIG_REASON_SUBSCRIPTION_RULE_NOT_FOUND, subscription.id(),
258                             subscription.rule_id());
259                 case Subscription::ALERT:
260                     return createInvalidConfigReasonWithSubscriptionAndAlert(
261                             INVALID_CONFIG_REASON_SUBSCRIPTION_RULE_NOT_FOUND, subscription.id(),
262                             subscription.rule_id());
263                 case Subscription::RULE_TYPE_UNSPECIFIED:
264                     return createInvalidConfigReasonWithSubscription(
265                             INVALID_CONFIG_REASON_SUBSCRIPTION_RULE_NOT_FOUND, subscription.id());
266             }
267         }
268         const int ruleIndex = itr->second;
269         allRules[ruleIndex]->addSubscription(subscription);
270     }
271     return nullopt;
272 }
273 
274 // Helper functions for MetricsManager to initialize from StatsdConfig.
275 // *Note*: only initStatsdConfig() should be called from outside.
276 // All other functions are intermediate
277 // steps, created to make unit tests easier. And most of the parameters in these
278 // functions are temporary objects in the initialization phase.
279 
280 // Initialize the AtomMatchingTrackers.
281 // input:
282 // [key]: the config key that this config belongs to
283 // [config]: the input StatsdConfig
284 // output:
285 // [atomMatchingTrackerMap]: this map should contain matcher name to index mapping
286 // [allAtomMatchingTrackers]: should store the sp to all the AtomMatchingTracker
287 // [allTagIdsToMatchersMap]: maps of tag ids to atom matchers
288 // Returns nullopt if successful and InvalidConfigReason if not.
289 optional<InvalidConfigReason> initAtomMatchingTrackers(
290         const StatsdConfig& config, const sp<UidMap>& uidMap,
291         std::unordered_map<int64_t, int>& atomMatchingTrackerMap,
292         std::vector<sp<AtomMatchingTracker>>& allAtomMatchingTrackers,
293         std::unordered_map<int, std::vector<int>>& allTagIdsToMatchersMap);
294 
295 // Initialize ConditionTrackers
296 // input:
297 // [key]: the config key that this config belongs to
298 // [config]: the input config
299 // [atomMatchingTrackerMap]: AtomMatchingTracker name to index mapping from previous step.
300 // output:
301 // [conditionTrackerMap]: this map should contain condition name to index mapping
302 // [allConditionTrackers]: stores the sp to all the ConditionTrackers
303 // [trackerToConditionMap]: contain the mapping from index of
304 //                        log tracker to condition trackers that use the log tracker
305 // [initialConditionCache]: stores the initial conditions for each ConditionTracker
306 // Returns nullopt if successful and InvalidConfigReason if not.
307 optional<InvalidConfigReason> initConditions(
308         const ConfigKey& key, const StatsdConfig& config,
309         const std::unordered_map<int64_t, int>& atomMatchingTrackerMap,
310         std::unordered_map<int64_t, int>& conditionTrackerMap,
311         std::vector<sp<ConditionTracker>>& allConditionTrackers,
312         std::unordered_map<int, std::vector<int>>& trackerToConditionMap,
313         std::vector<ConditionState>& initialConditionCache);
314 
315 // Initialize State maps using State protos in the config. These maps will
316 // eventually be passed to MetricProducers to initialize their state info.
317 // input:
318 // [config]: the input config
319 // output:
320 // [stateAtomIdMap]: this map should contain the mapping from state ids to atom ids
321 // [allStateGroupMaps]: this map should contain the mapping from states ids and state
322 //                      values to state group ids for all states
323 // [stateProtoHashes]: contains a map of state id to the hash of the State proto from the config
324 // Returns nullopt if successful and InvalidConfigReason if not.
325 optional<InvalidConfigReason> initStates(
326         const StatsdConfig& config, unordered_map<int64_t, int>& stateAtomIdMap,
327         unordered_map<int64_t, unordered_map<int, int64_t>>& allStateGroupMaps,
328         std::map<int64_t, uint64_t>& stateProtoHashes);
329 
330 // Initialize MetricProducers.
331 // input:
332 // [key]: the config key that this config belongs to
333 // [config]: the input config
334 // [timeBaseSec]: start time base for all metrics
335 // [atomMatchingTrackerMap]: AtomMatchingTracker name to index mapping from previous step.
336 // [conditionTrackerMap]: condition name to index mapping
337 // [stateAtomIdMap]: contains the mapping from state ids to atom ids
338 // [allStateGroupMaps]: contains the mapping from atom ids and state values to
339 //                      state group ids for all states
340 // output:
341 // [allMetricProducers]: contains the list of sp to the MetricProducers created.
342 // [conditionToMetricMap]: contains the mapping from condition tracker index to
343 //                          the list of MetricProducer index
344 // [trackerToMetricMap]: contains the mapping from log tracker to MetricProducer index.
345 // Returns nullopt if successful and InvalidConfigReason if not.
346 optional<InvalidConfigReason> initMetrics(
347         const ConfigKey& key, const StatsdConfig& config, int64_t timeBaseTimeNs,
348         const int64_t currentTimeNs, const sp<StatsPullerManager>& pullerManager,
349         const std::unordered_map<int64_t, int>& atomMatchingTrackerMap,
350         const std::unordered_map<int64_t, int>& conditionTrackerMap,
351         const vector<sp<AtomMatchingTracker>>& allAtomMatchingTrackers,
352         const unordered_map<int64_t, int>& stateAtomIdMap,
353         const unordered_map<int64_t, unordered_map<int, int64_t>>& allStateGroupMaps,
354         vector<sp<ConditionTracker>>& allConditionTrackers,
355         const std::vector<ConditionState>& initialConditionCache,
356         std::vector<sp<MetricProducer>>& allMetricProducers,
357         std::unordered_map<int, std::vector<int>>& conditionToMetricMap,
358         std::unordered_map<int, std::vector<int>>& trackerToMetricMap,
359         std::set<int64_t>& noReportMetricIds,
360         std::unordered_map<int, std::vector<int>>& activationAtomTrackerToMetricMap,
361         std::unordered_map<int, std::vector<int>>& deactivationAtomTrackerToMetricMap,
362         std::vector<int>& metricsWithActivation,
363         const wp<ConfigMetadataProvider> configMetadataProvider);
364 
365 // Initialize alarms
366 // Is called both on initialize new configs and config updates since alarms do not have any state.
367 optional<InvalidConfigReason> initAlarms(const StatsdConfig& config, const ConfigKey& key,
368                                          const sp<AlarmMonitor>& periodicAlarmMonitor,
369                                          const int64_t timeBaseNs, int64_t currentTimeNs,
370                                          std::vector<sp<AlarmTracker>>& allAlarmTrackers);
371 
372 // Initialize MetricsManager from StatsdConfig.
373 // Parameters are the members of MetricsManager. See MetricsManager for declaration.
374 optional<InvalidConfigReason> initStatsdConfig(
375         const ConfigKey& key, const StatsdConfig& config, const sp<UidMap>& uidMap,
376         const sp<StatsPullerManager>& pullerManager, const sp<AlarmMonitor>& anomalyAlarmMonitor,
377         const sp<AlarmMonitor>& periodicAlarmMonitor, int64_t timeBaseNs,
378         const int64_t currentTimeNs, const wp<ConfigMetadataProvider> configMetadataProvider,
379         std::unordered_map<int, std::vector<int>>& allTagIdsToMatchersMap,
380         std::vector<sp<AtomMatchingTracker>>& allAtomMatchingTrackers,
381         std::unordered_map<int64_t, int>& atomMatchingTrackerMap,
382         std::vector<sp<ConditionTracker>>& allConditionTrackers,
383         std::unordered_map<int64_t, int>& conditionTrackerMap,
384         std::vector<sp<MetricProducer>>& allMetricProducers,
385         std::unordered_map<int64_t, int>& metricProducerMap,
386         vector<sp<AnomalyTracker>>& allAnomalyTrackers,
387         vector<sp<AlarmTracker>>& allPeriodicAlarmTrackers,
388         std::unordered_map<int, std::vector<int>>& conditionToMetricMap,
389         std::unordered_map<int, std::vector<int>>& trackerToMetricMap,
390         std::unordered_map<int, std::vector<int>>& trackerToConditionMap,
391         std::unordered_map<int, std::vector<int>>& activationAtomTrackerToMetricMap,
392         std::unordered_map<int, std::vector<int>>& deactivationAtomTrackerToMetricMap,
393         std::unordered_map<int64_t, int>& alertTrackerMap, std::vector<int>& metricsWithActivation,
394         std::map<int64_t, uint64_t>& stateProtoHashes, std::set<int64_t>& noReportMetricIds);
395 
396 }  // namespace statsd
397 }  // namespace os
398 }  // namespace android
399