Track the number of buckets dropped.
Test: atest statsd_test Change-Id: I56973d2c87aaed0f1c4a6908682cc54cda39eceb
This commit is contained in:
@@ -443,6 +443,11 @@ void StatsdStats::noteBadValueType(int metricId) {
|
||||
getAtomMetricStats(metricId).badValueType++;
|
||||
}
|
||||
|
||||
void StatsdStats::noteBucketDropped(int metricId) {
|
||||
lock_guard<std::mutex> lock(mLock);
|
||||
getAtomMetricStats(metricId).bucketDropped++;
|
||||
}
|
||||
|
||||
void StatsdStats::noteConditionChangeInNextBucket(int metricId) {
|
||||
lock_guard<std::mutex> lock(mLock);
|
||||
getAtomMetricStats(metricId).conditionChangeInNextBucket++;
|
||||
|
||||
@@ -359,6 +359,11 @@ public:
|
||||
*/
|
||||
void noteBadValueType(int atomId);
|
||||
|
||||
/**
|
||||
* Buckets were dropped due to reclaim memory.
|
||||
*/
|
||||
void noteBucketDropped(int metricId);
|
||||
|
||||
/**
|
||||
* A condition change was too late, arrived in the wrong bucket and was skipped
|
||||
*/
|
||||
@@ -414,6 +419,7 @@ public:
|
||||
long badValueType = 0;
|
||||
long conditionChangeInNextBucket = 0;
|
||||
long invalidatedBucket = 0;
|
||||
long bucketDropped = 0;
|
||||
} AtomMetricStats;
|
||||
|
||||
private:
|
||||
|
||||
@@ -243,6 +243,7 @@ void CountMetricProducer::onDumpReportLocked(const int64_t dumpTimeNs,
|
||||
|
||||
void CountMetricProducer::dropDataLocked(const int64_t dropTimeNs) {
|
||||
flushIfNeededLocked(dropTimeNs);
|
||||
StatsdStats::getInstance().noteBucketDropped(mMetricId);
|
||||
mPastBuckets.clear();
|
||||
}
|
||||
|
||||
|
||||
@@ -444,6 +444,7 @@ void DurationMetricProducer::onConditionChangedLocked(const bool conditionMet,
|
||||
|
||||
void DurationMetricProducer::dropDataLocked(const int64_t dropTimeNs) {
|
||||
flushIfNeededLocked(dropTimeNs);
|
||||
StatsdStats::getInstance().noteBucketDropped(mMetricId);
|
||||
mPastBuckets.clear();
|
||||
}
|
||||
|
||||
|
||||
@@ -77,6 +77,7 @@ EventMetricProducer::~EventMetricProducer() {
|
||||
|
||||
void EventMetricProducer::dropDataLocked(const int64_t dropTimeNs) {
|
||||
mProto->clear();
|
||||
StatsdStats::getInstance().noteBucketDropped(mMetricId);
|
||||
}
|
||||
|
||||
void EventMetricProducer::onSlicedConditionMayChangeLocked(bool overallCondition,
|
||||
|
||||
@@ -510,6 +510,7 @@ void GaugeMetricProducer::updateCurrentSlicedBucketForAnomaly() {
|
||||
|
||||
void GaugeMetricProducer::dropDataLocked(const int64_t dropTimeNs) {
|
||||
flushIfNeededLocked(dropTimeNs);
|
||||
StatsdStats::getInstance().noteBucketDropped(mMetricId);
|
||||
mPastBuckets.clear();
|
||||
}
|
||||
|
||||
|
||||
@@ -175,6 +175,7 @@ void ValueMetricProducer::onSlicedConditionMayChangeLocked(bool overallCondition
|
||||
|
||||
void ValueMetricProducer::dropDataLocked(const int64_t dropTimeNs) {
|
||||
flushIfNeededLocked(dropTimeNs);
|
||||
StatsdStats::getInstance().noteBucketDropped(mMetricId);
|
||||
mPastBuckets.clear();
|
||||
}
|
||||
|
||||
|
||||
@@ -418,6 +418,7 @@ message StatsdStatsReport {
|
||||
optional int64 bad_value_type = 5;
|
||||
optional int64 condition_change_in_next_bucket = 6;
|
||||
optional int64 invalidated_bucket = 7;
|
||||
optional int64 bucket_dropped = 8;
|
||||
}
|
||||
repeated AtomMetricStats atom_metric_stats = 17;
|
||||
|
||||
|
||||
@@ -79,6 +79,7 @@ const int FIELD_ID_SKIPPED_FORWARD_BUCKETS = 4;
|
||||
const int FIELD_ID_BAD_VALUE_TYPE = 5;
|
||||
const int FIELD_ID_CONDITION_CHANGE_IN_NEXT_BUCKET = 6;
|
||||
const int FIELD_ID_INVALIDATED_BUCKET = 7;
|
||||
const int FIELD_ID_BUCKET_DROPPED = 8;
|
||||
|
||||
namespace {
|
||||
|
||||
@@ -497,6 +498,8 @@ void writeAtomMetricStatsToStream(const std::pair<int, StatsdStats::AtomMetricSt
|
||||
(long long)pair.second.conditionChangeInNextBucket);
|
||||
protoOutput->write(FIELD_TYPE_INT64 | FIELD_ID_INVALIDATED_BUCKET,
|
||||
(long long)pair.second.invalidatedBucket);
|
||||
protoOutput->write(FIELD_TYPE_INT64 | FIELD_ID_BUCKET_DROPPED,
|
||||
(long long)pair.second.bucketDropped);
|
||||
protoOutput->end(token);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user