Group events into classes and aggregate their metrics