diff options
author | Tej Singh <singhtejinder@google.com> | 2020-05-11 11:05:08 -0700 |
---|---|---|
committer | Tej Singh <singhtejinder@google.com> | 2020-05-13 01:50:24 -0700 |
commit | 7b975a85db963e8e4a75fdaed13aec52a8d0f316 (patch) | |
tree | f4248cf4f8668cf2881f681ceb76b4f2cbb66636 /cmds/statsd/src/shell/ShellSubscriber.cpp | |
parent | 1ecd4528fb3c07af3279428e1131909ad640b27d (diff) |
Statsd: pull once per event time
If a pull happens at the same event time, we should reuse the existing
data, regardless of whether or not the cool down has been met. For
example, if an app upgrade happens at time t, and two metrics need to
pull atom a, if metric one pulls at time t, but metric two initiates the
pull at time t+2, we should still reuse the pull from time t since that
is when the app upgrade happened.
Bug: 156294650
Test: atest statsd_test
Change-Id: I4efc49545093f6683bf6dd89ed68c5dfa5b44d8f
Diffstat (limited to 'cmds/statsd/src/shell/ShellSubscriber.cpp')
-rw-r--r-- | cmds/statsd/src/shell/ShellSubscriber.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/cmds/statsd/src/shell/ShellSubscriber.cpp b/cmds/statsd/src/shell/ShellSubscriber.cpp index 7b687210ce33..361b161c76ac 100644 --- a/cmds/statsd/src/shell/ShellSubscriber.cpp +++ b/cmds/statsd/src/shell/ShellSubscriber.cpp @@ -152,6 +152,7 @@ void ShellSubscriber::startPull(int myToken) { } int64_t nowMillis = getElapsedRealtimeMillis(); + int64_t nowNanos = getElapsedRealtimeNs(); for (PullInfo& pullInfo : mSubscriptionInfo->mPulledInfo) { if (pullInfo.mPrevPullElapsedRealtimeMs + pullInfo.mInterval >= nowMillis) { continue; @@ -161,7 +162,7 @@ void ShellSubscriber::startPull(int myToken) { getUidsForPullAtom(&uids, pullInfo); vector<std::shared_ptr<LogEvent>> data; - mPullerMgr->Pull(pullInfo.mPullerMatcher.atom_id(), uids, &data); + mPullerMgr->Pull(pullInfo.mPullerMatcher.atom_id(), uids, nowNanos, &data); VLOG("Pulled %zu atoms with id %d", data.size(), pullInfo.mPullerMatcher.atom_id()); writePulledAtomsLocked(data, pullInfo.mPullerMatcher); |