Giter Site home page Giter Site logo

artemis-prometheus-metrics-plugin's Introduction

Artemis Prometheus Metrics Plugin

This is a metrics plugin implementation for the ActiveMQ Artemis message broker. It provides integration with Prometheus using two modules:

  • artemis-prometheus-metrics-plugin Provides the actual implementation of org.apache.activemq.artemis.core.server.metrics.ActiveMQMetricsPlugin and packages it with the micrometer and Prometheus dependencies in an "uber" jar.

  • artemis-prometheus-metrics-plugin-servlet Provides a war file containing a simple servlet which can be deployed to the broker's embedded web server which then Prometheus can use to scrape metrics.

Building

Simply run mvn install. This command will build both modules and the output will be in their respective target directories.

Installing in ActiveMQ Artemis

After building the artifacts follow these steps:

  1. Copy artemis-prometheus-metrics-plugin/target/artemis-prometheus-metrics-plugin-<VERSION>.jar to <ARTEMIS_INSTANCE>/lib.

  2. Add this to your <ARTEMIS_INSTANCE>/etc/broker.xml:

    <metrics><plugin class-name="com.redhat.amq.broker.core.server.metrics.plugins.ArtemisPrometheusMetricsPlugin"/></metrics>
    
  3. Create the directory <ARTEMIS_INSTANCE>/web.

  4. Copy artemis-prometheus-metrics-plugin-servlet/target/metrics.war to <ARTEMIS_INSTANCE>/web.

  5. Add this to the web element in <ARTEMIS_INSTANCE>/etc/bootstrap.xml:

    <app url="metrics" war="metrics.war"/>
    

artemis-prometheus-metrics-plugin's People

Contributors

andytaylor avatar brusdev avatar edwardkuenen avatar jbertram avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

artemis-prometheus-metrics-plugin's Issues

Error in metrics-plugin on Colocated configuration

Hi, i have a issue with metric plugin in clustered environment, when Cluster try send node configurarion have a NotSerializable Exception:

[org.apache.activemq.artemis.core.server] AMQ222261: Failed to activate a backup: java.security.PrivilegedActionException: java.io.NotSerializableException: io.micrometer.prometheus.PrometheusMeterRegistry
        at java.base/java.security.AccessController.doPrivileged(Native Method) [java.base:]
        at org.apache.activemq.artemis.core.config.impl.ConfigurationImpl.copy(ConfigurationImpl.java:2328) [artemis-server-2.19.0.jar:2.19.0]
        at org.apache.activemq.artemis.core.server.cluster.ha.ColocatedHAManager.activateReplicatedBackup(ColocatedHAManager.java:186) [artemis-server-2.19.0.jar:2.19.0]
        at org.apache.activemq.artemis.core.server.cluster.ha.ColocatedHAManager.activateBackup(ColocatedHAManager.java:99) [artemis-server-2.19.0.jar:2.19.0]
        at org.apache.activemq.artemis.core.server.impl.ColocatedActivation$1.handlePacket(ColocatedActivation.java:127) [artemis-server-2.19.0.jar:2.19.0]
        at org.apache.activemq.artemis.core.server.cluster.ClusterController$ClusterControllerChannelHandler.handlePacket(ClusterController.java:469) [artemis-server-2.19.0.jar:2.19.0]
        at org.apache.activemq.artemis.core.protocol.core.impl.ChannelImpl.handlePacket(ChannelImpl.java:820) [artemis-core-client-2.19.0.jar:2.19.0]
        at org.apache.activemq.artemis.core.protocol.core.impl.RemotingConnectionImpl.doBufferReceived(RemotingConnectionImpl.java:428) [artemis-core-client-2.19.0.jar:2.19.0]
        at org.apache.activemq.artemis.core.protocol.core.impl.RemotingConnectionImpl.bufferReceived(RemotingConnectionImpl.java:396) [artemis-core-client-2.19.0.jar:2.19.0]
        at org.apache.activemq.artemis.core.remoting.server.impl.RemotingServiceImpl$DelegatingBufferHandler.bufferReceived(RemotingServiceImpl.java:688) [artemis-server-2.19.0.jar:2.19.0]
        at org.apache.activemq.artemis.core.remoting.impl.netty.ActiveMQChannelHandler.channelRead(ActiveMQChannelHandler.java:73) [artemis-core-client-2.19.0.jar:2.19.0]
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) [netty-all-4.1.68.Final.jar:4.1.68.Final]
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365) [netty-all-4.1.68.Final.jar:4.1.68.Final]
        at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357) [netty-all-4.1.68.Final.jar:4.1.68.Final]
        at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:324) [netty-all-4.1.68.Final.jar:4.1.68.Final]
        at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:296) [netty-all-4.1.68.Final.jar:4.1.68.Final]
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) [netty-all-4.1.68.Final.jar:4.1.68.Final]
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365) [netty-all-4.1.68.Final.jar:4.1.68.Final]
        at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357) [netty-all-4.1.68.Final.jar:4.1.68.Final]
        at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1410) [netty-all-4.1.68.Final.jar:4.1.68.Final]
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) [netty-all-4.1.68.Final.jar:4.1.68.Final]
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365) [netty-all-4.1.68.Final.jar:4.1.68.Final]
        at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:919) [netty-all-4.1.68.Final.jar:4.1.68.Final]
        at io.netty.channel.epoll.AbstractEpollStreamChannel$EpollStreamUnsafe.epollInReady(AbstractEpollStreamChannel.java:795) [netty-all-4.1.68.Final.jar:4.1.68.Final]
        at io.netty.channel.epoll.EpollEventLoop.processReady(EpollEventLoop.java:480) [netty-all-4.1.68.Final.jar:4.1.68.Final]
        at io.netty.channel.epoll.EpollEventLoop.run(EpollEventLoop.java:378) [netty-all-4.1.68.Final.jar:4.1.68.Final]
        at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:986) [netty-all-4.1.68.Final.jar:4.1.68.Final]
        at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74) [netty-all-4.1.68.Final.jar:4.1.68.Final]
        at org.apache.activemq.artemis.utils.ActiveMQThreadFactory$1.run(ActiveMQThreadFactory.java:118) [artemis-commons-2.19.0.jar:2.19.0]
