codahale/metrics — Issue #131: ClassCastException in GraphiteReporter
Author: dinomite
Created: 2011-12-05 21:34:25+00:00
State: open

When the reporter tries to report, it gets a ClassCastException when trying to insert into the map in [Utils.sortAndFilterMetrics()](https://github.com/codahale/metrics/blob/development/metrics-core/src/main/java/com/yammer/metrics/util/Utils.java#L46)

```
java.lang.ClassCastException: com.yammer.metrics.core.MetricName cannot be cast to java.lang.Comparable
at java.util.TreeMap.toComparable(TreeMap.java:164)
at java.util.TreeMap.put(TreeMap.java:1971)
at com.yammer.metrics.util.Utils.sortAndFilterMetrics(Utils.java:46)
at com.yammer.metrics.reporting.GraphiteReporter.printRegularMetrics(GraphiteReporter.java:208)
at com.yammer.metrics.reporting.GraphiteReporter.run(GraphiteReporter.java:180)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
at java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:317)
at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:150)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(ScheduledThreadPoolExecutor.java:98)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.runPeriodic(ScheduledThreadPoolExecutor.java:180)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:204)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:680)
```