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

1 篇文章 0 订阅

官方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

   
   
  1.  
  2. <properties>
  3. <sirona.version>0.2-incubating</sirona.version>
  4. </properties>
  5.  
  6. <dependencies>
  7. ....
  8. <!-- sirona dependencies -->
  9. <dependency>
  10. <groupId>org.apache.sirona</groupId>
  11. <artifactId>sirona-core</artifactId>
  12. <version>${sirona.version}</version>
  13. </dependency>
  14. <dependency>
  15. <groupId>org.apache.sirona</groupId>
  16. <artifactId>sirona-reporting</artifactId>
  17. <version>${sirona.version}</version>
  18. <classifier>classes</classifier>
  19. </dependency>
  20. ...
  21. </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

   
   
  1. <!-- activated per default -->
  2. <context-param>
  3. <param-name>org.apache.sirona.reporting.activated</param-name>
  4. <param-value>true</param-value>
  5. </context-param>
  6. <!-- path in the application default is /sirona -->
  7. <context-param>
  8. <param-name>org.apache.sirona.reporting.mapping</param-name>
  9. <param-value>/monitoring</param-value>
  10. </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:

   
   
  1. <dependencies>
  2. ....
  3. <dependency>
  4. <groupId>org.apache.sirona</groupId>
  5. <artifactId>sirona-web</artifactId>
  6. <version>${sirona.version}</version>
  7. </dependency>
  8. ...
  9. </dependencies>

JDBC

To collect response time for jdbc queries.

Add the dependency:

   
   
  1. <dependencies>
  2. ....
  3. <dependency>
  4. <groupId>org.apache.sirona</groupId>
  5. <artifactId>sirona-jdbc</artifactId>
  6. <version>${sirona.version}</version>
  7. </dependency>
  8. ...
  9. </dependencies>

Configure the jdbc driver now

Normal configuration:

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

Sirona configuration:

   
   
  1. driverClassName="org.apache.sirona.jdbc.SironaDriver"
  2. url="jdbc:sirona:derby:${appserver.base}/database/users;create=true?delegateDriver=org.apache.derby.jdbc.EmbeddedDriver"

  • 2
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值