Generally everything can be monitored with MoSKito. However, some things need to be monitored more often than others. And some things needs to be monitored so often, that they come out of the box. Here a list of Stats objects that come out of the box. Stat objects represents stats (statistics) about something that can be count. A single stat object represents usage of a single monitored object, that can be an url, method, a business case, a thread, memory pool, disk or filecpu or anything else worth monitoring.

Below you will see general stat class and what is monitored. 

Stats

The following diagram gives a short overview of stat classes that come out of the box.

 

Before we begin

How to read the table:

ValueMeaningShortcutsUnitNotes
name of the value of the appropriate classWhat does this attribute actually measureWhat shortcuts can be used for generic access to this valueWhat is the unit (time, amount etc)Something special to think about?

Please note, even the Value is the name of the StatValue Object used inside the *Stats object, the accessor methods can differ. For example, to add time to total time in totalRequests you have to call addExecutionTime. Also an accessor can do different type of things, for example:

	public void addRequest() {
		totalRequests.increase();
		currentRequests.increase();
		maxCurrentRequests.setValueIfGreaterThanCurrentAsLong(currentRequests.getValueAsLong());
	}
	public void addExecutionTime(long time) {
		totalTime.increaseByLong(time);
		lastRequest.setValueAsLong(time);
		minTime.setValueIfLesserThanCurrentAsLong(time);
		maxTime.setValueIfGreaterThanCurrentAsLong(time);
	}

Please refer to the documentation and examples on how to use the stat objects correctly (or use built-in annotations) (wink)

RequestOrientedStats. 

A huge bunch of stats is request oriented (method calls, urls, web-actions etc). The class net.anotheria.moskito.core.predefined.RequestOrientedStats provides general functionality for the request oriented stats. The concrete subclasses add only specific handling.

 

RequestOrientedStats

ValueMeaningShortcutsUnitNotes
totalRequestsNumber of times this request has been executedTR, REQAmount 
totalTimeTotal time spent in this requestTT, TIMETime, NS 
currentRequestsNumber of requests currently in this requestCRAmount 
maxCurrentRequestsMaximal recorded number of executions of this request concurrently.MCRAmount 
errorsNumber of recorded errors.ERRAmount 
lastRequestDuration of last request.LASTTime, NS 
minTimeMinimal duration of this request.MINTime, NS 
maxTimeMaximal duration of this request.MAXTime, NS 
averageTimeAverage duration of this request.AVGTime, NSCalculated by totalTime/totalRequests

 

 

ServiceStats

Used for service like components (Service, API etc), also for Dynamic Proxies (See net.anotheria.moskito.core.dynamic.MoskitoInvokationProxy) and @MonitorClass, @Monitor CDI and AOP annotations.

ServiceStats class has no additional fields.

 

ActionStats

ActionStats are used by/for action driven frameworks such as struts or ano-maf, but similar to ServiceStats, differs from the RequestStats just by name. The point of having different names(classes) is that it allows the stats to be presented in different decorators and not getting mixed in webui.

ServletStats

ServletStats is the extension of the request oriented stats for http servlets and have three additional values. Each method (get,put,head...) will get its own stats object with all the values. See net.anotheria.moskito.web.MoskitoHttpServlet for examples or easy to extend counting servlet.

ValueMeaningShortcutsUnitNotes
ioExceptionsNumber of io exceptions in this method.IOExcAmount 
servletExceptionsNumber of servlet exceptions in this method.SEExcAmount 
runtimeExceptionsNumber of runtime exceptions in this method.RTExcAmount 

FilterStats

Same as Servlet Stats, but for Filters. See net.anotheria.moskito.web.MoskitoFilter, net.anotheria.moskito.web.filters.DomainFilter, net.anotheria.moskito.web.filters.RefererFilter or net.anotheria.moskito.web.filters.RequestURIFilter for usage example or building your own.

 

Environment and JVM Stats

Environment and JVM Stats are a huge group of stats that are not produced by the Application directly, but by its environment, either the JVM or the operating system or hardware. Most of those stats are gathered from appropriate MBeans.

Memory

Memory is one of the most important parameters of any system in production. 

MemoryStats

Based on Runtime.freeMemory(), maxMemory() and totalMemory() this simple object gives some overview about the memory. MemoryStats are builtin and available ootb. See net.anotheria.moskito.core.util.BuiltInMemoryProducer. 

A MemoryStats object exists for each stat: free, max and total. The MemoryStats are updated once a minute by a Timer.

ValueMeaningShortcutsUnitNotes
currentCurrent amount of memoryCURSize, Bytes 
minMin amount of memory.MINSize, Bytes 
maxMax amount of memory.MAXSize, Bytes 


A small example how it looks like in the WebUI:


MemoryPoolStats

This stats object is based on the MemoryPoolMXBean and provides information about available memory pools. MemoryPoolStats are builtin and available ootb. See net.anotheria.moskito.core.util.BuiltInMemoryPoolProducer. MemoryPoolStats are updated once a minute by a Timer. 