Caused by: java.io.NotSerializableException: io.micrometer.prometheus.PrometheusMeterRegistry
        at java.base/java.io.ObjectOutputStream.writeObject0(Unknown Source) [java.base:]
        at java.base/java.io.ObjectOutputStream.defaultWriteFields(Unknown Source) [java.base:]
        at java.base/java.io.ObjectOutputStream.writeSerialData(Unknown Source) [java.base:]
        at java.base/java.io.ObjectOutputStream.writeOrdinaryObject(Unknown Source) [java.base:]
        at java.base/java.io.ObjectOutputStream.writeObject0(Unknown Source) [java.base:]
        at java.base/java.io.ObjectOutputStream.defaultWriteFields(Unknown Source) [java.base:]
        at java.base/java.io.ObjectOutputStream.writeSerialData(Unknown Source) [java.base:]
        at java.base/java.io.ObjectOutputStream.writeOrdinaryObject(Unknown Source) [java.base:]
        at java.base/java.io.ObjectOutputStream.writeObject0(Unknown Source) [java.base:]
        at java.base/java.io.ObjectOutputStream.defaultWriteFields(Unknown Source) [java.base:]
        at java.base/java.io.ObjectOutputStream.writeSerialData(Unknown Source) [java.base:]
        at java.base/java.io.ObjectOutputStream.writeOrdinaryObject(Unknown Source) [java.base:]
        at java.base/java.io.ObjectOutputStream.writeObject0(Unknown Source) [java.base:]
        at java.base/java.io.ObjectOutputStream.writeObject(Unknown Source) [java.base:]
        at org.apache.activemq.artemis.core.config.impl.ConfigurationImpl$1.run(ConfigurationImpl.java:2333) [artemis-server-2.19.0.jar:2.19.0]
        at org.apache.activemq.artemis.core.config.impl.ConfigurationImpl$1.run(ConfigurationImpl.java:2328) [artemis-server-2.19.0.jar:2.19.0]

java.lang.NoClassDefFoundError: io/micrometer/core/instrument/Metrics

Hello.
I trying to install this plugin to my ActiveMQ Artemis broker and after i done it with instruction in Readme file i got this error on page http://0.0.0.0:8161/metrics:

HTTP ERROR 500

Problem accessing /metrics/. Reason:

Server Error

Caused by:

java.lang.NoClassDefFoundError: io/micrometer/core/instrument/Metrics
at org.apache.activemq.artemis.core.server.metrics.plugins.ArtemisPrometheusMetricsPluginServlet.(ArtemisPrometheusMetricsPluginServlet.java:38)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
at java.base/java.lang.Class.newInstance(Class.java:584)
at org.eclipse.jetty.server.handler.ContextHandler$Context.createInstance(ContextHandler.java:2521)
at org.eclipse.jetty.servlet.ServletContextHandler$Context.createServlet(ServletContextHandler.java:1326)
at org.eclipse.jetty.servlet.ServletHolder.newInstance(ServletHolder.java:1273)
at org.eclipse.jetty.servlet.ServletHolder.initServlet(ServletHolder.java:614)
at org.eclipse.jetty.servlet.ServletHolder.getServlet(ServletHolder.java:498)
at org.eclipse.jetty.servlet.ServletHolder.ensureInstance(ServletHolder.java:785)
at org.eclipse.jetty.servlet.ServletHolder.prepare(ServletHolder.java:770)
at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:538)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:548)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:190)
at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1593)
at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:188)
at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1239)
at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:168)
at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:481)
at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1562)
at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:166)
at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1141)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
at org.eclipse.jetty.server.handler.HandlerList.handle(HandlerList.java:52)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
at org.eclipse.jetty.server.Server.handle(Server.java:564)
at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:320)
at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:251)
at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:279)
at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:110)
at org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:124)
at org.eclipse.jetty.util.thread.Invocable.invokePreferred(Invocable.java:122)
at org.eclipse.jetty.util.thread.strategy.ExecutingExecutionStrategy.invoke(ExecutingExecutionStrategy.java:58)
at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.produceConsume(ExecuteProduceConsume.java:201)
at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.run(ExecuteProduceConsume.java:133)
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:672)
at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:590)
at java.base/java.lang.Thread.run(Thread.java:829)

I put artemis-prometheus-metrics-plugin-1.1.0.jar in directory /var/lib/test-broker/lib, then put metrics.war in directory /var/lib/test-broker/web.
In /var/lib/test-broker/etc/broker.xml i added to "configuration" scope:
<metrics-plugin class-name="org.apache.activemq.artemis.core.server.metrics.plugins.ArtemisPrometheusMetricsPlugin"/>
and added:
<app url="metrics" war="metrics.war"/>
to the WEB element in /var/lib/test-broker/etc/bootstrap.xml.

But still got this error and really don't know what exactly wrong here.

My broker instance example is here: https://github.com/nikzhernovkov357/apache-artemis-broker-example
I using this version of ActiveMQ server: 2.8.1

big stack trace when Artemis is not ready yet (or is stopping)

when metrics are collected before the broker is completely started, the exception "IllegalStateException: Broker is not started. It can not be managed yet" may be raised. the exact occurrence frequency depends on the polling frequency of the metrics collector.
and the same may happen when a "stop" command is given.

the error message looks like this:

