Log4J integration @ Perf4J migration

88 views
Skip to first unread message

Eishay

unread,
Dec 24, 2009, 1:38:38 PM12/24/09
to scala-stopwatch
Great work, like it!

I especially like the distribution stats, would you have an X
percentile (as in 95%) stats as well?

We're using perf4j with my java code. Would be nice to have some code
that would help me migrate between the libraries (like
apache.commons.logging for log libs). Our code use the perf4j
StopWatch with Guice injecting the implementation (Log4JStopWatch in
my case). Maybe there could be a wrapper implementation of the perf4j
StopWatch that composites the scala-stopwatch?

We also use log4j socket appender to pipe the events to a central hub,
do you think the scala-stopwatch could provide such mechanism (using
log4j or other).

Thanks, Eishay

Alex Boisvert

unread,
Dec 27, 2009, 4:21:06 PM12/27/09
to scala-s...@googlegroups.com
On Thu, Dec 24, 2009 at 10:38 AM, Eishay <eis...@gmail.com> wrote:
Great work, like it!

Thanks! :)
 

I especially like the distribution stats, would you have an X
percentile (as in 95%) stats as well?

It's not directly available now.  There's two main ways it can be calculated using the currently available data:  1) assuming a normal distribution and using the standard deviation, or 2) by using the time distribution and assuming hits are spread evenly over the discrete intervals.

I'm tempted to go with the second approach since I would rather not assume a normal distribution and leave it to the user to define a distribution range that's precise enough for its purpose.
 
We're using perf4j with my java code. Would be nice to have some code
that would help me migrate between the libraries (like
apache.commons.logging for log libs). Our code use the perf4j
StopWatch with Guice injecting the implementation (Log4JStopWatch in
my case). Maybe there could be a wrapper implementation of the perf4j
StopWatch that composites the scala-stopwatch?

I'm not sure I understand or maybe I don't see the benefit of compositing, given that perf4j and stopwatch largely overlap.  Are you talking about being able to switch from one to the other or using both at once?

The stopwatch interface of each framework can be easily abstracted in a few lines of code.  I'm not too keen in adding dependencies to stopwatch so I would rather leave this out for the time being -- unless there's a few people who are interested in this.
 
We also use log4j socket appender to pipe the events to a central hub,
do you think the scala-stopwatch could provide such mechanism (using
log4j or other).

Right now stopwatch doesn't do any logging on its own, however the current design allows you to hook a listener and perform logging whenever a stopwatch is updated (see StopwatchGroup.addListener).  

Implementing a Log4J forwarder is essentially a one-liner so I'd prefer showing an example on the website and having people include the code in their own codebase rather than adding dependencies at this point.  It keeps the footprint as small as possible and pushes responsiblity towards the need.

I will be adding distributed data collection in the future to support "real-time" monitoring of multiple JVM instances in an aggregated manner.  I haven't made up my mind on how this is going to work yet (push vs pull) but it's not going to be based on Log4J.  (But Log4J may still be used for logging + long-term statistical purpose).

cheers,
alex
Reply all
Reply to author
Forward
0 new messages