align metrics start time to the previous 5 min start, instead
of the next 5 min start. Also refactor config check condition to be more readable. Test: unit test Change-Id: Iaa6b4a59d27c52996723862d92080d90c9e794cb
This commit is contained in:
@@ -206,7 +206,7 @@ bool initMetrics(const ConfigKey& key, const StatsdConfig& config, const long ti
|
||||
// clock will not grow very aggressive. New metrics will be delayed up to
|
||||
// MIN_BUCKET_SIZE_SEC before starting.
|
||||
long currentTimeSec = time(nullptr);
|
||||
uint64_t startTimeNs = (currentTimeSec + kMinBucketSizeSec -
|
||||
uint64_t startTimeNs = (currentTimeSec - kMinBucketSizeSec -
|
||||
(currentTimeSec - timeBaseSec) % kMinBucketSizeSec) *
|
||||
NS_PER_SEC;
|
||||
|
||||
@@ -410,12 +410,15 @@ bool initMetrics(const ConfigKey& key, const StatsdConfig& config, const long ti
|
||||
return false;
|
||||
}
|
||||
|
||||
if (((!metric.gauge_fields().has_include_all() ||
|
||||
(metric.gauge_fields().has_include_all() &&
|
||||
metric.gauge_fields().include_all() == false)) &&
|
||||
metric.gauge_fields().field_num_size() == 0) ||
|
||||
(metric.gauge_fields().has_include_all() && metric.gauge_fields().include_all() == true &&
|
||||
metric.gauge_fields().field_num_size() > 0)) {
|
||||
if ((!metric.gauge_fields().has_include_all() ||
|
||||
(metric.gauge_fields().include_all() == false)) &&
|
||||
metric.gauge_fields().field_num_size() == 0) {
|
||||
ALOGW("Incorrect field filter setting in GaugeMetric %s", metric.name().c_str());
|
||||
return false;
|
||||
}
|
||||
if ((metric.gauge_fields().has_include_all() &&
|
||||
metric.gauge_fields().include_all() == true) &&
|
||||
metric.gauge_fields().field_num_size() > 0) {
|
||||
ALOGW("Incorrect field filter setting in GaugeMetric %s", metric.name().c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user