diff options
Diffstat (limited to 'cmds/statsd/src/stats_log_util.cpp')
-rw-r--r-- | cmds/statsd/src/stats_log_util.cpp | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/cmds/statsd/src/stats_log_util.cpp b/cmds/statsd/src/stats_log_util.cpp index 77a3eb31fdd4..563531351fe0 100644 --- a/cmds/statsd/src/stats_log_util.cpp +++ b/cmds/statsd/src/stats_log_util.cpp @@ -549,14 +549,13 @@ int64_t getWallClockMillis() { return time(nullptr) * MS_PER_SEC; } -int64_t truncateTimestampIfNecessary(int atomId, int64_t timestampNs) { - if (AtomsInfo::kTruncatingTimestampAtomBlackList.find(atomId) != - AtomsInfo::kTruncatingTimestampAtomBlackList.end() || - (atomId >= StatsdStats::kTimestampTruncationStartTag && - atomId <= StatsdStats::kTimestampTruncationEndTag)) { - return timestampNs / NS_PER_SEC / (5 * 60) * NS_PER_SEC * (5 * 60); +int64_t truncateTimestampIfNecessary(const LogEvent& event) { + if (event.shouldTruncateTimestamp() || + (event.GetTagId() >= StatsdStats::kTimestampTruncationStartTag && + event.GetTagId() <= StatsdStats::kTimestampTruncationEndTag)) { + return event.GetElapsedTimestampNs() / NS_PER_SEC / (5 * 60) * NS_PER_SEC * (5 * 60); } else { - return timestampNs; + return event.GetElapsedTimestampNs(); } } |