2023-09-28 08:25:36,091 WARN  [io.micrometer.core.instrument.internal.DefaultGauge] Failed to apply the value function for the gauge 'artemis.address.memory.usage.percentage'. Note that subsequent logs will be logged at debug level.
java.lang.IllegalStateException: Broker is not started. It can not be managed yet
	at org.apache.activemq.artemis.core.management.impl.ActiveMQServerControlImpl.checkStarted(ActiveMQServerControlImpl.java:4441) ~[artemis-server-2.31.0.jar:2.31.0]
	at org.apache.activemq.artemis.core.management.impl.ActiveMQServerControlImpl.getGlobalMaxSize(ActiveMQServerControlImpl.java:757) ~[artemis-server-2.31.0.jar:2.31.0]
	at org.apache.activemq.artemis.core.management.impl.ActiveMQServerControlImpl.getAddressMemoryUsagePercentage(ActiveMQServerControlImpl.java:804) ~[artemis-server-2.31.0.jar:2.31.0]
	at org.apache.activemq.artemis.core.server.management.impl.ManagementServiceImpl.lambda$registerBrokerMeters$3(ManagementServiceImpl.java:233) ~[artemis-server-2.31.0.jar:2.31.0]
	at io.micrometer.core.instrument.internal.DefaultGauge.value(DefaultGauge.java:53) ~[micrometer-core-1.9.5.jar:1.9.5]
	at io.micrometer.prometheus.PrometheusMeterRegistry.lambda$newGauge$5(PrometheusMeterRegistry.java:331) ~[artemis-prometheus-metrics-plugin-2.1.0.jar:?]
	at io.micrometer.prometheus.MicrometerCollector.collect(MicrometerCollector.java:75) ~[artemis-prometheus-metrics-plugin-2.1.0.jar:?]
	at io.prometheus.client.Collector.collect(Collector.java:45) ~[artemis-prometheus-metrics-plugin-2.1.0.jar:?]
	at io.prometheus.client.CollectorRegistry$MetricFamilySamplesEnumeration.findNextElement(CollectorRegistry.java:204) ~[artemis-prometheus-metrics-plugin-2.1.0.jar:?]
	at io.prometheus.client.CollectorRegistry$MetricFamilySamplesEnumeration.nextElement(CollectorRegistry.java:219) ~[artemis-prometheus-metrics-plugin-2.1.0.jar:?]
	at io.prometheus.client.CollectorRegistry$MetricFamilySamplesEnumeration.nextElement(CollectorRegistry.java:152) ~[artemis-prometheus-metrics-plugin-2.1.0.jar:?]
	at io.prometheus.client.exporter.common.TextFormat.write004(TextFormat.java:71) ~[artemis-prometheus-metrics-plugin-2.1.0.jar:?]
	at io.prometheus.client.exporter.common.TextFormat.writeFormat(TextFormat.java:53) ~[artemis-prometheus-metrics-plugin-2.1.0.jar:?]
	at io.micrometer.prometheus.PrometheusMeterRegistry.scrape(PrometheusMeterRegistry.java:154) ~[artemis-prometheus-metrics-plugin-2.1.0.jar:?]
	at io.micrometer.prometheus.PrometheusMeterRegistry.scrape(PrometheusMeterRegistry.java:149) ~[artemis-prometheus-metrics-plugin-2.1.0.jar:?]
	at io.micrometer.prometheus.PrometheusMeterRegistry.scrape(PrometheusMeterRegistry.java:120) ~[artemis-prometheus-metrics-plugin-2.1.0.jar:?]
	at io.micrometer.prometheus.PrometheusMeterRegistry.scrape(PrometheusMeterRegistry.java:107) ~[artemis-prometheus-metrics-plugin-2.1.0.jar:?]
	at com.redhat.amq.broker.core.server.metrics.plugins.ArtemisPrometheusMetricsPluginServlet.doGet(ArtemisPrometheusMetricsPluginServlet.java:57) ~[classes/:?]
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:503) ~[jetty-servlet-api-4.0.6.jar:?]
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:590) ~[jetty-servlet-api-4.0.6.jar:?]
	at org.eclipse.jetty.servlet.ServletHolder$NotAsync.service(ServletHolder.java:1410) ~[jetty-servlet-10.0.15.jar:10.0.15]
	at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:764) ~[jetty-servlet-10.0.15.jar:10.0.15]
	at org.eclipse.jetty.servlet.ServletHandler$ChainEnd.doFilter(ServletHandler.java:1665) ~[jetty-servlet-10.0.15.jar:10.0.15]
	at org.apache.activemq.artemis.component.JolokiaFilter.doFilter(JolokiaFilter.java:50) ~[artemis-web-2.31.0.jar:2.31.0]
	at org.eclipse.jetty.servlet.FilterHolder.doFilter(FilterHolder.java:202) ~[jetty-servlet-10.0.15.jar:10.0.15]
	at org.eclipse.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1635) ~[jetty-servlet-10.0.15.jar:10.0.15]
	at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:527) ~[jetty-servlet-10.0.15.jar:10.0.15]
	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:131) ~[jetty-server-10.0.15.jar:10.0.15]
	at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:578) ~[jetty-security-10.0.15.jar:10.0.15]
	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:122) ~[jetty-server-10.0.15.jar:10.0.15]
	at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:223) ~[jetty-server-10.0.15.jar:10.0.15]
	at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1570) ~[jetty-server-10.0.15.jar:10.0.15]
	at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:221) ~[jetty-server-10.0.15.jar:10.0.15]
	at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1384) ~[jetty-server-10.0.15.jar:10.0.15]
	at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:176) ~[jetty-server-10.0.15.jar:10.0.15]
	at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:484) ~[jetty-servlet-10.0.15.jar:10.0.15]
	at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1543) ~[jetty-server-10.0.15.jar:10.0.15]
	at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:174) ~[jetty-server-10.0.15.jar:10.0.15]
	at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1306) ~[jetty-server-10.0.15.jar:10.0.15]
	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:129) ~[jetty-server-10.0.15.jar:10.0.15]
	at org.eclipse.jetty.server.handler.HandlerList.handle(HandlerList.java:51) ~[jetty-server-10.0.15.jar:10.0.15]
	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:122) ~[jetty-server-10.0.15.jar:10.0.15]
	at org.eclipse.jetty.server.Server.handle(Server.java:563) ~[jetty-server-10.0.15.jar:10.0.15]
	at org.eclipse.jetty.server.HttpChannel.lambda$handle$0(HttpChannel.java:505) ~[jetty-server-10.0.15.jar:10.0.15]
	at org.eclipse.jetty.server.HttpChannel.dispatch(HttpChannel.java:762) ~[jetty-server-10.0.15.jar:10.0.15]
	at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:497) ~[jetty-server-10.0.15.jar:10.0.15]
	at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:282) ~[jetty-server-10.0.15.jar:10.0.15]
	at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:314) ~[jetty-io-10.0.15.jar:10.0.15]
	at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:100) ~[jetty-io-10.0.15.jar:10.0.15]
	at org.eclipse.jetty.io.SelectableChannelEndPoint$1.run(SelectableChannelEndPoint.java:53) ~[jetty-io-10.0.15.jar:10.0.15]
	at org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.runTask(AdaptiveExecutionStrategy.java:416) ~[jetty-util-10.0.15.jar:10.0.15]
	at org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.consumeTask(AdaptiveExecutionStrategy.java:385) ~[jetty-util-10.0.15.jar:10.0.15]
	at org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.tryProduce(AdaptiveExecutionStrategy.java:272) ~[jetty-util-10.0.15.jar:10.0.15]
	at org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.lambda$new$0(AdaptiveExecutionStrategy.java:140) ~[jetty-util-10.0.15.jar:10.0.15]
	at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:411) [jetty-util-10.0.15.jar:10.0.15]
	at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:969) [jetty-util-10.0.15.jar:10.0.15]
	at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.doRunJob(QueuedThreadPool.java:1194) [jetty-util-10.0.15.jar:10.0.15]
	at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:1149) [jetty-util-10.0.15.jar:10.0.15]
	at java.lang.Thread.run(Thread.java:829) [?:?]

that is a big scary stacktrace for something relatively common.

I propose that this stacktrace is suppressed...

broker.xml: tag changed from metrics-plugin to metrics/plugin

With Artemis 2.18.0 the tag

<metrics-plugin class-name="org.apache.activemq.artemis.core.server.metrics.plugins.ArtemisPrometheusMetricsPlugin"/>

changed to

<metrics>
  <plugin class-name="org.apache.activemq.artemis.core.server.metrics.plugins.ArtemisPrometheusMetricsPlugin"/>
</metrics>

Getting started tutorial

If you get the components installed, then what ?

What is the endpoint ?

What are the supported metrics ?

After adding the Open Telemetry agent the plugin crashes

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

Question on supported artemis version

I've tested the plugin successfully with activemq-artemis 2.19.1, but have not been successful with getting it to work with 2.20.0 or 2.30.0. Can anyone confirm versions of activemq-artemis that have been tested with this plugin?

Lack of metrics

Hello,

I followed the instructions (of course some artifacts needed update to be consistent with the latest Artemis version) and I can see now metrics exposed and visible in Prometheus, but the list is very small and many things are missing.

