-
Notifications
You must be signed in to change notification settings - Fork 296
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
Unable to use JmxMonitorRegistry for registering metrics #155
Comments
You can use Monitors.registerObject(s1) Daniel On May 6, 2013, at 2:55 PM, arora-ajay-11 notifications@github.com wrote:
|
Hi Daniel, I am attaching an image of the structure I am getting in VisualVM for your reference. Thanks, On May 6, 2013 9:19 PM, "Daniel Muino" notifications@github.com wrote:
|
Servo maps the tags specified for a monitor to properties on the JMX object name. In general we don't know how to map arbitrary tags on monitors into an object name so we just map the tags one-to-one to object name properties. This also gives the most flexibility for querying them using patterns: http://docs.oracle.com/javaee/1.4/api/javax/management/ObjectName.html For the jmx view I use there object name query matches a set of mbeans which then get flattened to a table letting me slice and dice across mbeans. The order of properties is not significant on the object name, but some tools allow you to specify the order. This can let you change the way they are grouped when expanding the tree to something that is more convenient. For example in visual vm: Preferences > MBeans > Ordered key property list The other difference is you seem to have tags like the server name and ip in your list. We typically apply common tags globally to metrics using a custom observer when they are reported to the backends. So things like ip won't show up in the jmx view. In general stuff like ip isn't useful for jmx on a single instance, but is useful for aggregation backends. We can consider adding a hook that would let the user specify how they want to map a servo MonitorConfig to an ObjectName. |
Hi, http://techblog.netflix.com/2012/02/announcing-servo.html But I couldn't find the @monitorid annotation. Can you please provide me the details of the library which has it ? Server s1 = new Server("s1"); There is no such method like registerObject(s1) in DefaultMonitorRegistry class. Can you please provide me some info on that too ? Actually, I am getting the following object tree in JConsole after using @monitor annotations : See IncorrectFormat.jpg attached. While I want it to be looked like ( See attached CorrectFormat.jpg). Below is my java class : This is CorrectFormat.jpg This is IncorrectFormat.jpg public class Server {
} Can you please guide me how can I get the desired output in JConsole or VisualVM ? |
@monitorid was replaced by @MonitorTags which is more generic and allows DefaultMonitorRegistry.getInstance().registerObject(s1); should be: Monitors.registerObject(s1); Please see https://github.com/Netflix/servo/wiki for current documentation. Regarding how metrics get represented in JMX I don't think that's On Fri, May 10, 2013 at 11:12 AM, arora-ajay-11 notifications@github.comwrote:
|
What strikes me as odd is that the servo home page wiki, https://github.com/Netflix/servo/wiki, has an image, as referenced above by Ajay, which shows a nice jconsole screen display. Perhaps feature might have been removed when the project was being released to open source? As a small shop, we frequently use jconsole -- without this method of displaying all the keys and values together on one page, it would mean clicking endlessly to go from value to value. :( |
I believe you are referring to visualvm, a product that ships with the java On Wed, May 22, 2013 at 5:19 PM, danfin notifications@github.com wrote:
|
There are a number of areas where we need to update and improve the documention, that image is one of them. The change that you are seeing has to do with the increased use of tags for describing the metrics. Internally we increasingly use tags on the metrics so we can slice and dice on arbitrary dimensions and these get reported to an internal monitoring system that handles it well. We usually look at graphs aggregated across clusters and only drill down to individual machines as needed so the local JMX view isn't really used much. The problem with tags has been that not all backends support them. JMX does support them in the sense that the object name can take an arbitrary set of properties and if you query using the object name wildcards you can slice and dice the metrics to get better views. However, most JMX clients don't support this very well. My proposal, would be to introduce an option for allowing a you to customize the way the MonitorConfig gets mapped to an ObjectName. We can provide an implementation that uses the current approach and another that attempts to make the names work with most JMX viewers, though we'll have to either exclude or fold tags into a big string or use composite data support which is also painful to view unless only simple known tags are used. Thoughts? |
To make this a bit more concrete, if you consider built in garbage collector data in jmx, visual vm forces you to look at old and young gen separately, for example: With the simple servlet view I typically use for JMX I can get the same view for an individual "mbean": But simply by tweaking the object name wildcard I can view information for both the young and old gen collector together: With the way we model the mbeans right now you can do powerful queries using the object name wildcards to control how the data is viewed. It also allows us to keep the value type as simple, even with arbitrary tag lists, rather than the "CompositeDataSupport" type like you see with the LastGcInfo attribute of the garbage collector stats. In my opinion the best option is for JMX viewers to become less rigid and allow users to take advantage of the query support in JMX. However, right now for servo I think the right approach is to provide some user control over how the mapping to JMX ObjectName takes place. So you can make the choice map it in such a way it is more convenient for tools like jconsole of visualvm. |
To Use JmxMonitorRegistry/ DefaultMonitorRegistry, I have to pass them a Monitor<?> types argument. But I just have a POJO class in which some properties have been annotated with @monitor annotation. Now I want to publish these properties to JMX server for monitoring purpose. But, when I follow your example,
Server s1 = new Server("s1");
DefaultMonitorRegistry.getInstance().registerObject(s1);
This is not working for me as DefaultMonitorRegistry's registerObject method requires a Monitor<?> object and not a simple Java Object.
Can you please explain how can I use DefaultMonitorRegistry/JmxMonitorRegistry to register properties of my simple java class ?
Thanks,
Ajay Arora
The text was updated successfully, but these errors were encountered: