public class MonitorFactory
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
EXCEPTIONS_LABEL |
Constructor and Description |
---|
MonitorFactory() |
Modifier and Type | Method and Description |
---|---|
static Monitor |
add(MonKey key,
double value)
Used when you want to create your own key for the monitor.
|
static Monitor |
add(java.lang.String label,
java.lang.String units,
double value)
Aggregate the passed in value with the monitor associated with the label, and the units.
|
static void |
disable()
Disable MonitorFactory.
|
static void |
disableTotalKeySizeTracking()
Call this method if you want to disable key size tracking.
|
static void |
enable()
Enable MonitorFactory.
|
static void |
enableActivityTracking(boolean enable) |
static void |
enableGlobalActive(boolean enable) |
static void |
enableTotalKeySizeTracking()
Call this method if you want to be able to call MonitorFactory.getTotalKeySize() to determine the size of all labels/keys in JAMon.
|
static boolean |
exists(MonKey key)
Return true if the monitor associated with the passed in key exists
|
static boolean |
exists(java.lang.String label,
java.lang.String units)
Determine if the monitor associated with the label, and the units currently exists.
|
static MonitorComposite |
getComposite(java.lang.String units)
Return the composite monitor (a collection of monitors) associated with the passed in units.
|
static java.lang.Object[][] |
getData()
This returns the data for basic data with no range info.
|
static MonitorFactoryInterface |
getDebugFactory()
Returns the factory for creating debug monitors.
|
static MonitorFactoryInterface |
getFactory()
Get the current Factory (could be the enabled or disabled factory depending on what is enabled)
|
static java.lang.String[] |
getHeader()
This returns the header for basic data with no range info in the header.
|
static java.util.Map |
getMap() |
static int |
getMaxNumMonitors()
Get the maximum number of monitors that JAMon can store.
|
static Monitor |
getMonitor() |
static Monitor |
getMonitor(MonKey key)
Get the monitor associated with the passed in key.
|
static Monitor |
getMonitor(java.lang.String label,
java.lang.String units)
Return the monitor associated with the label, and units.
|
static int |
getNumRows()
This returns the number of monitors in this factory.
|
static java.lang.String[] |
getRangeHeader()
Return the header for displaying what ranges are available.
|
static java.lang.Object[][] |
getRangeNames()
Return the ranges in this factory.
|
static java.lang.String |
getReport()
This returns an HTML report for basic data with no range info in the
header.
|
static java.lang.String |
getReport(java.lang.String units)
This returns an HTML report for basic data with no range info in the
header for the past in units.
|
static MonitorComposite |
getRootMonitor()
Return the composite monitor of all monitors for this factory
|
static Monitor |
getTimeMonitor(MonKey key)
Get the time monitor associated with the passed in key.
|
static Monitor |
getTimeMonitor(java.lang.String label)
Return the time monitor associated with the label.
|
static long |
getTotalKeySize()
Returns the total key sizes which is the size of all String lables stored in JAMon.
|
static java.lang.String |
getVersion()
Return the version of JAMon
|
static boolean |
isActivityTrackingEnabled() |
static boolean |
isDebugEnabled()
Is the Debug Monitor Factory currently enabled?
|
static boolean |
isEnabled()
Is the MonitorFactory currently enabled?
|
static boolean |
isGlobalActiveEnabled() |
static boolean |
isTotalKeySizeTrackingEnabled() |
static java.util.Iterator |
iterator()
Iterator that contains Monitor's that are in this factory
|
static void |
main(java.lang.String[] args) |
static void |
remove(MonKey key)
Remove the monitor associated with the passed in key
|
static void |
remove(java.lang.String label,
java.lang.String units)
Remove/delete the specified monitor
|
static void |
reset()
Reset/remove all monitors.
|
static void |
setDebugEnabled(boolean enable)
Enable or disable the debug factory.
|
static void |
setEnabled(boolean enable)
Enable/Disable MonitorFactory.
|
static void |
setMap(java.util.Map map)
Use the specified map to hold the monitors.
|
static void |
setMaxNumMonitors(int maxMonitors)
Set the maximum number of monitors that JAMon can store.
|
static void |
setRangeDefault(java.lang.String key,
RangeHolder rangeHolder)
Associate a range with a key/unit.
|
static Monitor |
start()
Return a timing monitor with units in milliseconds, that is not aggregated into the jamon stats.
|
static Monitor |
start(MonKey key)
Start using the passed in key.
|
static Monitor |
start(java.lang.String label)
Return a timing monitor with units in milliseconds.
|
static Monitor |
startPrimary(MonKey key)
Start a monitor with the specified key and mark it as primary
|
static Monitor |
startPrimary(java.lang.String label)
Return a timing monitor with units in milliseconds, that is not aggregated into the jamon stats.
|
public static final java.lang.String EXCEPTIONS_LABEL
public static MonitorFactoryInterface getFactory()
public static MonitorFactoryInterface getDebugFactory()
public static Monitor add(java.lang.String label, java.lang.String units, double value)
Aggregate the passed in value with the monitor associated with the label, and the units. The aggregation tracks hits, avg, total, min, max and more. Note the monitor returned is threadsafe. However, it is best to get a monitor vi this method and not reuse the handle as TimeMonitors are not thread safe (see the getTimeMonitor method.
Sample call:
Monitor mon=MonitorFactory.add("bytes.sent","MB", 1024);
public static Monitor add(MonKey key, double value)
public static Monitor start(java.lang.String label)
Return a timing monitor with units in milliseconds. stop() should be called on the returned monitor to indicate the time that the process took. Note time monitors keep the starttime as an instance variable and so every time you want to use a TimeMonitor you should get a new instance.
Sample call:
Monitor mon=MonitorFactory.start("pageHits");
...code being timed...
mon.stop();
public static Monitor start()
Return a timing monitor with units in milliseconds, that is not aggregated into the jamon stats. stop() should be called on the returned monitor to indicate the time that the process took. Note time monitors keep the starttime as an instance variable and so every time you want to use a TimeMonitor you should get a new instance.
Sample call:
Monitor mon=MonitorFactory.start();
...code being timed...
mon.stop();
public static Monitor getMonitor()
public static Monitor startPrimary(java.lang.String label)
Return a timing monitor with units in milliseconds, that is not aggregated into the jamon stats. The concept of primary allows you to correlate performance of all monitors with the most resource intensive things the app does which helps you determine scalability.
Sample call:
Monitor mon=MonitorFactory.startPrimary("myPrimaryMonitor");
...code being timed...
mon.stop();
public static Monitor startPrimary(MonKey key)
public static Monitor start(MonKey key)
public static Monitor getMonitor(java.lang.String label, java.lang.String units)
Return the monitor associated with the label, and units. All statistics associated with the monitor can then be accessed such as hits, total, avg, min, and max. If the monitor does not exist it will be created.
Sample call:
Monitor mon=MonitorFactory.getMonitor("myPrimaryMonitor");
public static Monitor getMonitor(MonKey key)
public static Monitor getTimeMonitor(java.lang.String label)
Return the time monitor associated with the label. All statistics associated with the monitor can then be accessed such as hits, total, avg, min, and max. If the monitor does not exist it will be created.
Sample call:
Monitor mon=MonitorFactory.getTimeMonitor("myPrimaryMonitor");
public static Monitor getTimeMonitor(MonKey key)
public static boolean exists(java.lang.String label, java.lang.String units)
Determine if the monitor associated with the label, and the units currently exists.
Sample call:
Monitor mon=MonitorFactory.getTimeMonitor("myPrimaryMonitor");
public static boolean exists(MonKey key)
public static MonitorComposite getComposite(java.lang.String units)
Return the composite monitor (a collection of monitors) associated with the passed in units. Note in JAMon 1.0 this method would take a lable and would return all monitors that matched that criterion. This ability is now better performed using ArraySQL from the FormattedDataSet API. See JAMonAdmin.jsp for an example.
Sample call:
Monitor mon=MonitorFactory.getComposite("ms.");
mon=MonitorFactory.getComposite("allMonitors");
public static int getNumRows()
public static java.lang.String[] getRangeHeader()
public static java.lang.Object[][] getRangeNames()
public static MonitorComposite getRootMonitor()
public static java.lang.String getVersion()
public static void remove(java.lang.String label, java.lang.String units)
public static void remove(MonKey key)
public static void setMap(java.util.Map map)
public static java.util.Map getMap()
public static void setRangeDefault(java.lang.String key, RangeHolder rangeHolder)
public static void setEnabled(boolean enable)
public static void setDebugEnabled(boolean enable)
public static void enable()
public static void disable()
public static boolean isEnabled()
public static boolean isDebugEnabled()
public static boolean isGlobalActiveEnabled()
public static void enableGlobalActive(boolean enable)
public static void reset()
public static java.lang.String[] getHeader()
public static java.lang.Object[][] getData()
public static java.lang.String getReport()
public static java.lang.String getReport(java.lang.String units)
public static java.util.Iterator iterator()
public static void enableActivityTracking(boolean enable)
public static boolean isActivityTrackingEnabled()
public static void setMaxNumMonitors(int maxMonitors)
maxMonitors
- maximum number of monitors that JAMon can store.public static int getMaxNumMonitors()
public static void enableTotalKeySizeTracking()
public static void disableTotalKeySizeTracking()
public static boolean isTotalKeySizeTrackingEnabled()
public static long getTotalKeySize()
public static void main(java.lang.String[] args)