Beet Statistical MBeans

Beet records very detailed data (at the single event level) via the xml or jdbc peristers. If you want access to higher-level aggregate statistics at runtime, without necessitating direct access to the logs, you can configure the <bt:mbean-persister>. This is also a useful strategy for integrating beet statistics with system monitoring tools that support JMX.

Example 4.2. Activating Beet Statistical MBeans

<bt:manager application="myapp"1
            track-method-expression="execution(* com.mtgi.analytics..*Tracked(..))">
               <bt:persister-chain>2
                  <bt:xml-persister/>
                  <bt:mbean-persister/>
               </bt:persister-chain>
</bt:manager>

2

Like the Beet Administrative MBeans, the application attribute value is used as the domain name of statistical MBeans.

2

While you can use the <bt:mbean-persister> by itself, it is recommended that you use it as part of a <bt:persister-chain> so that your data is saved for later, deeper analysis.


When the mbean persister is registered, a single MBean is created in your application domain for each distinct type of event. MBeans are also named hierarchically according to their parent events. For example, statistics for the Java method MyClass.myMethod invoked from the HTTP request /myApp/save.do are tracked separately than statistics for the same method when invoked from the HTTP request /myApp/delete.do. All statistics MBeans support the following operations and attributes:

Beet Statistics MBean Features
NameTypeDescription
CountattributeThe number of times this event has occurred.
ErrorCountattributeThe number of times this event ended in error.
AverageTimeattributeThe average execution time, in the selected unit.
MaxTimeattributeThe maximum execution time, in the selected unit.
MinTimeattributeThe minimum execution time, in the selected unit.
StandardDeviationattributeThe standard deviation from the mean, in the selected unit.
LastInvocationattributeThe most recent date and time at which this event occurred.
UnitsattributeThe unit of measure for max, min, average, and stddev. Valid values are seconds, milliseconds, and nanoseconds. Defaults to milliseconds if unspecified.
resetoperationReset statistics for this type of event.

Beet Statistical MBeans

JConsole 6 with Beet Statistical MBeans. Note the hierarchical grouping of events, so that we can quantify the impact of jdbc updates on the method that triggered them, and in turn the impact of that method on the URI that invoked it.