@InterfaceAudience.Private @InterfaceStability.Evolving public interface MetricsContext
| Modifier and Type | Field and Description |
|---|---|
static int |
DEFAULT_PERIOD
Default period in seconds at which data is sent to the metrics system.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Stops monitoring and also frees any buffered data, returning this
object to its initial state.
|
MetricsRecord |
createRecord(String recordName)
Creates a new MetricsRecord instance with the given
recordName. |
Map<String,Collection<OutputRecord>> |
getAllRecords()
Retrieves all the records managed by this MetricsContext.
|
String |
getContextName()
Returns the context name.
|
int |
getPeriod()
Returns the timer period.
|
void |
init(String contextName,
ContextFactory factory)
Initialize this context.
|
boolean |
isMonitoring()
Returns true if monitoring is currently in progress.
|
void |
registerUpdater(Updater updater)
Registers a callback to be called at regular time intervals, as
determined by the implementation-class specific configuration.
|
void |
startMonitoring()
Starts or restarts monitoring, the emitting of metrics records as they are
updated.
|
void |
stopMonitoring()
Stops monitoring.
|
void |
unregisterUpdater(Updater updater)
Removes a callback, if it exists.
|
static final int DEFAULT_PERIOD
void init(String contextName, ContextFactory factory)
contextName - The given name for this contextfactory - The creator of this contextString getContextName()
void startMonitoring()
throws IOException
IOExceptionvoid stopMonitoring()
startMonitoring() again after calling
this.close()boolean isMonitoring()
void close()
MetricsRecord createRecord(String recordName)
recordName.
Throws an exception if the metrics implementation is configured with a fixed
set of record names and recordName is not in that set.recordName - the name of the recordMetricsException - if recordName conflicts with configuration datavoid registerUpdater(Updater updater)
updater - object to be run periodically; it should updated
some metrics records and then returnvoid unregisterUpdater(Updater updater)
updater - object to be removed from the callback listint getPeriod()
Map<String,Collection<OutputRecord>> getAllRecords()
Copyright © 2013 Apache Software Foundation. All rights reserved.