Skip to content

ametiste-oss/ametiste-metrics

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Ametiste metrics library

Build Status

CI Statuses

Build Status Codacy Badge codecov.io

Latest Stable

Download

Current Development

Download

Overview

Ametiste metrics is a library for easy metrics registration from any point of client code.

Documentation

Library at a glance is described here, for more detailed description view wiki

Usage example

To register a metric for a method, one of following annotations may be applied to it:

  • @Countable
  • @ErrorCountable
  • @Timeable
  • @Chronable
  • @Gaugeable

@Countable is used when incremental count is required - on any joint point, such is request count, method call count, and so on. Only counts number of successfully executed operations.

@ErrorCountable is used when count of executions completed with exceptions is required - works similarly to @Countable but for joint points ended with errors.

@Timeable is used when method execution time is required.

@Chronable is used to chronate data from flow. Value of chronable data is regulated by its value or value expression, i.e. can be any event data that is to be saved in timeline (method arguments or execution result numerical values, counts or phase of moon, etc)

@Gaugeable is used to measure executions with gauge. Only successful operations are measured.

Example:

@Timeable(name="my.neat.metric")
public void justAMethod(String parameter) {
}

For further annotation usage details view Annotation examples

Metrics library can be used directly, without annotations, by injecting metrics service to client code. For more detailed library description and custom configuration view Ametiste metrics wiki

Binaries

All non experimental dependencies is accessible at bintray central.

Usage snippets

Gradle
repositories {
     mavenCentral()
     jcenter()
}
compile ""org.ametiste.metrics:metrics-default-starter:${metricsVersion}"
Maven
<repositories>
    <repository>
      <snapshots>
        <enabled>false</enabled>
      </snapshots>
      <id>central</id>
      <name>bintray</name>
      <url>http://jcenter.bintray.com</url>
    </repository> 
</repositories>

<dependency>
	<groupId>org.ametiste.metrics</groupId>
	<artifactId>metrics-default-starter</artifactId>
	<version>metrics.version</version>
</dependency>

Aspects and metric service should be configured to start using metrics annotations. There are several ways to use metrics service, from easiest to most specific.

Metrics service with spring boot

Adding 'org.ametiste.metrics:metrics-default-starter:{metricsVersion}' dependency in classpath of spring boot project provides it with default most commonly used configuration, and if autoconfiguration is enabled, it requires no further actions for usage. For more details and alternative usages view Installation and configuration wiki page