Description
In hadoop-metrics.properties, I set mapred.class=org.apache.hadoop.metrics.ganglia.GangliaContext.
If I then get the gmond xml feed from the gmond server, I get this:
<METRIC NAME="load_one" VAL="1.04" TYPE="float" UNITS="" TN="28" TMAX="70" DMAX="0" SLOPE="both" SOURCE="gmond"/>
...
<METRIC NAME="datanode.myhostname.bytes_read" VAL="657927" TYPE="int32" UNITS="" TN="5696" TMAX="60" DMAX="0" SLOPE="both" SOURCE="gmetric"/>
Because the bytes_read metric has the datanode.hostname prefix, it will not aggregate with metrics from other hosts properly.
My patch (I can't attach in the standard way since this issue is still open):
— src/java/org/apache/hadoop/metrics/ganglia/GangliaContext.java (revision 522712)
+++ src/java/org/apache/hadoop/metrics/ganglia/GangliaContext.java (working copy)
@@ -122,19 +122,6 @@
public void emitRecord(String contextName, String recordName, OutputRecord outRec)
throws IOException
{
// emit each metric in turn
{ Iterator metricIt = outRec.getMetricNames().iterator(); @@ -142,9 +129,8 @@ String metricName = (String) metricIt.next(); Object metric = outRec.getMetric(metricName); String type = (String) typeTable.get(metric.getClass()); - emitMetric(namePrefix + metricName, type, metric.toString()); + emitMetric(metricName, type, metric.toString()); }// for (String metricName : outRec.getMetricNames())
}
private void emitMetric(String name, String type, String value)