Merge "Add a field in config to disable/enable the string hashing in metric report." into pi-dev am: 76cb7fe2f6
am: 02b40158ab
Change-Id: I7445eb13283b007738182e2a5ac4808a87124a11
This commit is contained in:
@@ -385,7 +385,11 @@ void StatsLogProcessor::onConfigMetricsReportLocked(const ConfigKey& key,
|
||||
// This skips the uid map if it's an empty config.
|
||||
if (it->second->getNumMetrics() > 0) {
|
||||
uint64_t uidMapToken = proto->start(FIELD_TYPE_MESSAGE | FIELD_ID_UID_MAP);
|
||||
mUidMap->appendUidMap(dumpTimeStampNs, key, &str_set, proto);
|
||||
if (it->second->hashStringInReport()) {
|
||||
mUidMap->appendUidMap(dumpTimeStampNs, key, &str_set, proto);
|
||||
} else {
|
||||
mUidMap->appendUidMap(dumpTimeStampNs, key, nullptr, proto);
|
||||
}
|
||||
proto->end(uidMapToken);
|
||||
}
|
||||
|
||||
|
||||
@@ -74,6 +74,8 @@ MetricsManager::MetricsManager(const ConfigKey& key, const StatsdConfig& config,
|
||||
mAllPeriodicAlarmTrackers, mConditionToMetricMap, mTrackerToMetricMap,
|
||||
mTrackerToConditionMap, mNoReportMetricIds);
|
||||
|
||||
mHashStringsInReport = config.hash_strings_in_metric_report();
|
||||
|
||||
if (config.allowed_log_source_size() == 0) {
|
||||
mConfigValid = false;
|
||||
ALOGE("Log source whitelist is empty! This config won't get any data. Suggest adding at "
|
||||
@@ -201,8 +203,13 @@ void MetricsManager::onDumpReport(const int64_t dumpTimeStampNs,
|
||||
if (mNoReportMetricIds.find(producer->getMetricId()) == mNoReportMetricIds.end()) {
|
||||
uint64_t token = protoOutput->start(
|
||||
FIELD_TYPE_MESSAGE | FIELD_COUNT_REPEATED | FIELD_ID_METRICS);
|
||||
producer->onDumpReport(dumpTimeStampNs, include_current_partial_bucket, str_set,
|
||||
protoOutput);
|
||||
if (mHashStringsInReport) {
|
||||
producer->onDumpReport(dumpTimeStampNs, include_current_partial_bucket, str_set,
|
||||
protoOutput);
|
||||
} else {
|
||||
producer->onDumpReport(dumpTimeStampNs, include_current_partial_bucket, nullptr,
|
||||
protoOutput);
|
||||
}
|
||||
protoOutput->end(token);
|
||||
} else {
|
||||
producer->clearPastBuckets(dumpTimeStampNs);
|
||||
|
||||
@@ -77,6 +77,10 @@ public:
|
||||
return mTtlNs <= 0 || timestampNs < mTtlEndNs;
|
||||
};
|
||||
|
||||
inline bool hashStringInReport() const {
|
||||
return mHashStringsInReport;
|
||||
};
|
||||
|
||||
void refreshTtl(const int64_t currentTimestampNs) {
|
||||
if (mTtlNs > 0) {
|
||||
mTtlEndNs = currentTimestampNs + mTtlNs;
|
||||
@@ -118,6 +122,8 @@ private:
|
||||
|
||||
bool mConfigValid = false;
|
||||
|
||||
bool mHashStringsInReport = false;
|
||||
|
||||
const int64_t mTtlNs;
|
||||
int64_t mTtlEndNs;
|
||||
|
||||
|
||||
@@ -364,6 +364,8 @@ message StatsdConfig {
|
||||
|
||||
optional int64 ttl_in_seconds = 15;
|
||||
|
||||
optional bool hash_strings_in_metric_report = 16 [default = true];
|
||||
|
||||
// Field number 1000 is reserved for later use.
|
||||
reserved 1000;
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user