https://github.com/marcelmay/prometheus-client-webapp
A simple WAR wrapper for instrumenting your app server
https://github.com/marcelmay/prometheus-client-webapp
Last synced: 9 months ago
JSON representation
A simple WAR wrapper for instrumenting your app server
- Host: GitHub
- URL: https://github.com/marcelmay/prometheus-client-webapp
- Owner: marcelmay
- License: apache-2.0
- Created: 2021-07-25T17:29:28.000Z (almost 5 years ago)
- Default Branch: main
- Last Pushed: 2021-07-27T17:46:24.000Z (almost 5 years ago)
- Last Synced: 2025-08-02T13:48:19.920Z (11 months ago)
- Language: Java
- Size: 26.4 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# prometheus-client-webapp
A simple WAR wrapper for instrumenting your app server and exposing metrics.
[](https://search.maven.org/search?q=g:de.m3y.prometheus.client%20AND%20a:prometheus-client-webapp)
This is an alternative to the usually preferred [jmx_exporter](https://github.com/prometheus/jmx_exporter)
and suitable when you have minimal access to your app server,
e.g. in a large centrally managed setup splitting operations and development responsiblities.
The WAR
* registers JVM [DefaultExports](https://github.com/prometheus/client_java/blob/master/simpleclient_hotspot/src/main/java/io/prometheus/client/hotspot/DefaultExports.java)
* registers [JmxCollector](https://github.com/prometheus/jmx_exporter/blob/master/collector/src/main/java/io/prometheus/jmx/JmxCollector.java)
* exposes metrics via [MetricsServlet](https://github.com/prometheus/client_java/blob/master/simpleclient_servlet/src/main/java/io/prometheus/client/exporter/MetricsServlet.java)
## Configuration
You can configure the [JmxCollector](https://github.com/prometheus/jmx_exporter#configuration)
1. by setting system property `jmx_collector_config_file` pointing to a local file
2. by setting in your web.xml a context parameter pointing to a local file
```
jmx_collector_config_file
/PATH/TO/CONFIGFILE
```
3. by setting the default config directly in the web.xml (**default config!**)
```
jmx_collector_config
---
# Default config embedded in web.xml
rules:
- pattern: ".*"
```
This last setting is the default config.
First configuration found wins. So you can always override via system property.
## Metrics
| Metric names | Type | Descriptions |
|--------|------|--------------|
| prometheus_webapp_build_info{version, buildTime, buildScmVersion, buildScmBranch} | Info | Build info of this WAR |
| jvm_* | | Default JVM metrics, see [Prometheus client hotpot](https://prometheus.github.io/client_java/io/prometheus/client/hotspot/package-summary.html) |
| jmx_* | | Default JMX Collector metrics, see [Prometheus jmx_exporter](https://github.com/prometheus/jmx_exporter) |
## Building
```
mvn clean install
```
### A simple test run
```
mvn jetty:run
open http://localhost:8080/
```
## Requirements
For building:
* JDK 8
* [Maven 3.6.x](http://maven.apache.org)