Package org.apache.hadoop.hbase.io
Class MetricsIO
java.lang.Object
org.apache.hadoop.hbase.io.MetricsIO
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static final classAMetricsIOSourcethat discards all updates. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final MetricsIOShared instance returned while IO metrics are disabled.private static booleanprivate static MetricsIOprivate static final org.slf4j.Loggerprivate final MetricsIOSourceprivate final MetricsIOWrapper -
Constructor Summary
ConstructorsConstructorDescriptionMetricsIO(MetricsIOSource source, MetricsIOWrapper wrapper) MetricsIO(MetricsIOWrapper wrapper) -
Method Summary
Modifier and TypeMethodDescription(package private) static MetricsIOcreateInstance(Supplier<MetricsIO> supplier, MetricsIOWrapper wrapper) Creates aMetricsIOwith the given supplier, falling back to one backed by a no-opMetricsIOSourceif the supplier fails.static voidenable()Enables IO metrics for this process.static MetricsIOGet a static instance for the MetricsIO so that accessors access the same instance.voidstatic booleanReturns whether IO metrics have been enabled for this process.static voidvoidupdateFsPreadTime(long t) voidupdateFsReadTime(long t) voidupdateFsWriteTime(long t)
-
Field Details
-
LOG
-
DISABLED_INSTANCE
Shared instance returned while IO metrics are disabled. It discards all updates and never registers anything with the metrics system. -
enabled
-
instance
-
source
-
wrapper
-
-
Constructor Details
-
MetricsIO
MetricsIO(MetricsIOWrapper wrapper) -
MetricsIO
MetricsIO(MetricsIOSource source, MetricsIOWrapper wrapper)
-
-
Method Details
-
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
Returns whether IO metrics have been enabled for this process. -
resetForTesting
-
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 aMetricsIOwith the given supplier, falling back to one backed by a no-opMetricsIOSourceif 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
-
updateFsPreadTime
-
updateFsWriteTime
-
incrSlowFsRead
-