Class DataNodePeerMetrics

java.lang.Object
org.apache.hadoop.hdfs.server.datanode.metrics.DataNodePeerMetrics

@Private @Unstable public class DataNodePeerMetrics extends Object
This class maintains DataNode peer metrics (e.g. numOps, AvgTime, etc.) for various peer operations.
  • Field Details

    • LOG

      public static final org.slf4j.Logger LOG
  • Constructor Details

    • DataNodePeerMetrics

      public DataNodePeerMetrics(String name, org.apache.hadoop.conf.Configuration conf)
  • Method Details

    • name

      public String name()
    • getMinOutlierDetectionSamples

      public long getMinOutlierDetectionSamples()
    • create

      public static DataNodePeerMetrics create(String dnName, org.apache.hadoop.conf.Configuration conf)
      Creates an instance of DataNodePeerMetrics, used for registration.
    • addSendPacketDownstream

      public void addSendPacketDownstream(String peerAddr, long elapsedMs)
      Adds invocation and elapsed time of SendPacketDownstream for peer.

      The caller should pass in a well-formatted peerAddr. e.g. "[192.168.1.110:1010]" is good. This will be translated into a full qualified metric name, e.g. "[192.168.1.110:1010]AvgTime".

    • dumpSendPacketDownstreamAvgInfoAsJson

      public String dumpSendPacketDownstreamAvgInfoAsJson()
      Dump SendPacketDownstreamRollingAvgTime metrics as JSON.
    • collectThreadLocalStates

      public void collectThreadLocalStates()
      Collects states maintained in ThreadLocal, if any.
    • getOutliers

      public Map<String,org.apache.hadoop.hdfs.server.protocol.OutlierMetrics> getOutliers()
      Retrieve the set of dataNodes that look significantly slower than their peers.
    • setTestOutliers

      public void setTestOutliers(Map<String,org.apache.hadoop.hdfs.server.protocol.OutlierMetrics> outlier)
      Strictly to be used by test code only. Source code is not supposed to use this. This method directly sets outlier mapping so that aggregate latency metrics are not calculated for tests.
      Parameters:
      outlier - outlier directly set by tests.
    • getSendPacketDownstreamRollingAverages

      public org.apache.hadoop.metrics2.lib.MutableRollingAverages getSendPacketDownstreamRollingAverages()
    • setMinOutlierDetectionNodes

      public void setMinOutlierDetectionNodes(long minNodes)
    • getMinOutlierDetectionNodes

      public long getMinOutlierDetectionNodes()
    • setLowThresholdMs

      public void setLowThresholdMs(long thresholdMs)
    • getLowThresholdMs

      public long getLowThresholdMs()
    • setMinOutlierDetectionSamples

      public void setMinOutlierDetectionSamples(long minSamples)
    • getSlowNodeDetector

      @VisibleForTesting public OutlierDetector getSlowNodeDetector()