|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.cassandra.analytics.AnalyticsContext
public class AnalyticsContext
Context for sending metrics to Ganglia. This class drives the entire metric collection process. Author : Avinash Lakshman ( alakshman@facebook.com) & Prashant Malik ( pmalik@facebook.com ) & Karthik Ranganathan ( kranganathan@facebook.com )
Constructor Summary | |
---|---|
AnalyticsContext()
Creates a new instance of AnalyticsReporter |
Method Summary | |
---|---|
void |
close()
Stops monitoring and frees buffered data, returning this object to its initial state. |
void |
createRecord(java.lang.String recordName)
Creates a new AbstractMetricsRecord instance with the given recordName . |
void |
emitRecord(java.lang.String recordName,
OutputRecord outRec)
Sends a record to the metrics system. |
protected void |
flush()
Called each period after all records have been emitted, this method does nothing. |
java.lang.String |
getAttribute(java.lang.String attributeName)
Returns the value of the named attribute, or null if there is no attribute of that name. |
java.lang.String[] |
getAttributeNames()
Returns the names of all the factory's attributes. |
protected java.util.Map<java.lang.String,java.lang.String> |
getAttributeTable(java.lang.String tableName)
Returns an attribute-value map derived from the factory attributes by finding all factory attributes that begin with contextName.tableName. |
MetricsRecord |
getMetricsRecord(java.lang.String recordName)
Return the MetricsRecord associated with this record name. |
int |
getPeriod()
Returns the timer period. |
void |
init(java.lang.String contextName,
java.lang.String serverSpecList)
Initializes the context. |
static AnalyticsContext |
instance()
Factory method that gets an instance of the StorageService class. |
boolean |
isMonitoring()
Returns true if monitoring is currently in progress. |
void |
registerUpdater(IAnalyticsSource updater)
Registers a callback to be called at time intervals determined by the configuration. |
protected void |
remove(MetricsRecord record)
Called by MetricsRecordImpl.remove(). |
void |
removeAttribute(java.lang.String attributeName)
Removes the named attribute if it exists. |
void |
setAttribute(java.lang.String attributeName,
java.lang.Object value)
Sets the named factory attribute to the specified value, creating it if it did not already exist. |
protected void |
setPeriod(int period)
Sets the timer period |
void |
setPort(int port)
Sets the default port to listen on |
void |
shutdown()
Stops timer if it is running |
void |
start()
Starts up the analytics context and registers the VM metrics. |
void |
startMonitoring()
Starts or restarts monitoring, the emitting of metrics records. |
void |
stop()
|
void |
stopMonitoring()
Stops monitoring. |
void |
unregisterUpdater(IAnalyticsSource updater)
Removes a callback, if it exists. |
protected void |
update(MetricsRecord record)
Called by MetricsRecordImpl.update(). |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public AnalyticsContext()
Method Detail |
---|
public void init(java.lang.String contextName, java.lang.String serverSpecList)
public void emitRecord(java.lang.String recordName, OutputRecord outRec) throws java.io.IOException
java.io.IOException
public java.lang.String[] getAttributeNames()
public void setAttribute(java.lang.String attributeName, java.lang.Object value)
attributeName
- the attribute namevalue
- the new attribute valuepublic void removeAttribute(java.lang.String attributeName)
attributeName
- the attribute namepublic java.lang.String getAttribute(java.lang.String attributeName)
attributeName
- the attribute name
protected java.util.Map<java.lang.String,java.lang.String> getAttributeTable(java.lang.String tableName)
public void startMonitoring() throws java.io.IOException
java.io.IOException
public void stopMonitoring()
close()
public boolean isMonitoring()
public void close()
public final void createRecord(java.lang.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 record
AnalyticsException
- if recordName conflicts with configuration datapublic MetricsRecord getMetricsRecord(java.lang.String recordName)
recordName
- the name of the record
public void registerUpdater(IAnalyticsSource updater)
updater
- object to be run periodically; it should update
some metrics recordspublic void unregisterUpdater(IAnalyticsSource updater)
updater
- object to be removed from the callback listpublic void shutdown()
shutdown
in interface IComponentShutdown
protected void flush() throws java.io.IOException
java.io.IOException
protected void update(MetricsRecord record)
protected void remove(MetricsRecord record)
public int getPeriod()
protected void setPeriod(int period)
public void setPort(int port)
public void start()
public void stop()
public static AnalyticsContext instance()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |