Metric Metrics tool for version Metrics-java

Source: Internet
Author: User

Introduced

Metrics is a package of metrics for Java services, embedded in Java code Metrics code, you can easily monitor the business code of the various indicators, at the same time, metrics can be very good with ganlia, graphite combination, Easy to provide graphical interface. The basic use of the core package (currently stable version 3.0.1) directly into the Pom file can be configured as follows:

< Dependency >
    < groupId >com.codahale.metrics</groupId>
    < Artifactid >metrics-core</artifactid>
    < version >3.0.1</version>
</ Dependency >

Core packages provide the following key features: Metrics registries is similar to a Metrics container, maintaining a map that can be an instance of a service. Supports five types of metric: Gauges, Counters, Meters, histograms, and timers. You can publish metrics values through JMX, console,csv files, and slf4j loggers. Five types of metrics:

    1. Gauges
      Gauges is one of the simplest metering, generally used to statistic instantaneous state data information, such as the system in the pending state of the job.
    2. Counter
      Counter is a special case of gauge, maintaining a counter that can be modified by the INC () and Dec () methods. The steps are basically similar to gauge, where static methods are provided in Metricregistry to instantiate a counter directly.
    3. Meters
      The meters is used to measure the average number of processing times (request per second) for a period of time, with TPS every 1, 5, 15 minutes. For example, the number of requests for a service, after instantiating a meter through metrics.meter (), and then using the Meter.mark () method to record this request. The total number of requests, the average number of requests per second, and the most recent average TPS of 1, 5, and 15 minutes are statistically obtained.
    4. Histograms
      The histograms is used primarily for statistical data distribution, maximum, minimum, average, median, percent (75%, 90%, 95%, 98%, 99%, and 99.9%). For example, you need to count the distribution of the request response time for a page, and you can use that type of metrics for statistics.
    5. Timers
      Timers is mainly used to count the execution time of a piece of code and its distribution, based on histograms and meters.
Health Checks

Metrics provides a standalone module: Health Checks, which is used to detect whether application, its submodules, or its associated modules are functioning properly. The module is a standalone Metrics-core module, and when used, imports the Metrics-healthchecks package.

< Dependency >                                   
< groupId >com.codahale.metrics</groupId>
       < Artifactid >metrics-healthchecks</artifactid>
< version >3.0.1</version>
</ Dependency >

It is somewhat similar to the above types of metrics, but it is necessary to re-instantiate a metrics container healthcheckregistry, the module to be detected inherits the abstract class Healthcheck and implements the check () method, The module is then registered to the Healthcheckregistry, which can be judged by the ishealthy () interface.
Other support

Metrics provides integration of Ehcache, Apache HttpClient, JDBI, Jersey, Jetty, log4j, Logback, JVM, etc., which can be easily exported to metrics, ganglia, Graphical display for the user. Resources

http://metrics.codahale.com/

Https://github.com/dropwizard/metrics

http://blog.csdn.net/scutshuxue/article/details/8350135

http://blog.synyx.de/2013/09/yammer-metrics-made-easy-part-i/

http://blog.synyx.de/2013/09/yammer-metrics-made-easy-part-ii/

Http://wiki.apache.org/hadoop/HADOOP-6728-MetricsV2

Metric Metrics tool for version Metrics-java

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.