|
@@ -31,6 +31,8 @@ import org.apache.hadoop.metrics2.lib.MutableQuantiles;
|
|
import org.apache.hadoop.metrics2.lib.MutableRate;
|
|
import org.apache.hadoop.metrics2.lib.MutableRate;
|
|
|
|
|
|
import java.util.concurrent.ThreadLocalRandom;
|
|
import java.util.concurrent.ThreadLocalRandom;
|
|
|
|
+import java.util.regex.Matcher;
|
|
|
|
+import java.util.regex.Pattern;
|
|
|
|
|
|
/**
|
|
/**
|
|
* This class is for maintaining Datanode Volume IO related statistics and
|
|
* This class is for maintaining Datanode Volume IO related statistics and
|
|
@@ -43,6 +45,13 @@ import java.util.concurrent.ThreadLocalRandom;
|
|
public class DataNodeVolumeMetrics {
|
|
public class DataNodeVolumeMetrics {
|
|
private final MetricsRegistry registry = new MetricsRegistry("FsVolume");
|
|
private final MetricsRegistry registry = new MetricsRegistry("FsVolume");
|
|
|
|
|
|
|
|
+ @Metric(value = {"VolumeName", "Current VolumeName"}, type = Metric.Type.TAG)
|
|
|
|
+ public String getVolumeName() {
|
|
|
|
+ Pattern pattern = Pattern.compile("(?:DataNodeVolume-|UndefinedDataNodeVolume)(.*)");
|
|
|
|
+ Matcher matcher = pattern.matcher(name);
|
|
|
|
+ return matcher.find() ? matcher.group(1) : name;
|
|
|
|
+ }
|
|
|
|
+
|
|
@Metric("number of metadata operations")
|
|
@Metric("number of metadata operations")
|
|
private MutableCounterLong totalMetadataOperations;
|
|
private MutableCounterLong totalMetadataOperations;
|
|
@Metric("metadata operation rate")
|
|
@Metric("metadata operation rate")
|