-
Bug
-
Resolution: Done
-
Normal
-
None
-
None
Describe the bug
We use Apache Artemis with the artemis-prometheus-metrics-plugin. We want to use the java agent for collecting logging. After adding the java agent the metrics are not collected anymore and the /metrics endpoint could not be found anymore.
Steps to reproduce
Configure Artemis to use the prometheus plugin
Add the java agent to the startup command with following configuration.
JAVA_ARGS="$JAVA_ARGS -javaagent:/data/opentelemetry/opentelemetry-javaagent.jar"
JAVA_ARGS="$JAVA_ARGS -Dotel.logs.exporter=otlp"
JAVA_ARGS="$JAVA_ARGS -Dotel.metrics.exporter=none"
JAVA_ARGS="$JAVA_ARGS -Dotel.traces.exporter=none"
JAVA_ARGS="$JAVA_ARGS -Dotel.service.name=artemis-broker"
What did you expect to see?
The plugin keeps working and the logs are scraped.
What did you see instead?
The logs are scraped, but the /metrics endpoints is not available anymore. In the log I see the stacktrace below.
What version are you using?
Java agent 1.25.1
Environment
OS: Ubuntu 20.04.6 LTS
Runtime (if different from JDK above): OpenJdk Corretto-17.0.6.10.1
Additional context
Issue at Open Telemetry Java instrumentation
open-telemetry/opentelemetry-java-instrumentation#8404
Stacktrace
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:77) at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:499) at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:480) at org.eclipse.jetty.server.handler.ContextHandler$StaticContext.createInstance(ContextHandler.java:2891) at org.eclipse.jetty.servlet.ServletContextHandler$Context.createInstance(ServletContextHandler.java:1292) at org.eclipse.jetty.servlet.ServletContextHandler$Context.createInstance(ServletContextHandler.java:1301) at org.eclipse.jetty.servlet.BaseHolder.createInstance(BaseHolder.java:204) at org.eclipse.jetty.servlet.ServletHolder.createInstance(ServletHolder.java:1169) at org.eclipse.jetty.servlet.ServletHolder.newInstance(ServletHolder.java:1161) at org.eclipse.jetty.servlet.ServletHolder.initServlet(ServletHolder.java:594) at org.eclipse.jetty.servlet.ServletHolder.getServlet(ServletHolder.java:486) at org.eclipse.jetty.servlet.ServletHolder.prepare(ServletHolder.java:731) at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:524) at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:131) at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:578) at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:122) at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:223) at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1571) at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:221) at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1378) at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:176) at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:484) at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1544) at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:174) at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1300) at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:129) at org.eclipse.jetty.server.handler.HandlerList.handle(HandlerList.java:51) at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:122) at org.eclipse.jetty.server.Server.handle(Server.java:562) at org.eclipse.jetty.server.HttpChannel.lambda$handle$0(HttpChannel.java:505) at org.eclipse.jetty.server.HttpChannel.dispatch(HttpChannel.java:762) at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:497) at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:282) at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:319) at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:100) at org.eclipse.jetty.io.SelectableChannelEndPoint$1.run(SelectableChannelEndPoint.java:53) at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:894) at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:1038) at java.base/java.lang.Thread.run(Thread.java:833) Caused by: java.lang.ClassCastException: class io.opentelemetry.javaagent.shaded.instrumentation.micrometer.v1_5.OpenTelemetryMeterRegistry cannot be cast to class io.micrometer.prometheus.PrometheusMeterRegistry (io.opentelemetry.javaagent.shaded.instrumentation.micrometer.v1_5.OpenTelemetryMeterRegistry and io.micrometer.prometheus.PrometheusMeterRegistry are in unnamed module of loader java.net.URLClassLoader @7c36db44) at com.redhat.amq.broker.core.server.metrics.plugins.ArtemisPrometheusMetricsPluginServlet.<init>(ArtemisPrometheusMetricsPluginServlet.java:40) ... 41 more