MemoryPoolStats are much more precise than the MemoryStats. See java.lang.management.MemoryUsage for details.

ValueMeaningShortcutsUnitNotes
initInitial amountINITSize, BytesMemoryUsage.init
usedUsed in current interval.USEDSize, BytesMemoryUsage.used
minUsedMin used in current intervalMIN_USEDSize, Bytes 
maxUsedMax used in current intervalMAX_USEDSize, Bytes 
commitedCommited in current interval.COMMITEDSize, BytesMemoryUsage.commited
minCommitedMin commited.MIN_COMMITEDSize, Bytes 
maxCommitedMax commited.MAX_COMMITEDSize, Bytes 
maxMax available.MAXSize, BytesMemoryUsage.max



VirtualMemoryPoolStats

Sometimes its hard to calculate the different heap pools to one heap usage. VirtualMemoryPoolStats do exactly that by combining different pools by their heap-ness into heap and non-heap pools. VirtualMemoryPoolStats are builtin and available ootb. See net.anotheria.moskito.core.util.BuiltInMemoryPoolVirtualProducer. Virtual Memory Pool has exactly the same values (cumulated) as underlying pools and therefore the same values and shortcuts.

 

Threading

Threads are no less important than memory. The data is based on java.lang.management.ThreadMXBean.

ThreadCountStats

This stat object is for simple thread counting. It always has one stat. The data is updated once a minute. See net.anotheria.moskito.core.util.BuiltInThreadCountProducer.

ValueMeaningShortcutUnitsNote
startedThreads started in the interval.STARTEDAmount 
currentCurrently running threads.CUR, CURRENTAmount 
daemonCurrently running daemon threads.DAEMONAmount 
minCurrentMinimum amount of currently running threads.MIN, MINCURRENT, MIN CURAmount 
maxCurrentMaximum amount of currently running threads.MAX, MAXCURRENT, MAX CURAmount 

 

ThreadStateStats

ThreadStateStats are ment to hold amount of threads in each state (BLOCKED, WAITING etc). However, the corresponding producer is currently disabled as of 2.0.1.  If it would be reenabled, it would deliver following data for each possible STATE: 

ValueMeaningShortcutUnitsNote
currentCurrently running threads in this state.CURAmount 
minMinimum amount of currently running threads in this state.MINAmount 
maxMaximum amount of currently running threads in this state.MAXAmount 

Process

OSStats

OSStats are based on com.sun.management.UnixOperatingSystemMXBean and therefore only supported on Unix Platforms. 

ValueMeaningShortcutUnitsNote
openFilesCurrently open files in the process.openfiles, open filesAmount 
maxOpenFilesMax open files by the process.minopenfiles, min open filesAmount 
minOpenFilesMin open files by the process.maxopenfiles, max open filesAmount 
maxSupportedOpenFilesMax supported open files.maxsupportedopenfilesAmountThis value doesn't (shouldn't) change after start.
processCpuTimeCPU Time consumed by this processcputime, cpu timeTime, Millis 
freePhysicalMemoryFree physical memory.free memory, freeSize, Bytes 
totalPhysicalMemoryTotal physical memory.total memory, totalSize, BytesThis value doesn't (shouldn't) change after start.
processorsNumber of processors AmountThis value doesn't (shouldn't) change after start.

Example:

RuntimeStats

RuntimeStats are useful if you want to know how long your application is running without logging into the machine. They are not that relevant for monitoring. It is based on java.lang.management.RuntimeMXBean.

ValueMeaningShortcutUnitsNote
processNameCurrently running threads in this state.process, name, processnameString 
startTimeMinimum amount of currently running threads in this state.starttimeTime, Millis since 01.01.1970 
uptimeMaximum amount of currently running threads in this state.uptimeTime, Millis since start.

 

Example:

 

Keeping

Keeping refers to everything that is stored temporary somewhere (probably in memory) and is proceeded somehow. Keeping related stats can be used for capacity planing and monitoring and for throughput monitoring. Following Stats belong into this category:

CacheStats

CacheStats are good for monitoring ... caches! Alas if you want a collection of good and easy to use monitored caches - check out ano-prise-caches.

Not all cache implementations will provide every possible stat value.

ValueMeaningShortcutUnitsNote
requestsGet request to the cache.REQAmount 
hitsHit requests.HITAmount 
writesNumber of writes of new objects to the cache.WRAmount 
garbageCollectedNumber of items that were garbage collected.GCAmountOnly supported by SoftReferenceCaches or similar.
rolloverCountNumber of items that were rolled over.ROAmountOnly supported by fixed size caches with rollover. (RoundRobin)
expiredCountNumber of items that were expired.EXAmountOnly supported by expiry caches.
filteredCountNumber of items that were in cache but not returned due to filteringFIAmountOnly supported by caches that support filtering.
cacheFullCountNumber of times that the cache were full and refused write.FUAmountOnly supported by not rolling over caches.
deletesNumber of items removed from the cache.DELAmount 
hitratePercentage of hits among gets (hits/requests)HR Calculated

QueueStats

A queue in moskitos sense is something between two components, where one component (feeder) add stuff from one end, and the other (processor) works on the other end and removes it. Of course it can be many2many.

Despite their beautifulness, QueueStats are somewhat out of date and are subject to be reworked in near future. 

ValueMeaningShortcutUnitsNote
requestsRequest to put something in the queue. Amount 
enqueuedSuccessful request to put something in the queue. Amount 
dequeuedSuccessfully processed and therefore removed items. Amount 
emptyNumber of times the processor found the queue empty and had nothing to do. Amount 
totalSizeMax possible number of elements in the queue. Amount 
lastSizeSize at the moment of the last operation (which means number of elements in the queue) Amount 
sumOfSizesSum of element count in the queue at updates (puts). Amount 
maxSizeMax number of elements in the queue. Amount 
minSizeMin number of elements in the queue. Amount 

 

QueuingSystemStats

Used for monitoring of QueuingSystems. As for now, only one such system is known: net.anotheria.anoprise.processor.QueuedMultiProcessor.

Despite their beautifulness, QueuingSystemStats are somewhat out of date and are subject to be reworked in near future. 

ValueMeaningShortcutUnitsNote
serversSizeAmount of servers processing queue. Amount 
queueSizeNumber of elements in the queue. Amount 
arrivedNumber of arrived elements. Amount 
servicedNumber of serviced elements. Amount 
errorsNumber of errors. Amount 
waitedNumber of elements waiting for processing. Amount 
throwedAwayNumber of elements thrown away due to overflow. Amount 
waitingTimeWaiting time of the elements. Time, Millis 
waitingTimeMinMin waiting time of an element.. Time, Millis 
waitingTimeMaxMax waiting time of an element. Time, Millis 
servicingTimeTime spent servicing the elements. Time, Millis 
servicingTimeMinMin time was spent to serve an element. Time, Millis 
servicingTimeMaxMax time that was spent to serve an element. Time, Millis 

StorageStats

Storages are basically wrapper to maps. And storage stats monitor accesses to it. 

ValueMeaningShortcutsUnitsNote
 getscalls to get() method.  GAmount 
missedGetsgets that returned nullmGAmount 
putscalls to put() methodPAmount 
overwritePutscalls to put() methods that overwrote an existing valueoPAmount 
removescalls to remove() methodRMAmount 
noopRemovescalls to remove() method that had no effect (no element there)noRMAmount 
sizesize of the storageSZAmount 
containsKeyCallsCalls to containsKey methodCKCAmount 
containsKeyHitsCalls to containsKey method that returned not nullCKHAmountReason: Calls to containsKey method are expensive, its good to monitor them and their success.
containsValueCallsCalls to containsValue methodCVCAmount 
containsValueHitsCalls to containsValue method that returned not nullCVHAmountReason: Calls to containsValue method are VERY expensive, its good to monitor them and their success.
missedGets RatiomissedGets/getsmG RRatio, 0..1Calculated
hitGets Ratio(gets-missedGets)/getshG RRatio, 0..1Calculated
overwritingPut RatiooverwritePuts/putsoP RRatio, 0..1Calculated
newPuts Ratio(puts-overwritePuts)/putsnP RRatio, 0..1Calculated
noopRemoves RationoopRemoves/removesnoRM RRatio, 0..1Calculated
PutGet Ratioputs/getsPG RRatio,Calculated, if >1 you are putting more elements than you read, this can be unhealthy.
PutRemove Ratioputs/removesPRM RRatio, Calculated, if >1 you are putting more elements than you remove, this can be a memory leak.
containsKeyHitRatecontainsKeyHits/containsKeyCallsCK HRRatio, 0..1Calculated
containsKeyValueRatecontainsValueHits/containsValueCallsCV HRRatio, 0..1Calculated

Counters

Counters are basically lightweight producers. Extremely lightweight producers. The have one or multiple dimensions, where each dimension means one stat value. All Counters extend net.anotheria.moskito.core.counter.GenericCounterStats.

Counter

The counter is a useful utility for counting stuff. Easy as that. Combined with the @Count annotation for both aop and cdi, Counter allows simple counting of something count-worthy. Therefore it only has one property:

ValueMeaningShortcutUnitsNote
counterNumber of countable events.counter Amount 

MaleFemale

This is an example of two-dimensional counter and counts separately accesses by male and female users for each case (of course if you let it call it).

ValueMeaningShortcutUnitsNote
counterNumber of countable events.counter Amount 

GuestMemberPremium

This is an example of a three-dimensional counter.

ValueMeaningShortcutUnitsNote
guestNumber of countable events by guest users.guest Amount 
memberNumber of countable events by members (registered users).memberAmount 
premiumNumber of countable events by premium (paying) users.premiumAmount