Class MetricsUtil
- java.lang.Object
-
- com.mapr.org.apache.hadoop.metrics.MetricsUtil
-
@LimitedPrivate({"HDFS","MapReduce"}) @Evolving public class MetricsUtil extends java.lang.ObjectUtility class to simplify creation and reporting of hadoop metrics. For examples of usage, see NameNodeMetrics.- See Also:
MetricsRecord,MetricsContext,ContextFactory
-
-
Field Summary
Fields Modifier and Type Field Description static org.slf4j.LoggerLOG
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static MetricsRecordcreateRecord(MetricsContext context, java.lang.String recordName)Utility method to create and return new metrics record instance within the given context.static MetricsContextgetContext(java.lang.String contextName)static MetricsContextgetContext(java.lang.String refName, java.lang.String contextName)Utility method to return the named context.
-
-
-
Method Detail
-
getContext
public static MetricsContext getContext(java.lang.String contextName)
-
getContext
public static MetricsContext getContext(java.lang.String refName, java.lang.String contextName)
Utility method to return the named context. If the desired context cannot be created for any reason, the exception is logged, and a null context is returned.
-
createRecord
public static MetricsRecord createRecord(MetricsContext context, java.lang.String recordName)
Utility method to create and return new metrics record instance within the given context. This record is tagged with the host name.- Parameters:
context- the contextrecordName- name of the record- Returns:
- newly created metrics record
-
-