-
Notifications
You must be signed in to change notification settings - Fork 5
feat(opentelemetry): add OpenTelemetry and JMX metrics #9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
e8e1562
f99ed98
39cacee
2ce5001
4ba32ab
5f99907
61621f2
272507c
02d1ef2
94395ea
5a16982
b2c4187
cedaa33
3c400fc
15cd57a
d5a8431
573c32b
11a8fd3
a3f4048
bfbd535
a21bfc7
6066eb6
37fba8c
703b713
47f29a7
2244a4c
db032ef
bb91bdb
4d89237
f867c3c
4a2e74d
6f6a395
6132294
1bf9d26
72a0ce4
26bfdbd
39b1840
d3adc37
b10dbaf
c6c54c0
30173c0
6d0f428
8a40ec4
563ecad
3b6d1ef
f9ace12
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -30,6 +30,10 @@ if [[ -z "${SPRING_DATASOURCE_URL:-}" && -n "${DB_URL:-}" ]]; then | |
| export SPRING_DATASOURCE_URL="${DB_URL}" | ||
| fi | ||
|
|
||
| # OpenTelemetry Agent configuration | ||
| # Load the agent via JAVA_OPTS instead of JAVA_TOOL_OPTIONS | ||
| export JAVA_OPTS="${JAVA_OPTS:-} -javaagent:/camunda/javaagent/opentelemetry-javaagent-${OPENTELEMETRY_AGENT_VERSION}.jar" | ||
|
Comment on lines
+33
to
+35
|
||
|
|
||
| CMD="/camunda/internal/run.sh start" | ||
|
|
||
| wait_for_it | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -52,11 +52,9 @@ if [ "${DEBUG}" = "true" ]; then | |
| CMD+=" jpda" | ||
| fi | ||
|
|
||
| if [ "$JMX_PROMETHEUS" = "true" ] ; then | ||
| echo "Enabling Prometheus JMX Exporter on port ${JMX_PROMETHEUS_PORT}" | ||
| [ ! -f "$JMX_PROMETHEUS_CONF" ] && touch "$JMX_PROMETHEUS_CONF" | ||
| export CATALINA_OPTS="${CATALINA_OPTS:=} -javaagent:/camunda/javaagent/jmx_prometheus_javaagent.jar=${JMX_PROMETHEUS_PORT}:${JMX_PROMETHEUS_CONF}" | ||
| fi | ||
| # OpenTelemetry Agent configuration | ||
| # Load the agent via CATALINA_OPTS (Tomcat-specific) instead of JAVA_TOOL_OPTIONS | ||
| export CATALINA_OPTS="${CATALINA_OPTS:-} -javaagent:/camunda/javaagent/opentelemetry-javaagent-${OPENTELEMETRY_AGENT_VERSION}.jar" | ||
|
Comment on lines
+55
to
+57
|
||
|
|
||
| CMD+=" run" | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -54,12 +54,8 @@ if [ -z "$SKIP_DB_CONFIG" ]; then | |
| modify_datasource | ||
| fi | ||
|
|
||
| if [ "$JMX_PROMETHEUS" = "true" ] ; then | ||
| # See https://issues.jboss.org/browse/LOGMGR-218 | ||
| export JBOSS_MODULES_SYSTEM_PKGS=${JBOSS_MODULES_SYSTEM_PKGS:-"org.jboss.byteman,org.jboss.logmanager"} | ||
| else | ||
| export JBOSS_MODULES_SYSTEM_PKGS=${JBOSS_MODULES_SYSTEM_PKGS:-"org.jboss.byteman"} | ||
| fi | ||
| # See https://issues.jboss.org/browse/LOGMGR-218 | ||
| export JBOSS_MODULES_SYSTEM_PKGS=${JBOSS_MODULES_SYSTEM_PKGS:-"org.jboss.byteman,org.jboss.logmanager"} | ||
|
|
||
| # Ensure wildfly binds to public interface, preferes IPv4 and runs in the background | ||
| export PREPEND_JAVA_OPTS="-Djboss.bind.address=0.0.0.0 -Djboss.bind.address.management=0.0.0.0 -Djava.net.preferIPv4Stack=true -Djava.awt.headless=true -Djboss.modules.system.pkgs=${JBOSS_MODULES_SYSTEM_PKGS}" | ||
|
|
@@ -72,15 +68,14 @@ if [ "${DEBUG}" = "true" ]; then | |
| CMD+=" --debug *:8000" | ||
| fi | ||
|
|
||
| if [ "$JMX_PROMETHEUS" = "true" ] ; then | ||
| echo "Enabling Prometheus JMX Exporter on port ${JMX_PROMETHEUS_PORT}" | ||
| [ ! -f "$JMX_PROMETHEUS_CONF" ] && touch "$JMX_PROMETHEUS_CONF" | ||
| # See https://github.com/prometheus/jmx_exporter/issues/344 | ||
| LOG_MANAGER_PATH=$(find /camunda/modules -name "jboss-logmanager*.jar") | ||
| COMMON_PATH=$(find /camunda/modules -name "wildfly-common*.jar") | ||
| export PREPEND_JAVA_OPTS="${PREPEND_JAVA_OPTS} -Dsun.util.logging.disableCallerCheck=true -Djava.util.logging.manager=org.jboss.logmanager.LogManager -Xbootclasspath/a:$LOG_MANAGER_PATH:$COMMON_PATH" | ||
| export PREPEND_JAVA_OPTS="${PREPEND_JAVA_OPTS} -javaagent:/camunda/javaagent/jmx_prometheus_javaagent.jar=${JMX_PROMETHEUS_PORT}:${JMX_PROMETHEUS_CONF}" | ||
| fi | ||
| # JBoss LogManager configuration for OpenTelemetry | ||
| # See https://github.com/prometheus/jmx_exporter/issues/344 | ||
| LOG_MANAGER_PATH=$(find /camunda/modules -name "jboss-logmanager*.jar") | ||
| COMMON_PATH=$(find /camunda/modules -name "wildfly-common*.jar") | ||
| SMALLRYE_OS_PATH=$(find /camunda/modules -name "smallrye-common-os*.jar") | ||
| SMALLRYE_NET_PATH=$(find /camunda/modules -name "smallrye-common-net*.jar") | ||
| export PREPEND_JAVA_OPTS="${PREPEND_JAVA_OPTS} -Dsun.util.logging.disableCallerCheck=true -Djava.util.logging.manager=org.jboss.logmanager.LogManager -Xbootclasspath/a:$LOG_MANAGER_PATH:$COMMON_PATH:$SMALLRYE_OS_PATH:$SMALLRYE_NET_PATH" | ||
| export PREPEND_JAVA_OPTS="${PREPEND_JAVA_OPTS} -javaagent:/camunda/javaagent/opentelemetry-javaagent-${OPENTELEMETRY_AGENT_VERSION}.jar" | ||
|
Comment on lines
+72
to
+78
|
||
|
|
||
| wait_for_it | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,80 @@ | ||
| rules: | ||
| # Config from: https://github.com/open-telemetry/opentelemetry-java-instrumentation/blob/main/instrumentation/jmx-metrics/library/src/main/resources/jmx/rules/jvm.yaml | ||
| # Extended for CIB: MaxFileDescriptorCount, TotalSwapSpaceSize, FreeSwapSpaceSize, TotalPhysicalMemorySize, FreePhysicalMemorySize, CommittedVirtualMemorySize | ||
| - bean: java.lang:type=OperatingSystem | ||
| prefix: os. | ||
| dropNegativeValues: true | ||
| mapping: | ||
| # os.cpu.count | ||
| AvailableProcessors: | ||
| metric: cpu.count | ||
| type: updowncounter | ||
| unit: "{cpu}" | ||
| desc: Number of processors available to the Java virtual machine. | ||
| # os.cpu.time | ||
| ProcessCpuTime: | ||
| metric: cpu.time | ||
| type: counter | ||
| sourceUnit: ns | ||
| unit: s | ||
| desc: CPU time used by the process as reported by the JVM. | ||
| # os.cpu.recent_utilization | ||
| ProcessCpuLoad: | ||
| metric: cpu.recent_utilization | ||
| type: gauge | ||
| unit: '1' | ||
| desc: Recent CPU utilization for the process as reported by the JVM. | ||
| # os.system.cpu.load_1m (experimental) | ||
| SystemLoadAverage: | ||
| metric: system.cpu.load_1m | ||
| type: gauge | ||
| unit: "{run_queue_item}" | ||
| desc: Average CPU load of the whole system for the last minute as reported by the JVM. | ||
| # os.system.cpu.utilization (experimental) | ||
| SystemCpuLoad: | ||
| metric: system.cpu.utilization | ||
| type: gauge | ||
| unit: '1' | ||
| desc: Recent CPU utilization for the whole system as reported by the JVM. | ||
| # os.file_descriptor.open.count (experimental) | ||
| OpenFileDescriptorCount: | ||
| metric: file_descriptor.open.count | ||
| type: updowncounter | ||
| unit: "{file_descriptor}" | ||
| desc: Number of open file descriptors as reported by the JVM. | ||
| # os.file_descriptor.max.count | ||
| MaxFileDescriptorCount: | ||
| metric: file_descriptor.max.count | ||
| type: updowncounter | ||
| unit: "{file_descriptor}" | ||
| desc: Number of max file descriptors as reported by the JVM. | ||
| # virtual_memory.committed.size | ||
| CommittedVirtualMemorySize: | ||
| metric: virtual_memory.committed.size | ||
| type: gauge | ||
| unit: 'By' | ||
| desc: Size of CommittedVirtualMemorySize. | ||
| # os.physical_memory.free.size | ||
| FreePhysicalMemorySize: | ||
| metric: physical_memory.free.size | ||
| type: gauge | ||
| unit: 'By' | ||
| desc: Size of FreePhysicalMemorySize. | ||
| # os.physical_memory.total.size | ||
| TotalPhysicalMemorySize: | ||
| metric: physical_memory.total.size | ||
| type: gauge | ||
| unit: 'By' | ||
| desc: Size of TotalPhysicalMemorySize. | ||
| # os.swap_space.free.size | ||
| FreeSwapSpaceSize: | ||
| metric: swap_space.free.size | ||
| type: gauge | ||
| unit: 'By' | ||
| desc: Size of FreeSwapSpaceSize. | ||
| # os.swap_space.total.size | ||
| TotalSwapSpaceSize: | ||
| metric: swap_space.total.size | ||
| type: gauge | ||
| unit: 'By' | ||
| desc: Size of TotalSwapSpaceSize. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| # Custom JMX Metrics Configuration | ||
| # | ||
| # This file can be overridden by mounting your own configuration: | ||
| # -v $(pwd)/my_custom_jmx_config.yaml:/camunda/javaagent/jmx_custom_config.yaml | ||
| # | ||
| # For configuration syntax and examples, see jmx_config.yaml |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -46,18 +46,6 @@ services: | |
| - "8000:8000" | ||
| restart: unless-stopped | ||
|
|
||
| camunda-prometheus-jmx: | ||
| image: cibseven/cibseven:${IMAGE_TAG:-${DISTRO}-${PLATFORM}} | ||
| platform: linux/${PLATFORM} | ||
| environment: | ||
| - JMX_PROMETHEUS=true | ||
| ports: | ||
| - "8080:8080" | ||
| - "9404:9404" | ||
| volumes: | ||
| - $PWD/prometheus-jmx.yml:/camunda/javaagent/prometheus-jmx.yml | ||
| restart: unless-stopped | ||
|
|
||
| camunda-password-file: | ||
| image: cibseven/cibseven:${IMAGE_TAG:-${DISTRO}-${PLATFORM}} | ||
| platform: linux/${PLATFORM} | ||
|
|
@@ -88,3 +76,28 @@ services: | |
| environment: | ||
| - POSTGRES_USER=camunda | ||
| - POSTGRES_PASSWORD=camunda | ||
|
|
||
| camunda-opentelemetry: | ||
| image: cibseven/cibseven:${IMAGE_TAG:-${DISTRO}-${PLATFORM}} | ||
| platform: linux/${PLATFORM} | ||
| environment: | ||
| - OTEL_METRICS_EXPORTER=prometheus | ||
| - OTEL_LOGS_EXPORTER=none | ||
| - OTEL_TRACES_EXPORTER=otlp | ||
| - OTEL_EXPORTER_PROMETHEUS_PORT=9464 | ||
| - OTEL_EXPORTER_OTLP_ENDPOINT=http://opentelemetry-collector:4318 | ||
| ports: | ||
| - "8080:8080" | ||
| - "9464:9464" | ||
| depends_on: | ||
| - opentelemetry-collector | ||
| restart: unless-stopped | ||
|
|
||
| opentelemetry-collector: | ||
| image: otel/opentelemetry-collector:0.145.0 | ||
| command: ["--config=/etc/otel-collector-config.yml"] | ||
|
Comment on lines
+96
to
+98
|
||
| volumes: | ||
| - ./otel-collector-config.yml:/etc/otel-collector-config.yml | ||
| ports: | ||
| - "4318:4318" | ||
| restart: unless-stopped | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The README says the OpenTelemetry agent is “pre-installed” and that exporters are disabled by default, but the entrypoint scripts now always attach
-javaagenton startup. Consider explicitly documenting that the agent is loaded by default (with exporters disabled) to avoid surprising users who expect zero instrumentation unless they opt in.