Is this expected of is there something wrong? Following is the current list:

# HELP artemis_delivering_durable_persistent_size persistent size of durable messages that this queue is currently delivering to its consumers
# TYPE artemis_delivering_durable_persistent_size gauge
artemis_delivering_durable_persistent_size{address="DLQ",broker="0.0.0.0",queue="DLQ",} 0.0
artemis_delivering_durable_persistent_size{address="ExpiryQueue",broker="0.0.0.0",queue="ExpiryQueue",} 0.0
# HELP artemis_messages_expired number of messages expired from this queue since it was created
# TYPE artemis_messages_expired gauge
artemis_messages_expired{address="DLQ",broker="0.0.0.0",queue="DLQ",} 0.0
artemis_messages_expired{address="ExpiryQueue",broker="0.0.0.0",queue="ExpiryQueue",} 0.0
# HELP artemis_routed_message_count number of messages routed to one or more bindings
# TYPE artemis_routed_message_count gauge
artemis_routed_message_count{address="transactions.topic",broker="0.0.0.0",} 0.0
artemis_routed_message_count{address="ExpiryQueue",broker="0.0.0.0",} 0.0
artemis_routed_message_count{address="DLQ",broker="0.0.0.0",} 0.0
artemis_routed_message_count{address="activemq.notifications",broker="0.0.0.0",} 0.0
# HELP artemis_delivering_durable_message_count number of durable messages that this queue is currently delivering to its consumers
# TYPE artemis_delivering_durable_message_count gauge
artemis_delivering_durable_message_count{address="DLQ",broker="0.0.0.0",queue="DLQ",} 0.0
artemis_delivering_durable_message_count{address="ExpiryQueue",broker="0.0.0.0",queue="ExpiryQueue",} 0.0
# HELP artemis_scheduled_durable_message_count number of durable scheduled messages in this queue
# TYPE artemis_scheduled_durable_message_count gauge
artemis_scheduled_durable_message_count{address="DLQ",broker="0.0.0.0",queue="DLQ",} 0.0
artemis_scheduled_durable_message_count{address="ExpiryQueue",broker="0.0.0.0",queue="ExpiryQueue",} 0.0
# HELP jvm_memory_used_bytes The amount of used memory
# TYPE jvm_memory_used_bytes gauge
jvm_memory_used_bytes{area="nonheap",id="CodeHeap 'profiled nmethods'",} 8464000.0
jvm_memory_used_bytes{area="heap",id="G1 Survivor Space",} 5242880.0
jvm_memory_used_bytes{area="heap",id="G1 Old Gen",} 1.201388E7
jvm_memory_used_bytes{area="nonheap",id="Metaspace",} 3.7032912E7
jvm_memory_used_bytes{area="nonheap",id="CodeHeap 'non-nmethods'",} 1319168.0
jvm_memory_used_bytes{area="heap",id="G1 Eden Space",} 1.7825792E7
jvm_memory_used_bytes{area="nonheap",id="Compressed Class Space",} 4299112.0
jvm_memory_used_bytes{area="nonheap",id="CodeHeap 'non-profiled nmethods'",} 1591296.0
# HELP artemis_delivering_persistent_size persistent size of messages that this queue is currently delivering to its consumers
# TYPE artemis_delivering_persistent_size gauge
artemis_delivering_persistent_size{address="DLQ",broker="0.0.0.0",queue="DLQ",} 0.0
artemis_delivering_persistent_size{address="ExpiryQueue",broker="0.0.0.0",queue="ExpiryQueue",} 0.0
# HELP artemis_scheduled_persistent_size persistent size of scheduled messages in this queue
# TYPE artemis_scheduled_persistent_size gauge
artemis_scheduled_persistent_size{address="DLQ",broker="0.0.0.0",queue="DLQ",} 0.0
artemis_scheduled_persistent_size{address="ExpiryQueue",broker="0.0.0.0",queue="ExpiryQueue",} 0.0
# HELP artemis_unrouted_message_count number of messages not routed to any bindings
# TYPE artemis_unrouted_message_count gauge
artemis_unrouted_message_count{address="transactions.topic",broker="0.0.0.0",} 0.0
artemis_unrouted_message_count{address="ExpiryQueue",broker="0.0.0.0",} 0.0
artemis_unrouted_message_count{address="DLQ",broker="0.0.0.0",} 0.0
artemis_unrouted_message_count{address="activemq.notifications",broker="0.0.0.0",} 0.0
# HELP artemis_disk_store_usage Memory used by the disk store
# TYPE artemis_disk_store_usage gauge
artemis_disk_store_usage{broker="0.0.0.0",} 0.3252151758734422
# HELP artemis_message_count number of messages currently in this queue (includes scheduled, paged, and in-delivery messages)
# TYPE artemis_message_count gauge
artemis_message_count{address="DLQ",broker="0.0.0.0",queue="DLQ",} 0.0
artemis_message_count{address="ExpiryQueue",broker="0.0.0.0",queue="ExpiryQueue",} 0.0
# HELP artemis_connection_count Number of clients connected to this server
# TYPE artemis_connection_count gauge
artemis_connection_count{broker="0.0.0.0",} 0.0
# HELP artemis_messages_added number of messages added to this queue since it was created
# TYPE artemis_messages_added gauge
artemis_messages_added{address="DLQ",broker="0.0.0.0",queue="DLQ",} 0.0
artemis_messages_added{address="ExpiryQueue",broker="0.0.0.0",queue="ExpiryQueue",} 0.0
# HELP artemis_scheduled_message_count number of scheduled messages in this queue
# TYPE artemis_scheduled_message_count gauge
artemis_scheduled_message_count{address="DLQ",broker="0.0.0.0",queue="DLQ",} 0.0
artemis_scheduled_message_count{address="ExpiryQueue",broker="0.0.0.0",queue="ExpiryQueue",} 0.0
# HELP jvm_memory_committed_bytes The amount of memory in bytes that is committed for the Java virtual machine to use
# TYPE jvm_memory_committed_bytes gauge
jvm_memory_committed_bytes{area="nonheap",id="CodeHeap 'profiled nmethods'",} 8519680.0
jvm_memory_committed_bytes{area="heap",id="G1 Survivor Space",} 5242880.0
jvm_memory_committed_bytes{area="heap",id="G1 Old Gen",} 3.93216E8
jvm_memory_committed_bytes{area="nonheap",id="Metaspace",} 3.8141952E7
jvm_memory_committed_bytes{area="nonheap",id="CodeHeap 'non-nmethods'",} 2555904.0
jvm_memory_committed_bytes{area="heap",id="G1 Eden Space",} 1.40509184E8
jvm_memory_committed_bytes{area="nonheap",id="Compressed Class Space",} 4718592.0
jvm_memory_committed_bytes{area="nonheap",id="CodeHeap 'non-profiled nmethods'",} 2555904.0
# HELP artemis_consumer_count number of consumers consuming messages from this queue
# TYPE artemis_consumer_count gauge
artemis_consumer_count{address="DLQ",broker="0.0.0.0",queue="DLQ",} 0.0
artemis_consumer_count{address="ExpiryQueue",broker="0.0.0.0",queue="ExpiryQueue",} 0.0
# HELP jvm_buffer_count_buffers An estimate of the number of buffers in the pool
# TYPE jvm_buffer_count_buffers gauge
jvm_buffer_count_buffers{id="mapped",} 20.0
jvm_buffer_count_buffers{id="direct",} 244.0
# HELP jvm_buffer_memory_used_bytes An estimate of the memory that the Java virtual machine is using for this buffer pool
# TYPE jvm_buffer_memory_used_bytes gauge
jvm_buffer_memory_used_bytes{id="mapped",} 189300.0
jvm_buffer_memory_used_bytes{id="direct",} 2078922.0
# HELP artemis_scheduled_durable_persistent_size persistent size of durable scheduled messages in this queue
# TYPE artemis_scheduled_durable_persistent_size gauge
artemis_scheduled_durable_persistent_size{address="DLQ",broker="0.0.0.0",queue="DLQ",} 0.0
artemis_scheduled_durable_persistent_size{address="ExpiryQueue",broker="0.0.0.0",queue="ExpiryQueue",} 0.0
# HELP artemis_messages_acknowledged number of messages acknowledged from this queue since it was created
# TYPE artemis_messages_acknowledged gauge
artemis_messages_acknowledged{address="DLQ",broker="0.0.0.0",queue="DLQ",} 0.0
artemis_messages_acknowledged{address="ExpiryQueue",broker="0.0.0.0",queue="ExpiryQueue",} 0.0
# HELP artemis_delivering_message_count number of messages that this queue is currently delivering to its consumers
# TYPE artemis_delivering_message_count gauge
artemis_delivering_message_count{address="DLQ",broker="0.0.0.0",queue="DLQ",} 0.0
artemis_delivering_message_count{address="ExpiryQueue",broker="0.0.0.0",queue="ExpiryQueue",} 0.0
# HELP artemis_messages_killed number of messages removed from this queue since it was created due to exceeding the max delivery attempts
# TYPE artemis_messages_killed gauge
artemis_messages_killed{address="DLQ",broker="0.0.0.0",queue="DLQ",} 0.0
artemis_messages_killed{address="ExpiryQueue",broker="0.0.0.0",queue="ExpiryQueue",} 0.0
# HELP artemis_durable_message_count number of durable messages currently in this queue (includes scheduled, paged, and in-delivery messages)
# TYPE artemis_durable_message_count gauge
artemis_durable_message_count{address="DLQ",broker="0.0.0.0",queue="DLQ",} 0.0
artemis_durable_message_count{address="ExpiryQueue",broker="0.0.0.0",queue="ExpiryQueue",} 0.0
# HELP jvm_memory_max_bytes The maximum amount of memory in bytes that can be used for memory management
# TYPE jvm_memory_max_bytes gauge
jvm_memory_max_bytes{area="nonheap",id="CodeHeap 'profiled nmethods'",} 1.22912768E8
jvm_memory_max_bytes{area="heap",id="G1 Survivor Space",} -1.0
jvm_memory_max_bytes{area="heap",id="G1 Old Gen",} 2.147483648E9
jvm_memory_max_bytes{area="nonheap",id="Metaspace",} -1.0
jvm_memory_max_bytes{area="nonheap",id="CodeHeap 'non-nmethods'",} 5828608.0
jvm_memory_max_bytes{area="heap",id="G1 Eden Space",} -1.0
jvm_memory_max_bytes{area="nonheap",id="Compressed Class Space",} 1.073741824E9
jvm_memory_max_bytes{area="nonheap",id="CodeHeap 'non-profiled nmethods'",} 1.22916864E8
# HELP artemis_total_connection_count Number of clients which have connected to this server since it was started
# TYPE artemis_total_connection_count gauge
artemis_total_connection_count{broker="0.0.0.0",} 0.0
# HELP artemis_address_memory_usage Bytes used by all the addresses on broker for in-memory messages
# TYPE artemis_address_memory_usage gauge
artemis_address_memory_usage{broker="0.0.0.0",} 0.0
# HELP artemis_durable_persistent_size persistent size of durable messages currently in this queue (includes scheduled, paged, and in-delivery messages)
# TYPE artemis_durable_persistent_size gauge
artemis_durable_persistent_size{address="DLQ",broker="0.0.0.0",queue="DLQ",} 0.0
artemis_durable_persistent_size{address="ExpiryQueue",broker="0.0.0.0",queue="ExpiryQueue",} 0.0
# HELP jvm_buffer_total_capacity_bytes An estimate of the total capacity of the buffers in this pool
# TYPE jvm_buffer_total_capacity_bytes gauge
jvm_buffer_total_capacity_bytes{id="mapped",} 189300.0
jvm_buffer_total_capacity_bytes{id="direct",} 2078921.0
# HELP artemis_persistent_size persistent size of all messages (including durable and non-durable) currently in this queue (includes scheduled, paged, and in-delivery messages)
# TYPE artemis_persistent_size gauge
artemis_persistent_size{address="DLQ",broker="0.0.0.0",queue="DLQ",} 0.0
artemis_persistent_size{address="ExpiryQueue",broker="0.0.0.0",queue="ExpiryQueue",} 0.0

