{title:'REST method execution statistics', created:'8.1.3', updated:'9.0.0'}

{@link oajr.annotation.Rest}-annotated classes get automated timing and error statistic information for all @RestOp and lifecycle-event annotated methods on the class.

If you extend from {@link oajr.servlet.BasicRestServlet} or {@link oajr.servlet.BasicRestObject}, then the statics are made available through the REST interface via the following method:

@RestGet( path="/stats", summary="Timing statistics", description="Timing statistics for method invocations on this resource." ) @Override /* BasicRestOperations */ public RestContextStats getStats(RestRequest req) { return req.getContext().getStats(); }

Rendered in a browser, it looks like this:

The default REST configuration provides a link to the stats in the navlinks section of the page:

The exception hash shown is the same hash that is shown in the log file and provides a quick way of locating the exception in the logs.

Programmatic access to the statistics are provided via the following methods:

- {@link oajr.RestContext}
  - {@link oajr.RestContext#getStats() getStats()}