Download Jersey 2.10 User Guide

Transcript
Monitoring and Diagnostics
Statistics can be found in MBeans MethodTimes and RequestTimes. MethodTimes contains
statistics measured on on resource methods (duration of execution of a code of the a resource method),
whereas RequestTimes contains statistics of an entire request execution (not only a time of the
execution of the resource method but the overall time of the execution of whole request by Jersey runtime).
Another useful information is that statistics directly under resource (not under the methods sub-group)
contains summary of statistics for all resource methods grouped in the resource entry.
Additional useful details that about statistics
• Global->Configuration->Registered(Classes/Instances): registered resource
classes and instances by the user (i.e., not added by ModelProcessor [https://jersey.java.net/
apidocs/2.10/jersey/org/glassfish/jersey/server/model/ModelProcessor.html] during deployment for
example).
• Global->ExceptionMapper->ExceptionMapperCount: map that contains exception
mapper classes as keys and number of their execution as values.
• Global->Responses->ResponseCodesToCountMap: map that contains response codes as
keys and their total occurrence in responses as values.
• Resource groups contain also entries for resources that were added by Jersey at deployment time using
ModelProcessor (for example all OPTIONS methods, WADL). HEAD methods are not present in the
MXBeans view (even HEAD methods are in resources).
• Execution statistics for different time windows have different update intervals. The shorter the time
window, the shorter the update interval. This causes that immediately after the application start, the
shorter time windows (such as 15 seconds) may contain higher values than longer ones (e.g. 1 hour time
window). The reason is that 1 hour interval will show information that is not up to date and therefore has
smaller value. This inconsistency is not so much significant when application is running longer time.
Total unlimited time windows contains always up-to-date data. This inconsistency will get fixed in a
future Jersey release.
MXBeans can be also accessed using JMX. To do so, you would need to use the interfaces of MXBeans.
These interfaces are even useful when working with MXBeans only trough JConsole as they contain
Javadocs for each MXBean and attribute. Monitoring MBeans are defined by following interfaces:
• ApplicationMXBean
[https://jersey.java.net/apidocs/2.10/jersey/org/glassfish/jersey/server/
monitoring/ApplicationMXBean.html]: contains configuration statistics
• ExceptionMapperMXBean
[https://jersey.java.net/apidocs/2.10/jersey/org/glassfish/jersey/server/
monitoring/ExceptionMapperMXBean.html]: contains statistics of exception mappers
• ResourceMethodMXBean
[https://jersey.java.net/apidocs/2.10/jersey/org/glassfish/jersey/server/
monitoring/ResourceMethodMXBean.html]: contains statistics of resource method
• ResourceMXBean [https://jersey.java.net/apidocs/2.10/jersey/org/glassfish/jersey/server/monitoring/
ResourceMXBean.html]: contains statistics of resource
• ResponseMXBean [https://jersey.java.net/apidocs/2.10/jersey/org/glassfish/jersey/server/monitoring/
ResponseMXBean.html]: contains statistics of responses
The list does not contain MXBean for the execution and time window statistics. The reason is that
this bean is defined as a DynamicMBean [http://docs.oracle.com/javase/6/docs/api/javax/management/
DynamicMBean.html]. Attributes of this dynamic MBean contains statistics for all time windows
available.
247