Possible race when servlet discovers registry?

This report comes from ASF Slack:

Hi, I've enabled Artemis Prometheus metrics as follow in my broker.xml:

<metrics>
  <plugin class-name="org.apache.activemq.artemis.core.server.metrics.plugins.ArtemisPrometheusMetricsPlugin"/>
</metrics>

It works most of the time and I'm able to get Prometheus metrics. However, randomly (usually after node restart) some nodes don't have metrics anymore and display the following error:

HTTP ERROR 404 Prometheus meter registry is null. Has the Prometheus Metrics Pluging been configured?

There is no visible difference in logs produced by a node having metrics and a node having no metrics. I don't know how to reproduce it. As a workaround, I have found that metrics can be enabled again by calling the JMX restartEmbeddedWebServer() to restart the Jetty server. Have you already seen something like that?

Add broker name to jvm metrics

currently the jvm metrics do not include the broker name. this is causing an issue when creating dashboards as the instance tag added by prometheus may not align with the broker name.

this might be as simple as:
meterRegistry.config().commonTags("broker", "XXXX");

not sure how to query the current server instance to get to the broker....

instance/tmp/webapps/metrics.war/webapp/,UNAVAILABLE,@Connector-0}{/var/lib/artemis-instance/web/metrics.war}

Injecting this into Docker, alongside the opentelemetry-javaagent.jar:
Using image apache/activemq-artemis:2.33.0 and injecting the javaagent.jar in the dockerfile.

activemq-service: build: context: ../../ dockerfile: ./ci/Docker-Images-Local/dockerfile.artemis environment: ARTEMIS_USER: admin ARTEMIS_PASSWORD: admin ANONYMOUS_LOGIN: "false" OTEL_SERVICE_NAME: activemq-service OTEL_TRACES_EXPORTER: otlp OTEL_METRICS_EXPORTER: otlp OTEL_LOGS_EXPORTER: otlp OTEL_EXPORTER_OTLP_ENDPOINT: http://otel-collector:4318 OTEL_EXPORTER_OTLP_PROTOCOL: http/protobuf OTEL_JAVAAGENT_DEBUG: false JAVA_AGENT: https://github.com/open-telemetry/opentelemetry-java-instrumentation/releases/download/v2.4.0/opentelemetry-javaagent.jar volumes: - ./artemis/config:/var/lib/artemis-instance/etc-override - ./artemis/lib:/var/lib/artemis-instance/lib - ./artemis/web:/var/lib/artemis-instance/web ports: - 8161:8161 - 9404:9404 - 1099:1099 - 61616:61616
The metrics.war file is in /var/lib/artemis-instance/web, the jar is in the /var/lib/artemis-instance/lib, and the bootstrap.xml and broker.xml are configured.

Receiving this log output:

