Past buckets had a field mBucketNum, storing the
"bucket number" they represented. Currently, the concept
of bucket number is used by Anomaly Detection (although this
may not be necessary), but these stored values are not used at all,
so removing them will save RAM.
Test: statsd tests still pass
Bug:
74607818
Change-Id: Iacc343bc39c5035f6e2f236c03de1d91606eff4c
} else {
info.mBucketEndNs = fullBucketEndTimeNs;
}
- info.mBucketNum = mCurrentBucketNum;
for (const auto& counter : *mCurrentSlicedCounter) {
info.mCount = counter.second;
auto& bucketList = mPastBuckets[counter.first];
int64_t mBucketStartNs;
int64_t mBucketEndNs;
int64_t mCount;
- uint64_t mBucketNum;
};
class CountMetricProducer : public MetricProducer {
} else {
info.mBucketEndNs = fullBucketEndTimeNs;
}
- info.mBucketNum = mCurrentBucketNum;
for (const auto& slice : *mCurrentSlicedBucket) {
info.mGaugeAtoms = slice.second;
int64_t mBucketStartNs;
int64_t mBucketEndNs;
std::vector<GaugeAtom> mGaugeAtoms;
- uint64_t mBucketNum;
};
typedef std::unordered_map<MetricDimensionKey, std::vector<GaugeAtom>>
} else {
info.mBucketEndNs = fullBucketEndTimeNs;
}
- info.mBucketNum = mCurrentBucketNum;
int tainted = 0;
for (const auto& slice : mCurrentSlicedBucket) {
int64_t mBucketStartNs;
int64_t mBucketEndNs;
int64_t mValue;
- uint64_t mBucketNum;
};
class ValueMetricProducer : public virtual MetricProducer, public virtual PullDataReceiver {
uint64_t mBucketStartNs;
uint64_t mBucketEndNs;
uint64_t mDuration;
- uint64_t mBucketNum;
};
class DurationTracker {
DurationBucket info;
info.mBucketStartNs = mCurrentBucketStartTimeNs;
info.mBucketEndNs = currentBucketEndTimeNs;
- info.mBucketNum = mCurrentBucketNum;
info.mDuration = mDuration;
(*output)[mEventKey].push_back(info);
VLOG(" final duration for last bucket: %lld", (long long)mDuration);
DurationBucket current_info;
current_info.mBucketStartNs = mCurrentBucketStartTimeNs;
current_info.mBucketEndNs = currentBucketEndTimeNs;
- current_info.mBucketNum = mCurrentBucketNum;
current_info.mDuration = mDuration;
(*output)[mEventKey].push_back(current_info);
mDurationFullBucket += mDuration;
if (eventTimeNs > fullBucketEnd) {
// End of full bucket, can send to anomaly tracker now.
- addPastBucketToAnomalyTrackers(mDurationFullBucket, current_info.mBucketNum);
+ addPastBucketToAnomalyTrackers(mDurationFullBucket, mCurrentBucketNum);
mDurationFullBucket = 0;
}
VLOG(" duration: %lld", (long long)current_info.mDuration);
DurationBucket info;
info.mBucketStartNs = fullBucketEnd + mBucketSizeNs * (i - 1);
info.mBucketEndNs = info.mBucketStartNs + mBucketSizeNs;
- info.mBucketNum = mCurrentBucketNum + i;
info.mDuration = mBucketSizeNs;
(*output)[mEventKey].push_back(info);
// Safe to send these buckets to anomaly tracker since they must be full buckets.
// If it's a partial bucket, numBucketsForward would be 0.
- addPastBucketToAnomalyTrackers(info.mDuration, info.mBucketNum);
+ addPastBucketToAnomalyTrackers(info.mDuration, mCurrentBucketNum + i);
VLOG(" add filling bucket with duration %lld", (long long)info.mDuration);
}
}
it++;
EXPECT_EQ(INT, it->mValue.getType());
EXPECT_EQ(11L, it->mValue.int_value);
- EXPECT_EQ(1UL, gaugeProducer.mPastBuckets.begin()->second.back().mBucketNum);
gaugeProducer.flushIfNeededLocked(bucket4StartTimeNs);
EXPECT_EQ(0UL, gaugeProducer.mCurrentSlicedBucket->size());
it++;
EXPECT_EQ(INT, it->mValue.getType());
EXPECT_EQ(25L, it->mValue.int_value);
- EXPECT_EQ(2UL, gaugeProducer.mPastBuckets.begin()->second.back().mBucketNum);
}
TEST(GaugeMetricProducerTest, TestPushedEventsWithUpgrade) {
.mGaugeAtoms.front()
.mFields->begin()
->mValue.int_value);
- EXPECT_EQ(1UL, gaugeProducer.mPastBuckets.begin()->second.back().mBucketNum);
}
TEST(GaugeMetricProducerTest, TestAnomalyDetection) {