how to use data layer monitoring

37 views
Skip to first unread message

Garret Wilson

unread,
Nov 3, 2014, 11:11:56 AM11/3/14
to java...@googlegroups.com
I just found Java Simon and I'm excited to use it. I am successfully using a stopwatch in my application. But I want to monitor the JDBC calls.

I've followed the JavaEE documentation and switched to using the org.javasimon.jdbc4.Driver driver with a jdbc:simon:postgresql: URL. But now what? How do I monitor the JDBC activity? Does something get logged? Do I have to configure it? Is there a named stopwatch I access? I couldn't find any information on this.

Richard Richter

unread,
Nov 3, 2014, 12:27:42 PM11/3/14
to java...@googlegroups.com
Hi Garret

If you can debug your application, just stop it anywhere and try
executing something like (e.g. from IntelliJ IDEA Expression
Evaluation):
System.out.println(SimonUtils.simonTreeString(SimonManager.getRootSimon()));

You should see Simon tree output in the console. Without printing
you'll get the string in debugger directly. Now - this is the start to
get proof that it works.

Next - depending on your environment - you may use JMX or WebConsole.

For JMX, see wiki page https://code.google.com/p/javasimon/wiki/JMX or
check our examples here:
https://github.com/virgo47/javasimon/tree/master/examples/src/main/java/org/javasimon/examples/jmx
Perhaps this is the best one:
https://github.com/virgo47/javasimon/blob/master/examples/src/main/java/org/javasimon/examples/jmx/JmxReporterExample.java

For Web console, check this: https://code.google.com/p/javasimon/wiki/WebConsole
Example web.xml from demo app:
https://github.com/virgo47/javasimon/blob/master/demoapp/src/main/webapp/WEB-INF/web.xml

Again, the best thing is to debug our SimonServletFilter.doFilter
(measures the stuff) and SimonConsoleRequestProcessor.processRequest
which is common for both filter and servlet version of the web
console. Especially SimonServletFilter's plain-text "console" may be
tricky to get to - honestly I'm not sure right now whether the
configured path is absolute from context, or from servlet that is
accessed. But it really is easy to debug.

Cheers

Virgo
> --
> You received this message because you are subscribed to the Google Groups
> "javasimon" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to javasimon+...@googlegroups.com.
> To post to this group, send email to java...@googlegroups.com.
> Visit this group at http://groups.google.com/group/javasimon.
> For more options, visit https://groups.google.com/d/optout.

Garret Wilson

unread,
Nov 3, 2014, 1:21:55 PM11/3/14
to java...@googlegroups.com
So I understand that the web console is one way to see the JDBC requests?

I just installed the web console on embedded Jetty. I haven't yet done any extensive JDBC communication. I try to click on "Tree View" and the browser (Chrome) says "Server request failed:[object Object".

Garret Wilson

unread,
Nov 3, 2014, 1:33:01 PM11/3/14
to java...@googlegroups.com
I get the error message when trying to access tree view both in Chrome 38 and in Firefox 33.0.2.

Note also that the next page button does not work in the "List View" tab. If I'm displaying 25 entries, for example, I click the "next" arrow and I get the next page, but then it immediately reverts back to the first page.