2024-06-04 22:02:31,673 WARN [org.eclipse.jetty.webapp.WebAppContext] Failed startup of context o.e.j.w.WebAppContext@39595a8{/metrics,file:///var/lib/artemis-instance/tmp/webapps/metrics.war/webapp/,UNAVAILABLE,@Connector-0}{/var/lib/artemis-instance/web/metrics.war} java.lang.NoClassDefFoundError: jakarta/servlet/http/HttpServlet at java.base/java.lang.ClassLoader.defineClass1(Native Method) ~[?:?] at java.base/java.lang.ClassLoader.defineClass(Unknown Source) ~[?:?] at java.base/java.security.SecureClassLoader.defineClass(Unknown Source) ~[?:?] at java.base/java.net.URLClassLoader.defineClass(Unknown Source) ~[?:?] at java.base/java.net.URLClassLoader$1.run(Unknown Source) ~[?:?] at java.base/java.net.URLClassLoader$1.run(Unknown Source) ~[?:?] at java.base/java.security.AccessController.doPrivileged(Unknown Source) ~[?:?] at java.base/java.net.URLClassLoader.findClass(Unknown Source) ~[?:?] at org.eclipse.jetty.webapp.WebAppClassLoader.foundClass(WebAppClassLoader.java:594) ~[jetty-webapp-10.0.20.jar:10.0.20] at org.eclipse.jetty.webapp.WebAppClassLoader.loadAsResource(WebAppClassLoader.java:567) ~[jetty-webapp-10.0.20.jar:10.0.20] at org.eclipse.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:502) ~[jetty-webapp-10.0.20.jar:10.0.20] at java.base/java.lang.ClassLoader.loadClass(Unknown Source) ~[?:?] at org.eclipse.jetty.util.Loader.loadClass(Loader.java:59) ~[jetty-util-10.0.20.jar:10.0.20] at org.eclipse.jetty.servlet.BaseHolder.doStart(BaseHol
Any ideas how to solve this?

Publish binaries

Any plans to publish pre-built Maven artifacts for this project?

I could provide a PR, but I would have to change the Maven coordinates to point at the github repo without any involvement from others.

Metrics for queues

Hello,

Is there any way to enable/disable metrics on queue level?

I have made some experiments with address-settings.xml. It seems to work on

level only:

_<address-setting match="someTopic">
	<enable-metrics>true</enable-metrics>
</address-setting>_

It does not work for:

_<address-setting match="someQueue1">
	<enable-metrics>true</enable-metrics>
</address-setting>_

My Artemis EB implementation has structure:

_<address name="someTopic">
    <multicast>
        <queue name="someQueue1"/>
        <queue name="someQueue2"/>
        <queue name="someQueue3"/>
    </multicast>
</address>_

Regards,
Pawel

Metrics plugin responds "404- not found"

Wanted to report about an issue that im facing. During artemis service restart i often find that the metrics plugin responds "404- not found". Under what circumstance can I expect this to happen?.

Initially suspected if it has to do with scrape _interval setting under Prometheus, but tuning that didn't help fix this issue.
Im using Artemis v2.31.0., Prometheus v2.45.0.

MicrosoftTeams-image (20)

3.0.0 WebApp Error

I am trying to deploy the latest 3.0.0 release. I built it using java 11, and it's failing on startup.

2024-04-01 19:39:33,265 WARN [org.eclipse.jetty.webapp.WebAppContext] Failed startup of context o.e.j.w.WebAppContext@16f0ec18{/metrics,file:///var/lib/artemis-instance/tmp/webapps/metrics.war/webapp/,UNAVAILABLE,@Connector-0}{/var/lib/artemis-instance/web/metrics.war}
artemis-1_artemis-primary.1.qjlk96i4wfil@ip-10-104-8-173 | java.lang.NoClassDefFoundError: jakarta/servlet/http/HttpServlet
artemis-1_artemis-primary.1.qjlk96i4wfil@ip-10-104-8-173 | at java.base/java.lang.ClassLoader.defineClass1(Native Method) ~[?:?]
artemis-1_artemis-primary.1.qjlk96i4wfil@ip-10-104-8-173 | at java.base/java.lang.ClassLoader.defineClass(Unknown Source) ~[?:?]
artemis-1_artemis-primary.1.qjlk96i4wfil@ip-10-104-8-173 | at java.base/java.security.SecureClassLoader.defineClass(Unknown Source) ~[?:?]
artemis-1_artemis-primary.1.qjlk96i4wfil@ip-10-104-8-173 | at java.base/java.net.URLClassLoader.defineClass(Unknown Source) ~[?:?]
artemis-1_artemis-primary.1.qjlk96i4wfil@ip-10-104-8-173 | at java.base/java.net.URLClassLoader$1.run(Unknown Source) ~[?:?]
artemis-1_artemis-primary.1.qjlk96i4wfil@ip-10-104-8-173 | at java.base/java.net.URLClassLoader$1.run(Unknown Source) ~[?:?]
artemis-1_artemis-primary.1.qjlk96i4wfil@ip-10-104-8-173 | at java.base/java.security.AccessController.doPrivileged(Unknown Source) ~[?:?]
artemis-1_artemis-primary.1.qjlk96i4wfil@ip-10-104-8-173 | at java.base/java.net.URLClassLoader.findClass(Unknown Source) ~[?:?]
artemis-1_artemis-primary.1.qjlk96i4wfil@ip-10-104-8-173 | at org.eclipse.jetty.webapp.WebAppClassLoader.foundClass(WebAppClassLoader.java:594) ~[jetty-webapp-10.0.20.jar:10.0.20]
artemis-1_artemis-primary.1.qjlk96i4wfil@ip-10-104-8-173 | at org.eclipse.jetty.webapp.WebAppClassLoader.loadAsResource(WebAppClassLoader.java:567) ~[jetty-webapp-10.0.20.jar:10.0.20]
artemis-1_artemis-primary.1.qjlk96i4wfil@ip-10-104-8-173 | at org.eclipse.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:502) ~[jetty-webapp-10.0.20.jar:10.0.20]
artemis-1_artemis-primary.1.qjlk96i4wfil@ip-10-104-8-173 | at java.base/java.lang.ClassLoader.loadClass(Unknown Source) ~[?:?]
artemis-1_artemis-primary.1.qjlk96i4wfil@ip-10-104-8-173 | at org.eclipse.jetty.util.Loader.loadClass(Loader.java:59) ~[jetty-util-10.0.20.jar:10.0.20]
artemis-1_artemis-primary.1.qjlk96i4wfil@ip-10-104-8-173 | at org.eclipse.jetty.servlet.BaseHolder.doStart(BaseHolder.java:97) ~[jetty-servlet-10.0.20.jar:10.0.20]
artemis-1_artemis-primary.1.qjlk96i4wfil@ip-10-104-8-173 | at org.eclipse.jetty.servlet.ServletHolder.doStart(ServletHolder.java:369) ~[jetty-servlet-10.0.20.jar:10.0.20]
artemis-1_artemis-primary.1.qjlk96i4wfil@ip-10-104-8-173 | at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:93) ~[jetty-util-10.0.20.jar:10.0.20]
artemis-1_artemis-primary.1.qjlk96i4wfil@ip-10-104-8-173 | at org.eclipse.jetty.servlet.ServletHandler.lambda$initialize$2(ServletHandler.java:724) ~[jetty-servlet-10.0.20.jar:10.0.20]
artemis-1_artemis-primary.1.qjlk96i4wfil@ip-10-104-8-173 | at java.base/java.util.stream.SortedOps$SizedRefSortingSink.end(Unknown Source) ~[?:?]
artemis-1_artemis-primary.1.qjlk96i4wfil@ip-10-104-8-173 | at java.base/java.util.stream.AbstractPipeline.copyInto(Unknown Source) ~[?:?]
artemis-1_artemis-primary.1.qjlk96i4wfil@ip-10-104-8-173 | at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(Unknown Source) ~[?:?]
artemis-1_artemis-primary.1.qjlk96i4wfil@ip-10-104-8-173 | at java.base/java.util.stream.StreamSpliterators$WrappingSpliterator.forEachRemaining(Unknown Source) ~[?:?]
artemis-1_artemis-primary.1.qjlk96i4wfil@ip-10-104-8-173 | at java.base/java.util.stream.Streams$ConcatSpliterator.forEachRemaining(Unknown Source) ~[?:?]
artemis-1_artemis-primary.1.qjlk96i4wfil@ip-10-104-8-173 | at java.base/java.util.stream.ReferencePipeline$Head.forEach(Unknown Source) ~[?:?]
artemis-1_artemis-primary.1.qjlk96i4wfil@ip-10-104-8-173 | at org.eclipse.jetty.servlet.ServletHandler.initialize(ServletHandler.java:749) ~[jetty-servlet-10.0.20.jar:10.0.20]
artemis-1_artemis-primary.1.qjlk96i4wfil@ip-10-104-8-173 | at org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:392) ~[jetty-servlet-10.0.20.jar:10.0.20]
artemis-1_artemis-primary.1.qjlk96i4wfil@ip-10-104-8-173 | at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1304) ~[jetty-webapp-10.0.20.jar:10.0.20]
artemis-1_artemis-primary.1.qjlk96i4wfil@ip-10-104-8-173 | at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:901) ~[jetty-server-10.0.20.jar:10.0.20]
artemis-1_artemis-primary.1.qjlk96i4wfil@ip-10-104-8-173 | at org.eclipse.jetty.servlet.ServletContextHandler.doStart(ServletContextHandler.java:306) ~[jetty-servlet-10.0.20.jar:10.0.20]
artemis-1_artemis-primary.1.qjlk96i4wfil@ip-10-104-8-173 | at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:532) [jetty-webapp-10.0.20.jar:10.0.20]
artemis-1_artemis-primary.1.qjlk96i4wfil@ip-10-104-8-173 | at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:93) [jetty-util-10.0.20.jar:10.0.20]
artemis-1_artemis-primary.1.qjlk96i4wfil@ip-10-104-8-173 | at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:171) [jetty-util-10.0.20.jar:10.0.20]
artemis-1_artemis-primary.1.qjlk96i4wfil@ip-10-104-8-173 | at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:121) [jetty-util-10.0.20.jar:10.0.20]
artemis-1_artemis-primary.1.qjlk96i4wfil@ip-10-104-8-173 | at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:89) [jetty-server-10.0.20.jar:10.0.20]
artemis-1_artemis-primary.1.qjlk96i4wfil@ip-10-104-8-173 | at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:93) [jetty-util-10.0.20.jar:10.0.20]
artemis-1_artemis-primary.1.qjlk96i4wfil@ip-10-104-8-173 | at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:171) [jetty-util-10.0.20.jar:10.0.20]
artemis-1_artemis-primary.1.qjlk96i4wfil@ip-10-104-8-173 | at org.eclipse.jetty.server.Server.start(Server.java:470) [jetty-server-10.0.20.jar:10.0.20]
artemis-1_artemis-primary.1.qjlk96i4wfil@ip-10-104-8-173 | at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:114) [jetty-util-10.0.20.jar:10.0.20]
artemis-1_artemis-primary.1.qjlk96i4wfil@ip-10-104-8-173 | at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:89) [jetty-server-10.0.20.jar:10.0.20]
artemis-1_artemis-primary.1.qjlk96i4wfil@ip-10-104-8-173 | at org.eclipse.jetty.server.Server.doStart(Server.java:415) [jetty-server-10.0.20.jar:10.0.20]
artemis-1_artemis-primary.1.qjlk96i4wfil@ip-10-104-8-173 | at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:93) [jetty-util-10.0.20.jar:10.0.20]
artemis-1_artemis-primary.1.qjlk96i4wfil@ip-10-104-8-173 | at org.apache.activemq.artemis.component.WebServerComponent.start(WebServerComponent.java:215) [artemis-web-2.33.0.jar:2.33.0]
artemis-1_artemis-primary.1.qjlk96i4wfil@ip-10-104-8-173 | at org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl.addExternalComponent(ActiveMQServerImpl.java:1018) [artemis-server-2.33.0.jar:2.33.0]
artemis-1_artemis-primary.1.qjlk96i4wfil@ip-10-104-8-173 | at org.apache.activemq.artemis.cli.commands.Run.execute(Run.java:145) [artemis-cli-2.33.0.jar:2.33.0]
artemis-1_artemis-primary.1.qjlk96i4wfil@ip-10-104-8-173 | at org.apache.activemq.artemis.cli.Artemis.internalExecute(Artemis.java:221) [artemis-cli-2.33.0.jar:2.33.0]
artemis-1_artemis-primary.1.qjlk96i4wfil@ip-10-104-8-173 | at org.apache.activemq.artemis.cli.Artemis.execute(Artemis.java:167) [artemis-cli-2.33.0.jar:2.33.0]
artemis-1_artemis-primary.1.qjlk96i4wfil@ip-10-104-8-173 | at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(Unknown Source) ~[?:?]
artemis-1_artemis-primary.1.qjlk96i4wfil@ip-10-104-8-173 | at java.base/java.lang.reflect.Method.invoke(Unknown Source) ~[?:?]
artemis-1_artemis-primary.1.qjlk96i4wfil@ip-10-104-8-173 | at org.apache.activemq.artemis.boot.Artemis.execute(Artemis.java:157) [artemis-boot.jar:2.33.0]
artemis-1_artemis-primary.1.qjlk96i4wfil@ip-10-104-8-173 | at org.apache.activemq.artemis.boot.Artemis.main(Artemis.java:64) [artemis-boot.jar:2.33.0]
artemis-1_artemis-primary.1.qjlk96i4wfil@ip-10-104-8-173 | Caused by: java.lang.ClassNotFoundException: jakarta.servlet.http.HttpServlet
artemis-1_artemis-primary.1.qjlk96i4wfil@ip-10-104-8-173 | at java.base/java.net.URLClassLoader.findClass(Unknown Source) ~[?:?]
artemis-1_artemis-primary.1.qjlk96i4wfil@ip-10-104-8-173 | at java.base/java.lang.ClassLoader.loadClass(Unknown Source) ~[?:?]
artemis-1_artemis-primary.1.qjlk96i4wfil@ip-10-104-8-173 | at java.base/java.lang.ClassLoader.loadClass(Unknown Source) ~[?:?]
artemis-1_artemis-primary.1.qjlk96i4wfil@ip-10-104-8-173 | at org.eclipse.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:511) ~[jetty-webapp-10.0.20.jar:10.0.20]
artemis-1_artemis-primary.1.qjlk96i4wfil@ip-10-104-8-173 | at java.base/java.lang.ClassLoader.loadClass(Unknown Source) ~[?:?]
artemis-1_artemis-primary.1.qjlk96i4wfil@ip-10-104-8-173 | ... 49 more

Build failure

Building from master from a fresh checkout with

openjdk version "11.0.21" 2023-10-17 LTS
OpenJDK Runtime Environment (Red_Hat-11.0.21.0.9-1) (build 11.0.21+9-LTS)
OpenJDK 64-Bit Server VM (Red_Hat-11.0.21.0.9-1) (build 11.0.21+9-LTS, mixed mode, sharing)

and

Apache Maven 3.6.3 (Red Hat 3.6.3-15)
Maven home: /usr/share/maven
Java version: 17.0.9, vendor: Red Hat, Inc., runtime: /usr/lib/jvm/java-17-openjdk-17.0.9.0.9-2.el9.x86_64
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "5.14.0-284.30.1.el9_2.x86_64", arch: "amd64", family: "unix"

gives

[INFO] Reactor Summary for artemis-prometheus-metrics-pom 2.1.0:
[INFO] 
[INFO] artemis-prometheus-metrics-pom ..................... SUCCESS [  0.597 s]
[INFO] ActiveMQ Artemis Prometheus Metrics Plugin Servlet . FAILURE [  2.871 s]
[INFO] ActiveMQ Artemis Prometheus Metrics Plugin ......... SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  3.537 s
[INFO] Finished at: 2023-11-14T16:21:48-05:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-war-plugin:2.2:war (default-war) on project artemis-prometheus-metrics-plugin-servlet: Execution default-war of goal org.apache.maven.plugins:maven-war-plugin:2.2:war failed: Unable to load the mojo 'war' in the plugin 'org.apache.maven.plugins:maven-war-plugin:2.2' due to an API incompatibility: org.codehaus.plexus.component.repository.exception.ComponentLookupException: Cannot access defaults field of Properties
[ERROR] -----------------------------------------------------
[ERROR] realm =    plugin>org.apache.maven.plugins:maven-war-plugin:2.2
[ERROR] strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy
[ERROR] urls[0] = file:/home/horreum/.m2/repository/org/apache/maven/plugins/maven-war-plugin/2.2/maven-war-plugin-2.2.jar
[ERROR] urls[1] = file:/home/horreum/.m2/repository/org/apache/maven/reporting/maven-reporting-api/2.0.6/maven-reporting-api-2.0.6.jar
[ERROR] urls[2] = file:/home/horreum/.m2/repository/org/apache/maven/doxia/doxia-sink-api/1.0-alpha-7/doxia-sink-api-1.0-alpha-7.jar
[ERROR] urls[3] = file:/home/horreum/.m2/repository/commons-cli/commons-cli/1.0/commons-cli-1.0.jar
[ERROR] urls[4] = file:/home/horreum/.m2/repository/org/codehaus/plexus/plexus-interactivity-api/1.0-alpha-4/plexus-interactivity-api-1.0-alpha-4.jar
[ERROR] urls[5] = file:/home/horreum/.m2/repository/org/apache/maven/maven-archiver/2.5/maven-archiver-2.5.jar
[ERROR] urls[6] = file:/home/horreum/.m2/repository/org/codehaus/plexus/plexus-io/2.0.2/plexus-io-2.0.2.jar
[ERROR] urls[7] = file:/home/horreum/.m2/repository/org/codehaus/plexus/plexus-archiver/2.1/plexus-archiver-2.1.jar
[ERROR] urls[8] = file:/home/horreum/.m2/repository/org/codehaus/plexus/plexus-interpolation/1.15/plexus-interpolation-1.15.jar
[ERROR] urls[9] = file:/home/horreum/.m2/repository/junit/junit/3.8.1/junit-3.8.1.jar
[ERROR] urls[10] = file:/home/horreum/.m2/repository/com/thoughtworks/xstream/xstream/1.3.1/xstream-1.3.1.jar
[ERROR] urls[11] = file:/home/horreum/.m2/repository/xpp3/xpp3_min/1.1.4c/xpp3_min-1.1.4c.jar
[ERROR] urls[12] = file:/home/horreum/.m2/repository/org/codehaus/plexus/plexus-utils/3.0/plexus-utils-3.0.jar
[ERROR] urls[13] = file:/home/horreum/.m2/repository/org/apache/maven/shared/maven-filtering/1.0-beta-2/maven-filtering-1.0-beta-2.jar
[ERROR] Number of foreign imports: 1
[ERROR] import: Entry[import  from realm ClassRealm[maven.api, parent: null]]

Artemis 2.13.x requires Java 11 so everything should be in order...

Ideas ?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.