Fix TaskMetrics not being serializable