Fix puller callback with gauge/value metric
Allows gauge/value metrics to work with pulled atoms that were registered after the config was received. Test: gts Bug: 130314103 Change-Id: I9cddd28efd464d8bb78da868d8c0d850ffb0235c
This commit is contained in:
10
cmds/statsd/src/external/StatsPullerManager.cpp
vendored
10
cmds/statsd/src/external/StatsPullerManager.cpp
vendored
@@ -276,7 +276,8 @@ bool StatsPullerManager::Pull(int tagId, vector<shared_ptr<LogEvent>>* data) {
|
||||
}
|
||||
|
||||
bool StatsPullerManager::PullerForMatcherExists(int tagId) const {
|
||||
return kAllPullAtomInfo.find(tagId) != kAllPullAtomInfo.end();
|
||||
// Vendor pulled atoms might be registered after we parse the config.
|
||||
return isVendorPulledAtom(tagId) || kAllPullAtomInfo.find(tagId) != kAllPullAtomInfo.end();
|
||||
}
|
||||
|
||||
void StatsPullerManager::updateAlarmLocked() {
|
||||
@@ -449,9 +450,8 @@ void StatsPullerManager::RegisterPullerCallback(int32_t atomTag,
|
||||
const sp<IStatsPullerCallback>& callback) {
|
||||
AutoMutex _l(mLock);
|
||||
// Platform pullers cannot be changed.
|
||||
if (atomTag < StatsdStats::kMaxPlatformAtomTag) {
|
||||
VLOG("RegisterPullerCallback: atom tag %d is less than min tag %d",
|
||||
atomTag, StatsdStats::kMaxPlatformAtomTag);
|
||||
if (!isVendorPulledAtom(atomTag)) {
|
||||
VLOG("RegisterPullerCallback: atom tag %d is not vendor pulled", atomTag);
|
||||
return;
|
||||
}
|
||||
VLOG("RegisterPullerCallback: adding puller for tag %d", atomTag);
|
||||
@@ -462,7 +462,7 @@ void StatsPullerManager::RegisterPullerCallback(int32_t atomTag,
|
||||
void StatsPullerManager::UnregisterPullerCallback(int32_t atomTag) {
|
||||
AutoMutex _l(mLock);
|
||||
// Platform pullers cannot be changed.
|
||||
if (atomTag < StatsdStats::kMaxPlatformAtomTag) {
|
||||
if (!isVendorPulledAtom(atomTag)) {
|
||||
return;
|
||||
}
|
||||
StatsdStats::getInstance().notePullerCallbackRegistrationChanged(atomTag, /*registered=*/false);
|
||||
|
||||
@@ -160,6 +160,12 @@ public:
|
||||
// Max platform atom tag number.
|
||||
static const int32_t kMaxPlatformAtomTag = 100000;
|
||||
|
||||
// Vendor pulled atom start id.
|
||||
static const int32_t kVendorPulledAtomStartTag = 150000;
|
||||
|
||||
// Max accepted atom id.
|
||||
static const int32_t kMaxAtomTag = 200000;
|
||||
|
||||
static const int64_t kInt64Max = 0x7fffffffffffffffLL;
|
||||
|
||||
/**
|
||||
|
||||
@@ -96,6 +96,10 @@ inline bool isPushedAtom(int atomId) {
|
||||
return atomId <= util::kMaxPushedAtomId && atomId > 1;
|
||||
}
|
||||
|
||||
inline bool isVendorPulledAtom(int atomId) {
|
||||
return atomId >= StatsdStats::kVendorPulledAtomStartTag && atomId < StatsdStats::kMaxAtomTag;
|
||||
}
|
||||
|
||||
} // namespace statsd
|
||||
} // namespace os
|
||||
} // namespace android
|
||||
|
||||
Reference in New Issue
Block a user