Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

parfait-agent initializes before main app so JMX MBeans do not exist #32

Open
rwallinterset opened this Issue Aug 26, 2016 · 4 comments

Comments

Projects
None yet
3 participants

I have been trying to figure out how to use parfait and I thought I had it all figured out but I can't get my custom jmx mbeans to be registered. I am currently running parfait using the javaagent argument when calling my app. After lots of messing around I think the issue is that parfait is being loaded before my app initializes so the JMX mbeans do not exist at the time time parfait is initialized. What am I doing wrong?

I also tried to figure out how the JMXconnector works as I thought that might be a better way to go but I can't figure out how to configure the proxy.xml to point it at a specific java app.

Any help would be appreciated.

Ok so I confirmed that was the issue. I created a new thread class and if I spin a thread with a sleep in it which then executes the ParfaitAgent premain method all works fine.

Contributor

tallpsmith commented Aug 29, 2016

@natoscott will have to comment directly here on the current state, but I believe right now parfait-agent will only export some known JVM metrics, there's not yet a mechanism to export custom (application-specific) metrics as yet (though that is definitely the plan).

Part of the Parfait lifecycle requires a 'quiet' period for new metrics to appear - it waits up to 5 seconds after the last detected metric has been registered before (re)starting the export. This prevents a large application starting up, registering a lot from tripping a blitz of registrations to PCP. Once the application has quieted down, Parfait will begin exporting to PCP.

Eventually your own JMX/custom metrics will be registered by a mechanism like an XML config.

You might also want to look at the Parfait-DropWizard integration (part of this module). If you are using DropWizard metrics in the application, it's pretty easy to have these exported to PCP.

Contributor

natoscott commented Sep 9, 2016

@tallpsmith that's correct - addition of user-defined metrics, as described, is WIP (as is exposing the Parfait delayed initialization concept). With the earlier reference to proxy.xml, that's just a placeholder at this stage - also WIP.

Contributor

natoscott commented Oct 18, 2016

Just a bit more followup here - parfait-agent has always used the DynamicMonitoringView Parfait class, which performs the delayed-initialisation-if-needed @tallpsmith referred to above (re 'quiet' period). I've just added some code to allow the application startup time to be set to something different to the default 5 seconds if need be. I'll be looking into the proxying mode shortly too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment