Introduce a new wrapper for log_msg -- LogEvent
It stores all of the parsed fields in a single vector, and
provides accessor methods to get at fields by index with
their correct type.
Test: statsd_test
Change-Id: I4fa94e4ce52db3ac87f19b62f9c85398de6e8145
diff --git a/cmds/statsd/src/metrics/MetricsManager.cpp b/cmds/statsd/src/metrics/MetricsManager.cpp
index b77daf1..5b4ca80 100644
--- a/cmds/statsd/src/metrics/MetricsManager.cpp
+++ b/cmds/statsd/src/metrics/MetricsManager.cpp
@@ -59,19 +59,18 @@
}
// Consume the stats log if it's interesting to this metric.
-void MetricsManager::onLogEvent(const log_msg& logMsg) {
+void MetricsManager::onLogEvent(const LogEvent& event) {
if (!mConfigValid) {
return;
}
- int tagId = getTagId(logMsg);
+ int tagId = event.GetTagId();
if (mTagIds.find(tagId) == mTagIds.end()) {
// not interesting...
return;
}
// Since at least one of the metrics is interested in this event, we parse it now.
- LogEventWrapper event = parseLogEvent(logMsg);
vector<MatchingState> matcherCache(mAllLogEntryMatchers.size(), MatchingState::kNotComputed);
for (auto& matcher : mAllLogEntryMatchers) {