Shopify/spark — pull request #16 by drdee (2014-11-06 23:56:13+00:00)
Title: Fix java.util.MissingFormatArgumentException in statsd module

I noticed the following stacktraces in some Spark jobs

```shell
14/11/06 20:50:24 ERROR OneForOneStrategy: Format specifier 's'
java.util.MissingFormatArgumentException: Format specifier 's'
at java.util.Formatter.format(Formatter.java:2487)
at java.util.Formatter.format(Formatter.java:2423)
at java.lang.String.format(String.java:2790)
at com.bealetech.metrics.reporting.Statsd.send(Statsd.java:75)
at com.bealetech.metrics.reporting.StatsdReporter.reportGauge(StatsdReporter.java:268)
at com.bealetech.metrics.reporting.StatsdReporter.report(StatsdReporter.java:139)
at com.codahale.metrics.ScheduledReporter.report(ScheduledReporter.java:107)
at org.apache.spark.metrics.sink.StatsdSink.report(StatsdSink.scala:87)
at org.apache.spark.metrics.MetricsSystem$$anonfun$report$1.apply(MetricsSystem.scala:95)
at org.apache.spark.metrics.MetricsSystem$$anonfun$report$1.apply(MetricsSystem.scala:95)
at scala.collection.mutable.ResizableArray$class.foreach(ResizableArray.scala:59)
at scala.collection.mutable.ArrayBuffer.foreach(ArrayBuffer.scala:47)
at org.apache.spark.metrics.MetricsSystem.report(MetricsSystem.scala:95)
at org.apache.spark.executor.Executor.stop(Executor.scala:132)
at org.apache.spark.executor.CoarseGrainedExecutorBackend$$anonfun$receiveWithLogging$1.applyOrElse(CoarseGrainedExecutorBackend.scala:92)
at scala.runtime.AbstractPartialFunction$mcVL$sp.apply$mcVL$sp(AbstractPartialFunction.scala:33)
at scala.runtime.AbstractPartialFunction$mcVL$sp.apply(AbstractPartialFunction.scala:33)
at scala.runtime.AbstractPartialFunction$mcVL$sp.apply(AbstractPartialFunction.scala:25)
at org.apache.spark.util.ActorLogReceive$$anon$1.apply(ActorLogReceive.scala:53)
at org.apache.spark.util.ActorLogReceive$$anon$1.apply(ActorLogReceive.scala:42)
at scala.PartialFunction$class.applyOrElse(PartialFunction.scala:118)
at org.apache.spark.util.ActorLogReceive$$anon$1.applyOrElse(ActorLogReceive.scala:42)
at akka.actor.ActorCell.receiveMessage(ActorCell.scala:498)
at akka.actor.ActorCell.invoke(ActorCell.scala:456)
at akka.dispatch.Mailbox.processMailbox(Mailbox.scala:237)
at akka.dispatch.Mailbox.run(Mailbox.scala:219)
at akka.dispatch.ForkJoinExecutorConfigurator$AkkaForkJoinTask.exec(AbstractDispatcher.scala:386)
at scala.concurrent.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260)
at scala.concurrent.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1339)
at scala.concurrent.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1979)
at scala.concurrent.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:107)
```

The cause was that we were expecting an executor name with at least three components (a.b.c) but there
are cases when that's not the case.

This PR does no longer expect three components but instead creates a single string of maximal the first three components.

@airhorns @phoet