|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.hadoop.metrics.spi.AbstractMetricsContext
org.apache.hadoop.metrics.file.FileContext
public class FileContext
Metrics context for writing metrics to a file.
This class is configured by setting ContextFactory attributes which in turn are usually configured through a properties file. All the attributes are prefixed by the contextName. For example, the properties file might contain:myContextName.fileName=/tmp/metrics.log myContextName.period=5
| Field Summary | |
|---|---|
protected static String |
FILE_NAME_PROPERTY
|
protected static String |
PERIOD_PROPERTY
|
| Fields inherited from interface org.apache.hadoop.metrics.MetricsContext |
|---|
DEFAULT_PERIOD |
| Constructor Summary | |
|---|---|
FileContext()
Creates a new instance of FileContext |
|
| Method Summary | |
|---|---|
void |
emitRecord(String contextName,
String recordName,
OutputRecord outRec)
Emits a metrics record to a file. |
void |
flush()
Flushes the output writer, forcing updates to disk. |
String |
getFileName()
Returns the configured file name, or null. |
void |
init(String contextName,
ContextFactory factory)
Initializes the context. |
void |
startMonitoring()
Starts or restarts monitoring, by opening in append-mode, the file specified by the fileName attribute,
if specified. |
void |
stopMonitoring()
Stops monitoring, closing the file. |
| Methods inherited from class org.apache.hadoop.metrics.spi.AbstractMetricsContext |
|---|
close, createRecord, getAttribute, getAttributeTable, getContextFactory, getContextName, getPeriod, isMonitoring, newRecord, registerUpdater, remove, setPeriod, unregisterUpdater, update |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected static final String FILE_NAME_PROPERTY
protected static final String PERIOD_PROPERTY
| Constructor Detail |
|---|
public FileContext()
| Method Detail |
|---|
public void init(String contextName,
ContextFactory factory)
AbstractMetricsContext
init in class AbstractMetricsContextpublic String getFileName()
public void startMonitoring()
throws IOException
fileName attribute,
if specified. Otherwise the data will be written to standard
output.
startMonitoring in interface MetricsContextstartMonitoring in class AbstractMetricsContextIOExceptionpublic void stopMonitoring()
stopMonitoring in interface MetricsContextstopMonitoring in class AbstractMetricsContextAbstractMetricsContext.close()
public void emitRecord(String contextName,
String recordName,
OutputRecord outRec)
emitRecord in class AbstractMetricsContextpublic void flush()
flush in class AbstractMetricsContext
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||