Hi,
I am running jmx_exporter as a Java Agent exporter in OpenTelemetry mode with Tomcat10.1 and with the following arguments to the JVM (notice that no port is used): -javaagent:/usr/lib/jmxexporter/jmx_prometheus_javaagent-1.5.0.jar=/etc/jmxexporter/jmx_exporter.yml -Dotel.java.global-autoconfigure.enabled=true
In /etc/jmxexporter/jmx_exporter.yml I have the following config:
openTelemetry:
endpoint: https://my-otel-endpoint.example
protocol: http/protobuf
interval: 10
rules:
...
In tomcat logs I see the following log every minute:
04-Dec-2025 00:00:00.867 SEVERE [OkHttp http://localhost:4317/...] e1723a08afd7bca35570fd31a7656f59.io.prometheus.metrics.shaded.io_opentelemetry_2_16_0_alpha.sdk.internal.ThrottlingLogger.doLog Failed to export metrics. The request could not be executed. Error message: Failed to connect to localhost/[0:0:0:0:0:0:0:1]:4317
java.net.ConnectException: Failed to connect to localhost/[0:0:0:0:0:0:0:1]:4317
at e1723a08afd7bca35570fd31a7656f59.io.prometheus.metrics.shaded.io_opentelemetry_2_16_0_alpha.okhttp3.internal.connection.RealConnection.connectSocket(RealConnection.kt:297)
at e1723a08afd7bca35570fd31a7656f59.io.prometheus.metrics.shaded.io_opentelemetry_2_16_0_alpha.okhttp3.internal.connection.RealConnection.connect(RealConnection.kt:207)
at e1723a08afd7bca35570fd31a7656f59.io.prometheus.metrics.shaded.io_opentelemetry_2_16_0_alpha.okhttp3.internal.connection.ExchangeFinder.findConnection(ExchangeFinder.kt:226)
at e1723a08afd7bca35570fd31a7656f59.io.prometheus.metrics.shaded.io_opentelemetry_2_16_0_alpha.okhttp3.internal.connection.ExchangeFinder.findHealthyConnection(ExchangeFinder.kt:106)
at e1723a08afd7bca35570fd31a7656f59.io.prometheus.metrics.shaded.io_opentelemetry_2_16_0_alpha.okhttp3.internal.connection.ExchangeFinder.find(ExchangeFinder.kt:74)
at e1723a08afd7bca35570fd31a7656f59.io.prometheus.metrics.shaded.io_opentelemetry_2_16_0_alpha.okhttp3.internal.connection.RealCall.initExchange$okhttp(RealCall.kt:255)
at e1723a08afd7bca35570fd31a7656f59.io.prometheus.metrics.shaded.io_opentelemetry_2_16_0_alpha.okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.kt:32)
at e1723a08afd7bca35570fd31a7656f59.io.prometheus.metrics.shaded.io_opentelemetry_2_16_0_alpha.okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
at e1723a08afd7bca35570fd31a7656f59.io.prometheus.metrics.shaded.io_opentelemetry_2_16_0_alpha.okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.kt:95)
at e1723a08afd7bca35570fd31a7656f59.io.prometheus.metrics.shaded.io_opentelemetry_2_16_0_alpha.okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
at e1723a08afd7bca35570fd31a7656f59.io.prometheus.metrics.shaded.io_opentelemetry_2_16_0_alpha.okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.kt:83)
at e1723a08afd7bca35570fd31a7656f59.io.prometheus.metrics.shaded.io_opentelemetry_2_16_0_alpha.okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
at e1723a08afd7bca35570fd31a7656f59.io.prometheus.metrics.shaded.io_opentelemetry_2_16_0_alpha.okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.kt:76)
at e1723a08afd7bca35570fd31a7656f59.io.prometheus.metrics.shaded.io_opentelemetry_2_16_0_alpha.okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
at e1723a08afd7bca35570fd31a7656f59.io.prometheus.metrics.shaded.io_opentelemetry_2_16_0_alpha.exporter.sender.okhttp.internal.RetryInterceptor.intercept(RetryInterceptor.java:96)
at e1723a08afd7bca35570fd31a7656f59.io.prometheus.metrics.shaded.io_opentelemetry_2_16_0_alpha.okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
at e1723a08afd7bca35570fd31a7656f59.io.prometheus.metrics.shaded.io_opentelemetry_2_16_0_alpha.okhttp3.internal.connection.RealCall.getResponseWithInterceptorChain$okhttp(RealCall.kt:201)
at e1723a08afd7bca35570fd31a7656f59.io.prometheus.metrics.shaded.io_opentelemetry_2_16_0_alpha.okhttp3.internal.connection.RealCall$AsyncCall.run(RealCall.kt:517)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
at java.base/java.lang.Thread.run(Thread.java:1583)
Suppressed: java.net.ConnectException: Failed to connect to localhost/127.0.0.1:4317
... 21 more
Caused by: java.net.ConnectException: Connection refused
at java.base/sun.nio.ch.Net.pollConnect(Native Method)
at java.base/sun.nio.ch.Net.pollConnectNow(Net.java:682)
at java.base/sun.nio.ch.NioSocketImpl.timedFinishConnect(NioSocketImpl.java:542)
at java.base/sun.nio.ch.NioSocketImpl.connect(NioSocketImpl.java:592)
at java.base/java.net.SocksSocketImpl.connect(SocksSocketImpl.java:327)
at java.base/java.net.Socket.connect(Socket.java:751)
at e1723a08afd7bca35570fd31a7656f59.io.prometheus.metrics.shaded.io_opentelemetry_2_16_0_alpha.okhttp3.internal.platform.Platform.connectSocket(Platform.kt:128)
at e1723a08afd7bca35570fd31a7656f59.io.prometheus.metrics.shaded.io_opentelemetry_2_16_0_alpha.okhttp3.internal.connection.RealConnection.connectSocket(RealConnection.kt:295)
... 20 more
Caused by: java.net.ConnectException: Connection refused
at java.base/sun.nio.ch.Net.pollConnect(Native Method)
at java.base/sun.nio.ch.Net.pollConnectNow(Net.java:682)
at java.base/sun.nio.ch.NioSocketImpl.timedFinishConnect(NioSocketImpl.java:542)
at java.base/sun.nio.ch.NioSocketImpl.connect(NioSocketImpl.java:592)
at java.base/java.net.SocksSocketImpl.connect(SocksSocketImpl.java:327)
at java.base/java.net.Socket.connect(Socket.java:751)
at e1723a08afd7bca35570fd31a7656f59.io.prometheus.metrics.shaded.io_opentelemetry_2_16_0_alpha.okhttp3.internal.platform.Platform.connectSocket(Platform.kt:128)
at e1723a08afd7bca35570fd31a7656f59.io.prometheus.metrics.shaded.io_opentelemetry_2_16_0_alpha.okhttp3.internal.connection.RealConnection.connectSocket(RealConnection.kt:295)
Is there a way to prevent this self connection when OpenTelemetry mode is used and no ports is exposed?
Thanks!
Hi,
I am running jmx_exporter as a Java Agent exporter in OpenTelemetry mode with Tomcat10.1 and with the following arguments to the JVM (notice that no port is used):
-javaagent:/usr/lib/jmxexporter/jmx_prometheus_javaagent-1.5.0.jar=/etc/jmxexporter/jmx_exporter.yml -Dotel.java.global-autoconfigure.enabled=trueIn /etc/jmxexporter/jmx_exporter.yml I have the following config:
In tomcat logs I see the following log every minute:
Is there a way to prevent this self connection when OpenTelemetry mode is used and no ports is exposed?
Thanks!