Shopify/spark — pull request #38 by charlescng (2014-12-17 21:27:59+00:00)
Title: Handle YARN driver/executor metric names

The metrics from the YARN driver/executor have a different name patterns. Right now, we're spamming Datadog with unique metrics such as `spark.application_1418834509223_0044.driver.jvm.heap.used`

```
0x0690: 7370 6172 6b2e 6170 706c 6963 6174 696f spark.applicatio
0x06a0: 6e5f 3134 3138 3833 3435 3039 3232 335f n_1418834509223_
0x06b0: 3030 3832 2e64 7269 7665 722e 6a76 6d2e 0082.driver.jvm.
0x06c0: 6e6f 6e2d 6865 6170 2e75 7365 643a 3539 non-heap.used:59
```

This fixes the name mangling to handle the new names.

Added two test cases to my local driver...

```
@Test
public void yarnDriverJVM() {
// application_1418834509223_0044.driver.jvm.non-heap.used
MetricNameParser parser = new MetricNameParser("spark.application_1418834509223_0044.driver.jvm.non-heap.used");

Assert.assertEquals("spark.driver.jvm.non-heap.used", parser.getMetricName());
}

@Test
public void yarnDriver() {
// application_1418834509223_0044.driver.BlockManager.disk.diskSpaceUsed_MB
MetricNameParser parser = new MetricNameParser("spark.application_1418834509223_0044.driver.BlockManager.disk.diskSpaceUsed_MB");

Assert.assertEquals("spark.driver.BlockManager.disk.diskSpaceUsed_MB", parser.getMetricName());
}
```

@dklassen @orenmazor @yagnik