You can write this more conisely as:
`val metricsServletHandlers = SparkEnv.get.metricsSystem.metricsServlet.map(s => s.getHandlers).toSeq`