- Added #onStateChanged logic to ValueMetricProducer
- #onDumpReport fills in slice_by_state values in ValueMetricProducer
- Base information is tracked in a separate data structure and keyed by
dimensions_in_what HashableDimensionKey. The current state key is also
stored in base info so we can close the interval for this state once we
get a new state key.
- Added unit tests for ValueMetricProducer onStateChange
Other changes:
- mCondition parameter was removed from #pullAndMatchEventsLocked and
#accumulateEvents because it is unused in these functions.
- The event key is initialized in each metric's internal
onMatchedLogEvent function. This allows ValueMetric to skip events that
have primary keys that do not match the current state change primary
key.
Test: bit statsd_test:*
Change-Id: I565c6d251262be57abf10fdef243b8bdc01f3772
Add an event time parameter to onStateChanged. Value and Duration
metrics need the event time for aggregation.
Test: bit statsd_test:*
Change-Id: I73c7a16de158de43bd9fbeb26ab8f0c32559a4a2
- When a log event is matched to the "what" atom of a metric,
MetricProducer parses the event for state primary key(s) and queries
StateTracker for the correct state values
- CountMetricProducer writes state information to the dump report proto
- Added e2e CountMetric tests that push events to StatsLogProcessor and
check that the resulting dump report is correct
Test: bit statsd_test:*
Bug: 136566566
Bug: 142124705
Change-Id: I9ca5b097151c0c73a617f3b16c8c3584b068cd82
Changes in this CL compared to previous StateTracker version:
- MetricsManager parses StatsdConfig for State information and updates
MetricProducers accordingly
- MetricProducer implements StateListener
- MetricProducer has a list of atom ids of its slice_by_states and any
state maps from these states. MetricProducers are responsible for
handling the conversion from original state value to mapped state value.
- More unit tests added and e2e CountMetric test added
Test: bit statsd_test:*
Bug: 136566566
Change-Id: I07ce468733a1affcadf2be0206e081fddbbce4c5
One shared StateManager object will manage all StateTrackers across all configs, maintaining a map of atom ids to StateTrackers.
StateManager is responsible for initializing and removing StateTrackers and notifying them of event or StateListener changes.
Each StateTracker maintains a list of StateListeners and is responsible for tracking state values to primary keys and notifying StateListeners when a state change occurs.
Test: bit statsd_test:*
Bug: 136566566
Change-Id: Icb61c668a01b611aa75caa7bdc2a6801c650b119