Skip to content
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

Add JMX monitoring #79

Closed
augi opened this issue Jul 28, 2015 · 6 comments
Closed

Add JMX monitoring #79

augi opened this issue Jul 28, 2015 · 6 comments
Assignees
Milestone

Comments

@augi
Copy link

augi commented Jul 28, 2015

It would be very useful to get at least some basic statistics published via JMX. E.g. number of messages published, consumed, rejected, number of threads used etc.

@augi augi changed the title Add JMX monitoring to Java client Add JMX monitoring Jul 28, 2015
@michaelklishin
Copy link
Member

This is a good idea but there's one problem: this means we'd have an external dependency on something like the Metrics library. Historically the client has been trying hard to stay dependency-free as much as possible.

Besides that, what specific metrics do you want to collect? Number of threads used by the library is not necessarily easy to calculate because custom thread executors and factories can be provided.

Per protocol method stats (number of messages published, delivered, acked, nacked, fetched with basic.get) sounds good.

@stevecstian
Copy link

How about optional dependency?

@michaelklishin
Copy link
Member

If the dependency is optional then the feature is also opt-in. This may be a decent middle ground.

@michaelklishin michaelklishin self-assigned this Jul 28, 2015
@augi
Copy link
Author

augi commented Jul 28, 2015

I don't have deep understanding of the Client internals so I picked few metrics that could be interesting (mainly number of messages).

If we don't want to add more dependencies to Client then we could introduce a plain interface for metrics, support it in ConnectionFactory, and call it from the right places. The implementation could be in separate project then.

Optional dependency could be also viable solution.

@michaelklishin
Copy link
Member

@augi yes, that sounds reasonable.

@MartinGoodwell
Copy link

Is there any progress on JMX integration?
I wanted to add that for pure JMX metrics, no additional dependency is required as any functionality is available in the javax.management package.
Here's an example (where BrokerMetrics is a POJO that implements an interface called BrokerMetricsMBean:

import java.lang.management.ManagementFactory;

import javax.management.InstanceAlreadyExistsException;
import javax.management.MBeanRegistrationException;
import javax.management.MBeanServer;
import javax.management.MalformedObjectNameException;
import javax.management.NotCompliantMBeanException;
import javax.management.ObjectName;

//Get the MBean server
MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
//register the MBean
BrokerMetrics mBean = new BrokerMetrics();
ObjectName name = new ObjectName("com.rabbitmq:type=Broker");
mbs.registerMBean(mBean, name);

Here's a more verbose example (with quite some annoying ads): http://www.journaldev.com/1352/what-is-jmx-mbean-jconsole-tutorial

I tried to do the implementation myself but I already failed at building the rabbitmq-java-client (error in antrun)

@michaelklishin michaelklishin added this to the 4.0.0 milestone Aug 24, 2016
acogoluegnes added a commit that referenced this issue Aug 29, 2016
Only connection, channel, published message, consumed message count.

Fixes #79
acogoluegnes added a commit that referenced this issue Aug 29, 2016
acogoluegnes added a commit that referenced this issue Aug 30, 2016
acogoluegnes added a commit that referenced this issue Aug 30, 2016
acogoluegnes added a commit that referenced this issue Aug 30, 2016
acogoluegnes added a commit that referenced this issue Aug 31, 2016
acogoluegnes added a commit that referenced this issue Aug 31, 2016
stream-iori pushed a commit to stream-iori/rabbitmq-java-client that referenced this issue Mar 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants