public class MonitorFactory extends Object
Modifier and Type | Field and Description |
---|---|
static 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(String label,
String units,
double value)
Aggregate the passed in value with the monitor associated with the label, and the units.
|
static Monitor |
addException(Monitor mon,
Throwable throwable)
Add 2 exception monitors.
|
static Monitor |
addException(Throwable throwable)
Track an exception except there is no other associated monitor to put the details in.
|
static void |
addListeners(List<JamonPropertiesLoader.JamonListenerProperty> listeners)
Add listeners.
|
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(String label,
String units)
Determine if the monitor associated with the label, and the units currently exists.
|
static MonitorComposite |
getComposite(String units)
Return the composite monitor (a collection of monitors) associated with the passed in units.
|
static 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 String[] |
getHeader()
Deprecated.
|
static Map |
getMap() |
static int |
getMaxNumMonitors()
Get the maximum number of monitors that JAMon can store.
|
static int |
getMaxSqlSize()
Return the size that sql statements can be before truncating them.
|
static Monitor |
getMonitor() |
static Monitor |
getMonitor(MonKey key)
Get the monitor associated with the passed in key.
|
static Monitor |
getMonitor(String label,
String units)
Return the monitor associated with the label, and units.
|
static int |
getNumRows()
This returns the number of monitors in this factory.
|
static String[] |
getRangeHeader()
Return the header for displaying what ranges are available.
|
static Object[][] |
getRangeNames()
Return the ranges in this factory.
|
static String |
getReport()
This returns an HTML report for basic data with no range info in the header.
|
static String |
getReport(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(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 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 Iterator |
iterator()
Deprecated.
|
static void |
remove(MonKey key)
Remove the monitor associated with the passed in key
|
static void |
remove(String label,
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(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 |
setMaxSqlSize(int size)
Set the maximum size for a sql statement.
|
static void |
setRangeDefault(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(String label)
Return a timing monitor with units in milliseconds.
|
static Monitor |
startNano(MonKey key)
Provide your own key to a nanosecond timer
|
static Monitor |
startNano(String label)
start nanosecond timer
|
static Monitor |
startPrimary(MonKey key)
Start a monitor with the specified key and mark it as primary
|
static Monitor |
startPrimary(String label)
Return a timing monitor with units in milliseconds, that is not aggregated into the jamon stats.
|
public static final String EXCEPTIONS_LABEL
public static MonitorFactoryInterface getFactory()
public static MonitorFactoryInterface getDebugFactory()
Sample Call: MonitorFactory.getDebugFactory().start();
public static Monitor add(String label, String units, double value)
Sample call:
Monitor mon=MonitorFactory.add("bytes.sent","MB", 1024);
public static Monitor add(MonKey key, double value)
public static Monitor start(String label)
Sample call:
Monitor mon=MonitorFactory.start("pageHits");
...code being timed...
mon.stop();
public static Monitor start()
Sample call:
Monitor mon=MonitorFactory.start();
...code being timed...
mon.stop();
public static Monitor getMonitor()
public static Monitor startPrimary(String label)
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(String label, String units)
Sample call:
Monitor mon=MonitorFactory.getMonitor("myPrimaryMonitor");
public static Monitor getMonitor(MonKey key)
public static Monitor getTimeMonitor(String label)
Sample call:
Monitor mon=MonitorFactory.getTimeMonitor("myPrimaryMonitor");
public static Monitor getTimeMonitor(MonKey key)
public static boolean exists(String label, String units)
Sample call:
Monitor mon=MonitorFactory.getTimeMonitor("myPrimaryMonitor");
public static boolean exists(MonKey key)
public static MonitorComposite getComposite(String units)
Sample call:
Monitor mon=MonitorFactory.getComposite("ms.");
mon=MonitorFactory.getComposite("allMonitors");
public static int getNumRows()
public static String[] getRangeHeader()
public static Object[][] getRangeNames()
public static MonitorComposite getRootMonitor()
public static String getVersion()
public static void remove(MonKey key)
public static void setMap(Map map)
public static Map getMap()
public static void setRangeDefault(String key, RangeHolder rangeHolder)
public static void setEnabled(boolean enable)
public static void setDebugEnabled(boolean enable)
Sample Call:
MonitorFactory.setDebugEnabled(false);
MonitorFactory.getDebugFactory().start(); // no stats are gathered.
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()
@Deprecated public static String[] getHeader()
public static Object[][] getData()
public static String getReport()
public static String getReport(String units)
@Deprecated public static 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 setMaxSqlSize(int size)
size
- public static int getMaxSqlSize()
public static Monitor addException(Monitor mon, Throwable throwable)
mon
- optional monitor where we want to store the stack trace.throwable
- exception that we want to create a monitor forpublic static Monitor addException(Throwable throwable)
throwable
- exception to create a monitor for.public static void addListeners(List<JamonPropertiesLoader.JamonListenerProperty> listeners)
Copyright © 2015. All rights reserved.