add jmx exporter to container image

This commit is contained in:
tawoe 2025-05-14 15:35:04 +02:00
parent 8c422752e2
commit 1b55e99aab
2 changed files with 20 additions and 0 deletions

View File

@ -1,5 +1,10 @@
FROM jetty:9.4-jdk11-alpine
ENV JMX_EXPORTER_VERSION=1.2.0
# To enable add "-javaagent:$JETTY_BASE/jmx-exporter.jar=8090:$JETTY_BASE/prometheus_config.yml" to the JAVA_OPTIONS
RUN wget https://repo1.maven.org/maven2/io/prometheus/jmx/jmx_prometheus_javaagent/$JMX_EXPORTER_VERSION/jmx_prometheus_javaagent-$JMX_EXPORTER_VERSION.jar -o /var/lib/jetty/jmx-exporter.jar
COPY .github/jmx_exporter.config /var/lib/jetty/prometheus_config.yml
# Copy OBP source code
# Copy build artifact (.war file) into jetty from 'maven' stage.
COPY /obp-api/target/obp-api-1.*.war /var/lib/jetty/webapps/ROOT.war

15
.github/jmx_exporter.config vendored Normal file
View File

@ -0,0 +1,15 @@
---
lowercaseOutputLabelNames: true
lowercaseOutputName: true
whitelistObjectNames: ["java.lang:type=OperatingSystem"]
blacklistObjectNames: []
rules:
- pattern: 'java.lang<type=OperatingSystem><>(committed_virtual_memory|free_physical_memory|free_swap_space|total_physical_memory|total_swap_space)_size:'
name: os_$1_bytes
type: GAUGE
attrNameSnakeCase: true
- pattern: 'java.lang<type=OperatingSystem><>((?!process_cpu_time)\w+):'
name: os_$1
type: GAUGE
attrNameSnakeCase: true
- pattern: ".*"