https://github.com/aurasphere/jmx-metrics-filter
Servlet filter implementation for extracting metrics and exposing them on JMX
https://github.com/aurasphere/jmx-metrics-filter
dropwizard-metrics jmx metrics micrometer servlet-container servlet-filter spring-boot web-application
Last synced: 29 days ago
JSON representation
Servlet filter implementation for extracting metrics and exposing them on JMX
- Host: GitHub
- URL: https://github.com/aurasphere/jmx-metrics-filter
- Owner: aurasphere
- License: mit
- Created: 2019-11-05T16:16:28.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2020-09-07T23:16:52.000Z (almost 6 years ago)
- Last Synced: 2026-03-11T05:31:09.834Z (3 months ago)
- Topics: dropwizard-metrics, jmx, metrics, micrometer, servlet-container, servlet-filter, spring-boot, web-application
- Language: Java
- Homepage:
- Size: 34.2 KB
- Stars: 0
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://travis-ci.org/aurasphere/jmx-metrics-filter)
[](https://search.maven.org/artifact/co.aurasphere.metrics/jmx-metrics-filter-jdk5/1.0.0/jar)
[](http://javadoc.io/doc/co.aurasphere.metrics/jmx-metrics-filter-jdk5)
[](https://codeclimate.com/github/aurasphere/jmx-metrics-filter/maintainability)
[](https://codeclimate.com/github/aurasphere/jmx-metrics-filter/test_coverage)
[](https://gitter.im/jmx-metrics-filter/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
[](https://www.paypal.com/donate/?cmd=_donations&business=8UK2BZP2K8NSS)
# JMX Metrics Filter
Servlet filter implementation for extracting metrics and exposing them on JMX. The filter will expose a bean for each combination of endpoint/HTTP status code with the invocation time stats (average, minimum, maximum...).
Two artifacts are provided:
- **jmx-metrics-filter-jdk8**, backward compatibile with Java 8, based on [micrometer.io](http://micrometer.io)
- **jmx-metrics-filter-jdk5**, backward compatibile with Java 5, based on [metrics.dropwizard.io](https://metrics.dropwizard.io)
## Usage
To import the library using Maven, add this to your `pom.xml` (changing the * with the version you want to use):
co.aurasphere.metrics
jmx-metrics-filter-jdk*
1.0.0
### Web application
To use the filter in a web application, add it on your `web.xml`:
metrics-filter
co.aurasphere.metrics.jdk*.JmxMetricsFilter
metrics-filter
/*
### Servlet container
To use the filter in a Servlet container, you have to manually add the jar and their dependencies to the container classpath:
| jmx-metrics-filter-jdk5 | jmx-metrics-filter-jdk8 |
|:-------------:|:-------------:|
| slf4j-api-1.7.26.jar | slf4j-api-1.7.26.jar |
| LatencyUtils-2.0.3.jar | LatencyUtils-2.0.3.jar |
| metrics-core-3.2.6.jar | metrics-core-4.0.3.jar |
| metrics-jmx-3.2.6.jar | metrics-jmx-4.0.3.jar |
| | micrometer-core-1.1.4.jar |
| | micrometer-registry-jmx-1.1.4.jar |
Then, you have to register the filter on the container. Follows an example on Tomcat:
metrics-filter
co.aurasphere.metrics.jdk*.JmxMetricsFilter
contexts
/web-test,/web-test-2
whitelist
true
metrics-filter
*.html
*.do
/*
When using the filter on a container, you can tweak it further with the following `init-param`:
- **contexts**, a list of comma-separed of web application contexts intercepted by this filter. If not specified, the filter will intercept requests on every context.
- **whitelist**, specifies whether or not the specified contexts should be the only ones intercepted (true) or the only ones excluded by the filter (false). Defaults to true if not specified.
### Spring Boot
To use the filter in a Spring Boot application, simply register the filter as a bean:
@Bean
public Filter jmxMetricsFilter() {
return new JmxMetricsFilter();
}
Copyright (c) 2019 Donato Rimenti