Class MetricsIO

java.lang.Object
org.apache.hadoop.hbase.io.MetricsIO

@Private public class MetricsIO extends Object
  • Field Details

  • Constructor Details

  • Method Details

    • enable

      public static void enable()
      Enables IO metrics for this process. Until this is called, getInstance() returns an instance that discards all updates, so processes that only read or write HFiles as a client (bulk load, MapReduce tasks, command line tools) do not start the Hadoop metrics system or register a "RegionServer" metrics source. Server processes call this during startup. The metrics source itself is still created lazily, on first use after this call. See HBASE-30231 for more details.
    • isEnabled

      public static boolean isEnabled()
      Returns whether IO metrics have been enabled for this process.
    • resetForTesting

      public static void resetForTesting()
    • getInstance

      public static MetricsIO getInstance()
      Get a static instance for the MetricsIO so that accessors access the same instance. We want to lazy initialize so that correct process name is in place. See HBASE-27966 for more details.

      If IO metrics have not been enabled with enable(), a shared instance that discards all updates is returned. If the metrics source cannot be created, a no-op source is used instead, so that a metrics failure never fails HFile reads or writes. See HBASE-30231 for more details.

    • createInstance

      Creates a MetricsIO with the given supplier, falling back to one backed by a no-op MetricsIOSource if the supplier fails.

      Registering the metrics source with the Hadoop metrics system reserves its name before the registration has fully completed. If anything fails after that point, every later attempt to register the same source fails with "Metrics source ... already exists!". Retrying would therefore fail on every call for the rest of the JVM's life, so we fall back to a no-op source once and never retry.

    • getMetricsSource

    • getWrapper

    • updateFsReadTime

      public void updateFsReadTime(long t)
    • updateFsPreadTime

      public void updateFsPreadTime(long t)
    • updateFsWriteTime

      public void updateFsWriteTime(long t)
    • incrSlowFsRead

      public void incrSlowFsRead()