您的位置:首页 > 理论基础 > 计算机网络

Apache Sirona Java应用监视器,能够实时获得每个http/JDBC响应时间

2016-10-21 12:20 246 查看
官方URL:http://sirona.incubator.apache.org/quick-start.html


Quick Start

How to enable Apache Sirona in your web application.

NOTE: this simple configuration save figures in memory (so no more after restart!!)

If you want to store datas, you must have a look at the Cassandra Storage.


Declare version

 
<properties>
<sirona.version>0.2-incubating</sirona.version>
</properties>
 
<dependencies>
....
<!-- sirona dependencies -->
<dependency>
<groupId>org.apache.sirona</groupId>
<artifactId>sirona-core</artifactId>
<version>${sirona.version}</version>
</dependency>
<dependency>
<groupId>org.apache.sirona</groupId>
<artifactId>sirona-reporting</artifactId>
<version>${sirona.version}</version>
<classifier>classes</classifier>
</dependency>
...
</dependencies>


Configuration

If you are using a servlet 3.0 container nothing to do as we use ServletContainerInitializer mechanism. Otherwise you need to configure the filter class org.apache.sirona.reporting.web.SironaController .
In web.xml

<!-- activated per default -->
<context-param>
<param-name>org.apache.sirona.reporting.activated</param-name>
<param-value>true</param-value>
</context-param>
<!-- path in the application default is /sirona -->
<context-param>
<param-name>org.apache.sirona.reporting.mapping</param-name>
<param-value>/monitoring</param-value>
</context-param>


Using

Just start your application and now browse /sirona (or the path you configured) and have fun (or not).
NOTE: the configuration include only basic collectors. If you need more figures you need to add more dependencies


More figures


Web figures

To collect various web informations as:
response time per http return code
hits, response time etc.. per http path
number of active sessions
etc.. see Web plugin.
Simply add the dependency:

<dependencies>
....
<dependency>
<groupId>org.apache.sirona</groupId>
<artifactId>sirona-web</artifactId>
<version>${sirona.version}</version>
</dependency>
...
</dependencies>


JDBC

To collect response time for jdbc queries.
Add the dependency:

<dependencies>
....
<dependency>
<groupId>org.apache.sirona</groupId>
<artifactId>sirona-jdbc</artifactId>
<version>${sirona.version}</version>
</dependency>
...
</dependencies>

Configure the jdbc driver now
Normal configuration:

driverClassName="org.apache.derby.jdbc.EmbeddedDriver"
url="jdbc:derby:${appserver.base}/database/users;create=true"

Sirona configuration:

driverClassName="org.apache.sirona.jdbc.SironaDriver"
url="jdbc:sirona:derby:${appserver.base}/database/users;create=true?delegateDriver=org.apache.derby.jdbc.EmbeddedDriver"
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: