DataNodePeerMetrics (Apache Hadoop HDFS 3.5.0 API)
Description: declaration: package: org.apache.hadoop.hdfs.server.datanode.metrics, class: DataNodePeerMetrics

Package org.apache.hadoop.hdfs.server.datanode.metrics

# 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 Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final org.slf4j.Logger`
  `LOG`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `DataNodePeerMetrics(String name, org.apache.hadoop.conf.Configuration conf)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `addSendPacketDownstream(String peerAddr, long elapsedMs)`
  Adds invocation and elapsed time of SendPacketDownstream for peer.
  `void`
  `collectThreadLocalStates()`
  Collects states maintained in `ThreadLocal`, if any.
  `static DataNodePeerMetrics`
  `create(String dnName, org.apache.hadoop.conf.Configuration conf)`
  Creates an instance of DataNodePeerMetrics, used for registration.
  `String`
  `dumpSendPacketDownstreamAvgInfoAsJson()`
  Dump SendPacketDownstreamRollingAvgTime metrics as JSON.
  `long`
  `getLowThresholdMs()`
  `long`
  `getMinOutlierDetectionNodes()`
  `long`
  `getMinOutlierDetectionSamples()`
  `Map<String,org.apache.hadoop.hdfs.server.protocol.OutlierMetrics>`
  `getOutliers()`
  Retrieve the set of dataNodes that look significantly slower than their peers.
  `org.apache.hadoop.metrics2.lib.MutableRollingAverages`
  `getSendPacketDownstreamRollingAverages()`
  `OutlierDetector`
  `getSlowNodeDetector()`
  `String`
  `name()`
  `void`
  `setLowThresholdMs(long thresholdMs)`
  `void`
  `setMinOutlierDetectionNodes(long minNodes)`
  `void`
  `setMinOutlierDetectionSamples(long minSamples)`
  `void`
  `setTestOutliers(Map<String,org.apache.hadoop.hdfs.server.protocol.OutlierMetrics> outlier)`
  Strictly to be used by test code only.

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## 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()