TQdev.com's Metrics for Jetty 9.3 and higher

Instrumentation of the Jetty thread pool and request handler to identify application bottlenecks by status code, method and path.

License

License

Categories

Categories

Jetty Container Application Servers Metrics Application Testing & Monitoring Monitoring
GroupId

GroupId

com.tqdev.metrics
ArtifactId

ArtifactId

metrics-jetty
Last Version

Last Version

0.9.26
Release Date

Release Date

Type

Type

jar
Description

Description

TQdev.com's Metrics for Jetty 9.3 and higher
Instrumentation of the Jetty thread pool and request handler to identify application bottlenecks by status code, method and path.

Download metrics-jetty

How to add to project

<!-- https://jarcasting.com/artifacts/com.tqdev.metrics/metrics-jetty/ -->
<dependency>
    <groupId>com.tqdev.metrics</groupId>
    <artifactId>metrics-jetty</artifactId>
    <version>0.9.26</version>
</dependency>
// https://jarcasting.com/artifacts/com.tqdev.metrics/metrics-jetty/
implementation 'com.tqdev.metrics:metrics-jetty:0.9.26'
// https://jarcasting.com/artifacts/com.tqdev.metrics/metrics-jetty/
implementation ("com.tqdev.metrics:metrics-jetty:0.9.26")
'com.tqdev.metrics:metrics-jetty:jar:0.9.26'
<dependency org="com.tqdev.metrics" name="metrics-jetty" rev="0.9.26">
  <artifact name="metrics-jetty" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.tqdev.metrics', module='metrics-jetty', version='0.9.26')
)
libraryDependencies += "com.tqdev.metrics" % "metrics-jetty" % "0.9.26"
[com.tqdev.metrics/metrics-jetty "0.9.26"]

Dependencies

compile (1)

Group / Artifact Type Version
com.tqdev.metrics : metrics-core jar 0.9.26

provided (1)

Group / Artifact Type Version
org.eclipse.jetty : jetty-server jar 9.4.7.v20170914

test (4)

Group / Artifact Type Version
org.eclipse.jetty : jetty-client jar 9.4.7.v20170914
org.mockito : mockito-all jar 1.10.19
junit : junit jar 4.12
org.assertj : assertj-core jar 3.8.0

Project Modules

There are no modules declared in this project.

Build Status Coverage Status

TQdev.com's Metrics

This is a light-weight Java library to measure the behavior of critical components in a production environment.

Requirements

  • Java 8

Modules

  • metrics-core stores your metrics (you always need this module)
  • metrics-aspectj instruments Java methods aggregated on method name
  • metrics-jdbc instruments SQL queries aggregated on prepared statement
  • metrics-jetty instruments HTTP requests aggregated on HTTP verb and response status and instruments thread counts
  • metrics-spring-security instruments Spring requests aggregated on authenticated username
  • metrics-spring-webmvc instruments Spring requests aggregated on request path and handler name
  • metrics-jvm instruments current JVM system properties
  • metrics-sigar is not implemented yet
  • metrics-influxdb exports metrics to disk (rotated) and HTTP endpoint using the InfluxDB line protocol
  • metrics-prometheus exports metrics to disk (rotated or for node_exporter) in Prometheus text format
  • metrics-jmx exports metrics over a JMX connection using the JMX RMI protocol
  • metrics-spring-loaders can be component scanned to load all modules

Philosophy

Where possible things are measured as an increasing value (monotonically increasing counter). So instead of measuring 10, 10, 10 for a constant value you will have 10, 20, 30. This way you can get cheap aggregates (at any given resolution), as you don't have to visit every value.

Some values (such as "current thread count") cannot be stored as a counter. These values are not converted to monotonically increasing counters, but they are represented by long integers that are retrieved from the underlying system when they are read (on-demand).

Counters use two long integers per metric: one for duration in nanoseconds and one for invocation count. For on-demand measured values (Gauges) it also uses a long integer to unify the storage model. It is recommended that you send the metrics every 10 seconds to a time series database such as InfluxDB. In InfluxDB you can then use the "non_negative_derivative" function to graph the measured values.

Getting started

If you are using Spring you can add a "ComponentScan" annotation to your application to add "com.tqdev.metrics.spring.loaders" as a scanned package, as you can see here:

@SpringBootApplication
@ComponentScan({ "org.springframework.samples.petclinic", "com.tqdev.metrics.spring.loaders" })
public class PetClinicApplication {
    public static void main(String[] args) throws Exception {
	    SpringApplication.run(PetClinicApplication.class, args);
    }
}

This is all you have to change in your code to get started (apart from adding the dependencies to your maven or gradle config). After application has started you may connect to it using "jconsole" and see the collected metrics via JMX under "com.tqdev.metrics" (configurable).

Release It to Maven Central

$ mvn versions:set -DnewVersion=[major.minor.patch]
$ mvn clean package deploy

Versions

Version
0.9.26
0.9.25
0.9.24
0.9.23
0.9.22
0.9.21
0.9.19
0.9.18
0.9.17
0.9.16
0.9.15
0.9.14
0.9.13
0.9.12
0.9.11
0.9.10
0.9.9
0.9.8
0.9.7
0.9.6
0.9.5
0.9.4
0.9.3
0.9.2
0.9.1
0.9.0