I also don't see any of the stopwatches I'm using in my web application. Note that, instead of using the SimonManager global instance (I don't like global variables), I created a separate SwitchingManager just for our application. Is that why the web console can't see it?

Garret Wilson

unread,
Nov 3, 2014, 1:37:32 PM11/3/14
to java...@googlegroups.com
So I tried to temporarily switch to using the global SimonManager, but that class has no way to access its private singleton Manager instance! I've set up our application to work with any given Manager, but how can I make it work with the global manager if SimonManager doesn't allow me access to the global manager reference?

Richard Richter

unread,
Nov 3, 2014, 3:00:28 PM11/3/14
to java...@googlegroups.com
Hi Garret

I see your problems with Web console now... Pagination doesn't work
and Tree view indeed throws that error, I'm sorry for that. Trouble is
that web console is currently not supported - which means that you can
use JMX or plaintext output from SimonServletFilter's console part -
or collect the stuff yourself somehow else.

SimonManager provides access to the static manager instance - method
is called simply manager().

Using other than default instance is generally tricky - especially for
JDBC driver. Imagine Java EE environment where you configure data
sources in application server - this means you have to have Java Simon
in server libs already. Data Source may start before the
application... these are all areas that are not satisfactorily covered
out of the box.

I'm not hiding the fact that the collecting/viewing/reporting part of
the Simon is its weak link. JMX is probably working best. Generally it
shouldn't be problem to code up anything specific either.

Cheers

Virgo

Garret Wilson

unread,
Nov 3, 2014, 3:07:53 PM11/3/14
to java...@googlegroups.com
On Monday, November 3, 2014 12:00:28 PM UTC-8, Virgo47 wrote:
Hi Garret

I see your problems with Web console now... Pagination doesn't work
and Tree view indeed throws that error, I'm sorry for that. Trouble is
that web console is currently not supported

Oh...

Are there plans in the future to make it production-ready?

If we leave it as a hidden link in our application (just for our engineers when troubleshooting), should that be OK, or will it make the production system (with embedded Jetty) unstable?

 
...

SimonManager provides access to the static manager instance - method
is called simply manager().


Ah, very good to know. Thanks.

 

Using other than default instance is generally tricky - especially for
JDBC driver.


Fair enough, but I was just wanting to know how to get the global manager instance. My point is that I'm writing my code to use the Manager interface, not SimonManager, so that I can configure which manager they use (including the global one if I so desire).

 

I'm not hiding the fact that the collecting/viewing/reporting part of
the Simon is its weak link. JMX is probably working best.

OK, but I'll have to experiment with that in our next software release. I'm putting the Java Simon stuff in at the last minute, but the actual stopwatch and split stuff are really nice.

Garret

Richard Richter

unread,
Nov 3, 2014, 3:44:41 PM11/3/14
to java...@googlegroups.com
I'm not sure about web console right now, so no promisses.

About SimonServletFilter's console - or any console for that matter -
you should somehow protect it. This is left to web.xml configuration,
it's up to the developer whether they use JAAS, something custom,
Spring Security, etc. There should be no risk to the application -
though I wouldn't risk it if you're controlling nuclear reactor. ;-)
There is possibility to clear the manager (remove all simons), which
may be of concern.

Virgo

Gérald Quintana

unread,
Nov 4, 2014, 1:09:14 AM11/4/14
to java...@googlegroups.com

Hello,

I'll have a look at web console. Richard, do you have a clue about thé problem?

Gerald

Richard Richter

unread,
Nov 4, 2014, 3:01:22 AM11/4/14
to java...@googlegroups.com
Hi Gerald :-)

No I don't have much clue, really. Right now I'm not actively using
Console. Will you fork JavaSimon on GitHub? I have to grasp pull
requests first, but I think it's time to try it.

@Garret, are you using 4.0.0 or older 3.5 version?

V.

Garret Wilson

unread,
Nov 4, 2014, 8:12:19 AM11/4/14
to java...@googlegroups.com
On 11/4/2014 12:01 AM, Richard Richter wrote:
> ...
> @Garret, are you using 4.0.0 or older 3.5 version?

I'm using 4.0.0.

Garret

Gérald Quintana

unread,
Nov 4, 2014, 3:12:58 PM11/4/14
to java...@googlegroups.com
  • "the next page button does not work in the "List View" tab." the auto refresh feature is causing problems with pagination (when data is refreshed, current page is reset). For the moment, just disable it by selecting auto refresh=never, and use manual refresh by clicking on the refresh button.
  • ""Tree View" and the browser (Chrome) says "Server request failed:[object Object"." this message means the browser can not talk to the server to get fresh data. Again, autorefresh makes things worse because server is queried periodically.
Gérald

--
You received this message because you are subscribed to the Google Groups "javasimon" group.
To unsubscribe from this group and stop receiving emails from it, send an email to javasimon+unsubscribe@googlegroups.com.

Gérald Quintana

unread,
Nov 4, 2014, 3:13:32 PM11/4/14
to java...@googlegroups.com
  • "the next page button does not work in the "List View" tab." the auto refresh feature is causing problems with pagination (when data is refreshed, current page is reset). For the moment, just disable it by selecting auto refresh=never, and use manual refresh by clicking on the refresh button.
  • ""Tree View" and the browser (Chrome) says "Server request failed:[object Object"." this message means the browser can not talk to the server to get fresh data. Again, autorefresh makes things worse because server is queried periodically.
Gérald

Le Tue Nov 04 2014 at 14:12:19, Garret Wilson <gar...@globalmentor.com> a écrit :
--
You received this message because you are subscribed to the Google Groups "javasimon" group.
To unsubscribe from this group and stop receiving emails from it, send an email to javasimon+unsubscribe@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages