Populate initial base info with unknown state values
Set the current state key to a HashableDimensionKey with -1
(kStateUnknown) for each sliced state atom. Previously, the current
state key was being set to the DEFAULT_DIMENSION_KEY which is an empty
HashableDimensionKey.
Bug: 155487198
Test: make statsd_test && adb sync data && adb shell
data/nativetest/statsd_test/statsd_test
Change-Id: Icaa187ecae599407695d86eec6104d210aa98714
diff --git a/cmds/statsd/src/metrics/MetricProducer.cpp b/cmds/statsd/src/metrics/MetricProducer.cpp
index 2518d85..bb4f03e 100644
--- a/cmds/statsd/src/metrics/MetricProducer.cpp
+++ b/cmds/statsd/src/metrics/MetricProducer.cpp
@@ -293,6 +293,17 @@
}
}
+HashableDimensionKey MetricProducer::getUnknownStateKey() {
+ HashableDimensionKey stateKey;
+ for (auto atom : mSlicedStateAtoms) {
+ FieldValue fieldValue;
+ fieldValue.mField.setTag(atom);
+ fieldValue.mValue.setInt(StateTracker::kStateUnknown);
+ stateKey.addValue(fieldValue);
+ }
+ return stateKey;
+}
+
DropEvent MetricProducer::buildDropEvent(const int64_t dropTimeNs, const BucketDropReason reason) {
DropEvent event;
event.reason = reason;