SPARK-3179. Add task OutputMetrics.

This test is a little hairy because it could break without anyone noticing (since I don't think Jenkins runs a new enough version for this code to be run?).  But I don't have a great solution -- you could mock out a bunch of the function calls, but then you're left not really testing anything.