I recently read this article on GWT Lightweight Metrics and found it intriguing, but as a complete newbie, couldn’t make entire sense of it all.
I was already planning on using something like gwt-log for all my client-side logging. Every time an Event is placed on the EventBus, and subsequently when it is handled inside a Handler, I would use this logging framework to do something akin to a console.log() entry.
Now after reading up on Lightweight Metrics, I’m wondering several things:
- Is Lightweight Metrics an alternative to my own custom event logging, or can I use it in conjunction with
gwt-log? - Does it offer any benefits over my own custom logging system (
console.log()when something interesting happens)? - What types of events should you monitor?
- When/where do you call the global collector function? Is it all supposed to be written in JS or in Java?
Thanks in advance for any help!
Lightweight Metrics is useful particularly when you want to measure the performance of a GWT application. Using this you can measure the time taken for bootstrapping the application, loading of resource, RPC calls etc.
gwt-log is purely used for logging purpose.
You can prefer Lightweight Metrics system if you want to focus on measuring performance.
The type of events for monitoring depends on you. There are events like bootstrapping, RPC calls which monitored by default.
The global collector function is used by Lightweight Metrics system to log events which are shown in a HTML page of your application. You can also call this when you want to log your own events.
The global collector function is written in JS and it is placed in your host HTML page.