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 . |
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
IOException
void 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()
Copyright © 2010 The Apache Software Foundation